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 ( ) ) ; } }
Check whether a connection should alive or not .