@UnstableApi public class Http2FrameCodec extends ChannelDuplexHandler
Http2Frame objects and vice versa. For every incoming HTTP/2
frame a Http2Frame object is created and propagated via ChannelInboundHandlerAdapter.channelRead(io.netty.channel.ChannelHandlerContext, java.lang.Object). Outgoing Http2Frame
objects received via write(io.netty.channel.ChannelHandlerContext, java.lang.Object, io.netty.channel.ChannelPromise) are converted to the HTTP/2 wire format.
A change in stream state is propagated through the channel pipeline as a user event via
Http2StreamStateEvent objects. When a HTTP/2 stream first becomes active a Http2StreamActiveEvent
and when it gets closed a Http2StreamClosedEvent is emitted.
Server-side HTTP to HTTP/2 upgrade is supported in conjunction with Http2ServerUpgradeCodec; the necessary
HTTP-to-HTTP/2 conversion is performed automatically.
This API is very immature. The Http2Connection-based API is currently preferred over this API. This API is targeted to eventually replace or reduce the need for the Http2Connection-based API.
ChannelHandler.Sharable| Constructor and Description |
|---|
Http2FrameCodec(boolean server)
Construct a new handler.
|
| Modifier and Type | Method and Description |
|---|---|
void |
exceptionCaught(ChannelHandlerContext ctx,
Throwable cause)
Calls
ChannelHandlerContext.fireExceptionCaught(Throwable) to forward
to the next ChannelHandler in the ChannelPipeline. |
void |
handlerAdded(ChannelHandlerContext ctx)
Load any dependencies.
|
void |
handlerRemoved(ChannelHandlerContext ctx)
Clean up any dependencies.
|
void |
userEventTriggered(ChannelHandlerContext ctx,
Object evt)
Handles the cleartext HTTP upgrade event.
|
void |
write(ChannelHandlerContext ctx,
Object msg,
ChannelPromise promise)
Processes all
Http2Frames. |
bind, close, connect, deregister, disconnect, flush, readchannelActive, channelInactive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChangedisSharablepublic Http2FrameCodec(boolean server)
server - true this is a serverpublic void handlerAdded(ChannelHandlerContext ctx) throws Exception
handlerAdded in interface ChannelHandlerhandlerAdded in class ChannelHandlerAdapterExceptionpublic void handlerRemoved(ChannelHandlerContext ctx) throws Exception
handlerRemoved in interface ChannelHandlerhandlerRemoved in class ChannelHandlerAdapterExceptionpublic void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception
userEventTriggered in interface ChannelInboundHandleruserEventTriggered in class ChannelInboundHandlerAdapterExceptionpublic void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
ChannelInboundHandlerAdapterChannelHandlerContext.fireExceptionCaught(Throwable) to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.exceptionCaught in interface ChannelHandlerexceptionCaught in interface ChannelInboundHandlerexceptionCaught in class ChannelInboundHandlerAdapterpublic void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
Http2Frames. Http2StreamFrames may only originate in child
streams.write in interface ChannelOutboundHandlerwrite in class ChannelDuplexHandlerctx - the ChannelHandlerContext for which the write operation is mademsg - the message to writepromise - the ChannelPromise to notify once the operation completesCopyright © 2008–2016 The Netty Project. All rights reserved.