@UnstableApi
public class Http2FrameCodec
extends io.netty.channel.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.
Constructor and Description |
---|
Http2FrameCodec(boolean server)
Construct a new handler.
|
Modifier and Type | Method and Description |
---|---|
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause) |
void |
handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
Load any dependencies.
|
void |
handlerRemoved(io.netty.channel.ChannelHandlerContext ctx)
Clean up any dependencies.
|
void |
userEventTriggered(io.netty.channel.ChannelHandlerContext ctx,
Object evt)
Handles the cleartext HTTP upgrade event.
|
void |
write(io.netty.channel.ChannelHandlerContext ctx,
Object msg,
io.netty.channel.ChannelPromise promise)
Processes all
Http2Frame s. |
bind, close, connect, deregister, disconnect, flush, read
public Http2FrameCodec(boolean server)
server
- true
this is a serverpublic void handlerAdded(io.netty.channel.ChannelHandlerContext ctx) throws Exception
handlerAdded
in interface io.netty.channel.ChannelHandler
handlerAdded
in class io.netty.channel.ChannelHandlerAdapter
Exception
public void handlerRemoved(io.netty.channel.ChannelHandlerContext ctx) throws Exception
handlerRemoved
in interface io.netty.channel.ChannelHandler
handlerRemoved
in class io.netty.channel.ChannelHandlerAdapter
Exception
public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception
userEventTriggered
in interface io.netty.channel.ChannelInboundHandler
userEventTriggered
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
exceptionCaught
in interface io.netty.channel.ChannelHandler
exceptionCaught
in interface io.netty.channel.ChannelInboundHandler
exceptionCaught
in class io.netty.channel.ChannelInboundHandlerAdapter
public void write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise)
Http2Frame
s. Http2StreamFrame
s may only originate in child
streams.write
in interface io.netty.channel.ChannelOutboundHandler
write
in class io.netty.channel.ChannelDuplexHandler
Copyright © 2008–2016 The Netty Project. All rights reserved.