/** * Check whether a connection should alive or not. * @param keepAliveConfig of the connection * @param outboundRequestMsg of this particular transaction * @return true if the connection should be kept alive * @throws ConfigurationException for invalid configurations */ public static boolean isKeepAlive(KeepAliveConfig keepAliveConfig, HttpCarbonMessage outboundRequestMsg) throws ConfigurationException { switch (keepAliveConfig) { case AUTO: return Float.valueOf((String) outboundRequestMsg.getProperty(Constants.HTTP_VERSION)) > Constants.HTTP_1_0; case ALWAYS: return true; case NEVER: return false; default: // The execution will never reach here. In case execution reach here means it should be an invalid value // for keep-alive configurations. throw new ConfigurationException("Invalid keep-alive configuration value : " + keepAliveConfig.toString()); } }