public static HttpResponse createResponse ( Request < ? > request , HttpRequestBase method , org . apache . http . HttpResponse apacheHttpResponse , HttpContext context ) throws IOException { HttpResponse httpResponse = new HttpResponse ( request , method , context ) ; if ( apacheHttpResponse . getEntity ( ) != null ) { httpResponse . setContent ( apacheHttpResponse . getEntity ( ) . getContent ( ) ) ; } httpResponse . setStatusCode ( apacheHttpResponse . getStatusLine ( ) . getStatusCode ( ) ) ; httpResponse . setStatusText ( apacheHttpResponse . getStatusLine ( ) . getReasonPhrase ( ) ) ; for ( Header header : apacheHttpResponse . getAllHeaders ( ) ) { httpResponse . addHeader ( header . getName ( ) , header . getValue ( ) ) ; } return httpResponse ; }
Creates and initializes an HttpResponse object suitable to be passed to an HTTP response handler object .