public static FullHttpResponse toFullHttpResponse ( int streamId , Http2Headers http2Headers , ByteBufAllocator alloc , boolean validateHttpHeaders ) throws Http2Exception { HttpResponseStatus status = parseStatus ( http2Headers . status ( ) ) ; // HTTP/2 does not define a way to carry the version or reason phrase that is included in an // HTTP/1.1 status line. FullHttpResponse msg = new DefaultFullHttpResponse ( HttpVersion . HTTP_1_1 , status , alloc . buffer ( ) , validateHttpHeaders ) ; try { addHttp2ToHttpHeaders ( streamId , http2Headers , msg , false ) ; } catch ( Http2Exception e ) { msg . release ( ) ; throw e ; } catch ( Throwable t ) { msg . release ( ) ; throw streamError ( streamId , PROTOCOL_ERROR , t , "HTTP/2 to HTTP/1.x headers conversion error" ) ; } return msg ; }
Create a new object to contain the response data