Class Http2ForwardStreamChildInitializer

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelInitializer<io.netty.handler.codec.http2.Http2StreamChannel>
org.mockserver.httpclient.Http2ForwardStreamChildInitializer
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

public class Http2ForwardStreamChildInitializer extends io.netty.channel.ChannelInitializer<io.netty.handler.codec.http2.Http2StreamChannel>
Per-stream child initializer used with Http2MultiplexHandler on the NettyHttpClient forward path. It mirrors the HTTP/1.1 forward pipeline built by HttpClientInitializer.configureHttp1Pipeline(io.netty.channel.ChannelPipeline) but on an HTTP/2 stream channel, so a streamed upstream response (Server-Sent Events) is relayed incrementally instead of being aggregated to completion before its head reaches the proxy client.

An HTTP/2 stream channel is decoded into the same unaggregated HttpObjects that the HTTP/1.1 path produces (Http2StreamFrameToHttpObjectCodec in CLIENT, non-aggregating mode), then the identical shared streaming machinery is reused: HttpContentDecompressor, TimeToFirstByteHandler, StreamingAwareHttpObjectAggregator (which relays text/event-stream / client-requested streams via StreamingResponseRelayHandler and aggregates everything else to a FullHttpResponse), MockServerHttpClientCodec, and the shared HttpClientHandler.

HTTP/2 child channels do NOT inherit parent-channel attributes, so the per-request attributes the forward machinery reads off the channel are copied from the parent to the child in initChannel(io.netty.handler.codec.http2.Http2StreamChannel). A close listener closes the parent connection when the single stream ends, preserving the non-pooled "close after one response" behaviour of HTTP/2 forwards.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    initChannel(io.netty.handler.codec.http2.Http2StreamChannel ch)
     

    Methods inherited from class io.netty.channel.ChannelInitializer

    channelRegistered, exceptionCaught, handlerAdded, handlerRemoved

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelActive, channelInactive, channelRead, channelReadComplete, channelUnregistered, channelWritabilityChanged, userEventTriggered

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, isSharable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • initChannel

      protected void initChannel(io.netty.handler.codec.http2.Http2StreamChannel ch)
      Specified by:
      initChannel in class io.netty.channel.ChannelInitializer<io.netty.handler.codec.http2.Http2StreamChannel>