Class Http2MultiplexCodec
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.handler.codec.ByteToMessageDecoder
-
- io.netty.handler.codec.http2.Http2ConnectionHandler
-
- io.netty.handler.codec.http2.Http2FrameCodec
-
- io.netty.handler.codec.http2.Http2MultiplexCodec
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler,io.netty.channel.ChannelOutboundHandler,Http2LifecycleManager
@Deprecated public class Http2MultiplexCodec extends Http2FrameCodec
Deprecated.useHttp2FrameCodecBuildertogether withHttp2MultiplexHandler.An HTTP/2 handler that creates child channels for each stream.When a new stream is created, a new
Channelis created for it. Applications send and receiveHttp2StreamFrames on the created channel.ByteBufs cannot be processed by the channel; all writes that reach the head of the pipeline must be an instance ofHttp2StreamFrame. Writes that reach the head of the pipeline are processed directly by this handler and cannot be intercepted.The child channel will be notified of user events that impact the stream, such as
Http2GoAwayFrameandHttp2ResetFrame, as soon as they occur. AlthoughHttp2GoAwayFrameandHttp2ResetFramesignify that the remote is ignoring further communication, closing of the channel is delayed until any inbound queue is drained withChannel.read(), which follows the default behavior of channels in Netty. Applications are free to close the channel in response to such events if they don't have use for any queued messages. Any connection level events likeHttp2SettingsFrameandHttp2GoAwayFramewill be processed internally and also propagated down the pipeline for other handlers to act on.Outbound streams are supported via the
Http2StreamChannelBootstrap.ChannelConfig.setMaxMessagesPerRead(int)andChannelConfig.setAutoRead(boolean)are supported.Reference Counting
SomeHttp2StreamFrames implement theReferenceCountedinterface, as they carry reference counted objects (e.g.ByteBufs). The multiplex codec will callReferenceCounted.retain()before propagating a reference counted object through the pipeline, and thus an application handler needs to release such an object after having consumed it. For more information on reference counting take a look at https://netty.io/wiki/reference-counted-objects.htmlChannel Events
A child channel becomes active as soon as it is registered to anEventLoop. Therefore, an active channel does not map to an active HTTP/2 stream immediately. Only once aHttp2HeadersFramehas been successfully sent or received, does the channel map to an active HTTP/2 stream. In case it is not possible to open a new HTTP/2 stream (i.e. due to the maximum number of active streams being exceeded), the child channel receives an exception indicating the cause and is closed immediately thereafter.Writability and Flow Control
A child channel observes outbound/remote flow control via the channel's writability. A channel only becomes writable when it maps to an active HTTP/2 stream and the stream's flow control window is greater than zero. A child channel does not know about the connection-level flow control window.ChannelHandlers are free to ignore the channel's writability, in which case the excessive writes will be buffered by the parent channel. It's important to note that onlyHttp2DataFrames are subject to HTTP/2 flow control.
-
-
Field Summary
-
Fields inherited from class io.netty.handler.codec.http2.Http2FrameCodec
streamKey
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidchannelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg)Deprecated.voidchannelReadComplete(io.netty.channel.ChannelHandlerContext ctx)Deprecated.Notifies any child streams of the read completion.voidchannelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx)Deprecated.voidhandlerAdded0(io.netty.channel.ChannelHandlerContext ctx)Deprecated.voidhandlerRemoved0(io.netty.channel.ChannelHandlerContext ctx)Deprecated.voidonHttpClientUpgrade()Deprecated.Handles the client-side (cleartext) upgrade from HTTP to HTTP/2.-
Methods inherited from class io.netty.handler.codec.http2.Http2FrameCodec
handlerAdded, isGracefulShutdownComplete, newHttp2UnknownFrame, onConnectionError, onStreamError, userEventTriggered, write
-
Methods inherited from class io.netty.handler.codec.http2.Http2ConnectionHandler
bind, channelActive, channelInactive, close, closeStream, closeStreamLocal, closeStreamRemote, connect, connection, decode, decoder, deregister, disconnect, encoder, exceptionCaught, flush, frameWriter, goAway, gracefulShutdownTimeoutMillis, gracefulShutdownTimeoutMillis, handleServerHeaderDecodeSizeError, onError, onHttpServerUpgrade, read, resetStream
-
Methods inherited from class io.netty.handler.codec.ByteToMessageDecoder
actualReadableBytes, callDecode, decodeLast, discardSomeReadBytes, handlerRemoved, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelRegistered, channelUnregistered
-
-
-
-
Method Detail
-
onHttpClientUpgrade
public void onHttpClientUpgrade() throws Http2ExceptionDeprecated.Description copied from class:Http2ConnectionHandlerHandles the client-side (cleartext) upgrade from HTTP to HTTP/2. Reserves local stream 1 for the HTTP/2 response.- Overrides:
onHttpClientUpgradein classHttp2ConnectionHandler- Throws:
Http2Exception
-
handlerAdded0
public final void handlerAdded0(io.netty.channel.ChannelHandlerContext ctx) throws ExceptionDeprecated.- Throws:
Exception
-
handlerRemoved0
public final void handlerRemoved0(io.netty.channel.ChannelHandlerContext ctx) throws ExceptionDeprecated.- Overrides:
handlerRemoved0in classHttp2ConnectionHandler- Throws:
Exception
-
channelReadComplete
public final void channelReadComplete(io.netty.channel.ChannelHandlerContext ctx) throws ExceptionDeprecated.Notifies any child streams of the read completion.- Specified by:
channelReadCompletein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadCompletein classHttp2ConnectionHandler- Throws:
Exception
-
channelRead
public final void channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) throws ExceptionDeprecated.- Specified by:
channelReadin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadin classio.netty.handler.codec.ByteToMessageDecoder- Throws:
Exception
-
channelWritabilityChanged
public final void channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) throws ExceptionDeprecated.- Specified by:
channelWritabilityChangedin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelWritabilityChangedin classHttp2ConnectionHandler- Throws:
Exception
-
-