@ Override public void setResponse ( HttpResponseMessage msg ) throws IllegalResponseObjectException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "setResponse: " + msg ) ; } // null message isn't allowed if ( null == msg ) { throw new IllegalResponseObjectException ( "Illegal null message" ) ; } // save new object as our response object HttpResponseMessageImpl temp = null ; try { temp = ( HttpResponseMessageImpl ) msg ; } catch ( ClassCastException cce ) { // no FFDC required if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Non msg impl passed to setResponse" ) ; } throw new IllegalResponseObjectException ( "Invalid message provided" ) ; } // possibly clean up any existing response object if ( null != getMyResponse ( ) && isResponseOwner ( ) ) { if ( ! getMyResponse ( ) . equals ( temp ) ) { getMyResponse ( ) . destroy ( ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Caller overlaying same message" ) ; } } } setMyResponse ( temp ) ; getMyResponse ( ) . init ( this ) ; // moving the response to the inbound side will use the inbound sides // configured header change limit getMyResponse ( ) . setHeaderChangeLimit ( getHttpConfig ( ) . getHeaderChangeLimit ( ) ) ; updatePersistence ( getMyResponse ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "setResponse" ) ; } }
Set the response object in the service context for usage .