public static void writeHttp2Promise ( Http2PushPromise pushPromise , ChannelHandlerContext ctx , Http2Connection conn , Http2ConnectionEncoder encoder , HttpCarbonMessage inboundRequestMsg , HttpResponseFuture outboundRespStatusFuture , int originalStreamId ) throws Http2Exception { int promisedStreamId = getNextStreamId ( conn ) ; // Update streamIds pushPromise . setPromisedStreamId ( promisedStreamId ) ; pushPromise . setStreamId ( originalStreamId ) ; // Construct http request HttpRequest httpRequest = pushPromise . getHttpRequest ( ) ; httpRequest . headers ( ) . add ( HttpConversionUtil . ExtensionHeaderNames . SCHEME . text ( ) , HTTP_SCHEME ) ; // A push promise is a server initiated request, hence it should contain request headers Http2Headers http2Headers = HttpConversionUtil . toHttp2Headers ( httpRequest , true ) ; // Write the push promise to the wire ChannelFuture channelFuture = encoder . writePushPromise ( ctx , originalStreamId , promisedStreamId , http2Headers , 0 , ctx . newPromise ( ) ) ; encoder . flowController ( ) . writePendingBytes ( ) ; ctx . flush ( ) ; Util . checkForResponseWriteStatus ( inboundRequestMsg , outboundRespStatusFuture , channelFuture ) ; }
Writes an HTTP2 promise .