public void complete ( VirtualConnection vc , TCPReadRequestContext rsc ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "complete() called: vc=" + vc ) ; } HttpOutboundServiceContextImpl mySC = ( HttpOutboundServiceContextImpl ) vc . getStateMap ( ) . get ( CallbackIDs . CALLBACK_HTTPOSC ) ; // keep reading and handling new data until either we're done // parsing headers or until we're waiting on a read to finish // Note: parseMessage will allocate the read buffers boolean rc = false ; while ( ! rc && null != vc ) { rc = handleNewData ( mySC , vc ) ; // if we're not done parsing, then read more data if ( ! rc ) { // read whatever is available vc = rsc . read ( 1 , this , false , mySC . getReadTimeout ( ) ) ; } } // if rc is false, then this callback will be used later on when // the read completes, otherwise check the status code from the // response message if ( rc ) { StatusCodes status = mySC . getResponse ( ) . getStatusCode ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "100-continue scenario received " + status ) ; } if ( status . equals ( StatusCodes . CONTINUE ) ) { // got the 100-continue mySC . resetRead ( ) ; mySC . getAppWriteCallback ( ) . complete ( vc ) ; } else { // anything else, pass along the ExpectationFailedException mySC . setPersistent ( false ) ; mySC . getAppWriteCallback ( ) . error ( vc , new ExpectationFailedException ( status . getIntCode ( ) + " " + mySC . getResponse ( ) . getReasonPhrase ( ) ) ) ; } } }
When the response has been received we need to parse the status line and verify that it was the 100 Continue . If it was then pass along the notification to the application channel . If it was anything else then pass an error up to the application channel using the specific Expectation - Failed exception .