public class Http2ConnectionHandler extends io.netty.handler.codec.ByteToMessageDecoder implements Http2LifecycleManager
Http2FrameListener
This class will read HTTP/2 frames and delegate the events to a Http2FrameListener
This interface enforces inbound flow control functionality through
Http2LocalFlowController
| Constructor and Description |
|---|
Http2ConnectionHandler(boolean server,
Http2FrameListener listener) |
Http2ConnectionHandler(Http2ConnectionDecoder.Builder decoderBuilder,
Http2ConnectionEncoder.Builder encoderBuilder)
Constructor for pre-configured encoder and decoder builders.
|
Http2ConnectionHandler(Http2Connection connection,
Http2FrameListener listener) |
Http2ConnectionHandler(Http2Connection connection,
Http2FrameReader frameReader,
Http2FrameWriter frameWriter,
Http2FrameListener listener) |
| Modifier and Type | Method and Description |
|---|---|
void |
channelActive(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelInactive(io.netty.channel.ChannelHandlerContext ctx) |
void |
close(io.netty.channel.ChannelHandlerContext ctx,
io.netty.channel.ChannelPromise promise) |
void |
closeLocalSide(Http2Stream stream,
io.netty.channel.ChannelFuture future)
Closes the local side of the given stream.
|
void |
closeRemoteSide(Http2Stream stream,
io.netty.channel.ChannelFuture future)
Closes the remote side of the given stream.
|
void |
closeStream(Http2Stream stream,
io.netty.channel.ChannelFuture future)
Closes the given stream and adds a hook to close the channel after the given future
completes.
|
Http2Connection |
connection() |
protected void |
decode(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf in,
List<Object> out) |
Http2ConnectionDecoder |
decoder() |
Http2ConnectionEncoder |
encoder() |
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause)
Handles
Http2Exception objects that were thrown from other handlers. |
protected Http2FrameWriter |
frameWriter() |
void |
handlerAdded(io.netty.channel.ChannelHandlerContext ctx) |
protected void |
handlerRemoved0(io.netty.channel.ChannelHandlerContext ctx) |
protected void |
onConnectionError(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause,
Http2Exception http2Ex)
Handler for a connection error.
|
void |
onException(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause)
Central handler for all exceptions caught during HTTP/2 processing.
|
void |
onHttpClientUpgrade()
Handles the client-side (cleartext) upgrade from HTTP to HTTP/2.
|
void |
onHttpServerUpgrade(Http2Settings settings)
Handles the server-side (cleartext) upgrade from HTTP to HTTP/2.
|
protected void |
onStreamError(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause,
Http2Exception.StreamException http2Ex)
Handler for a stream error.
|
io.netty.channel.ChannelFuture |
writeGoAway(io.netty.channel.ChannelHandlerContext ctx,
int lastStreamId,
long errorCode,
io.netty.buffer.ByteBuf debugData,
io.netty.channel.ChannelPromise promise)
Sends a
GO_AWAY frame to the remote endpoint and updates the connection state appropriately. |
io.netty.channel.ChannelFuture |
writeRstStream(io.netty.channel.ChannelHandlerContext ctx,
int streamId,
long errorCode,
io.netty.channel.ChannelPromise promise)
Writes a
RST_STREAM frame to the remote endpoint and updates the connection state appropriately. |
actualReadableBytes, callDecode, channelRead, channelReadComplete, decodeLast, handlerRemoved, internalBuffer, isSingleDecode, setCumulator, setSingleDecodepublic Http2ConnectionHandler(boolean server,
Http2FrameListener listener)
public Http2ConnectionHandler(Http2Connection connection, Http2FrameListener listener)
public Http2ConnectionHandler(Http2Connection connection, Http2FrameReader frameReader, Http2FrameWriter frameWriter, Http2FrameListener listener)
public Http2ConnectionHandler(Http2ConnectionDecoder.Builder decoderBuilder, Http2ConnectionEncoder.Builder encoderBuilder)
this as the
Http2LifecycleManager and builds them.public Http2Connection connection()
public Http2ConnectionDecoder decoder()
public Http2ConnectionEncoder encoder()
public void onHttpClientUpgrade()
throws Http2Exception
Http2Exceptionpublic void onHttpServerUpgrade(Http2Settings settings) throws Http2Exception
settings - the settings for the remote endpoint.Http2Exceptionpublic void channelActive(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelActive in interface io.netty.channel.ChannelHandlerchannelActive in class io.netty.channel.ChannelHandlerAdapterExceptionpublic void handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
handlerAdded in interface io.netty.channel.ChannelHandlerhandlerAdded in class io.netty.channel.ChannelHandlerAdapterExceptionprotected void handlerRemoved0(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
handlerRemoved0 in class io.netty.handler.codec.ByteToMessageDecoderExceptionpublic void close(io.netty.channel.ChannelHandlerContext ctx,
io.netty.channel.ChannelPromise promise)
throws Exception
close in interface io.netty.channel.ChannelHandlerclose in class io.netty.channel.ChannelHandlerAdapterExceptionpublic void channelInactive(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelInactive in interface io.netty.channel.ChannelHandlerchannelInactive in class io.netty.handler.codec.ByteToMessageDecoderExceptionpublic void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause)
throws Exception
Http2Exception objects that were thrown from other handlers. Ignores all other exceptions.exceptionCaught in interface io.netty.channel.ChannelHandlerexceptionCaught in class io.netty.channel.ChannelHandlerAdapterExceptionpublic void closeLocalSide(Http2Stream stream, io.netty.channel.ChannelFuture future)
closeLocalSide in interface Http2LifecycleManagerstream - the stream to be half closed.future - If closing, the future after which to close the channel.public void closeRemoteSide(Http2Stream stream, io.netty.channel.ChannelFuture future)
closeRemoteSide in interface Http2LifecycleManagerstream - the stream to be half closed.future - If closing, the future after which to close the channel.public void closeStream(Http2Stream stream, io.netty.channel.ChannelFuture future)
closeStream in interface Http2LifecycleManagerstream - the stream to be closed.future - the future after which to close the channel.public void onException(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause)
onException in interface Http2LifecycleManagerprotected void onConnectionError(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause,
Http2Exception http2Ex)
ctx - the channel contextcause - the exception that was caughthttp2Ex - the Http2Exception that is embedded in the causality chain. This may
be null if it's an unknown exception.protected void onStreamError(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause,
Http2Exception.StreamException http2Ex)
RST_STREAM frame to the remote endpoint and closes the
stream.ctx - the channel contextcause - the exception that was caughthttp2Ex - the Http2Exception.StreamException that is embedded in the causality chain.protected Http2FrameWriter frameWriter()
public io.netty.channel.ChannelFuture writeRstStream(io.netty.channel.ChannelHandlerContext ctx,
int streamId,
long errorCode,
io.netty.channel.ChannelPromise promise)
RST_STREAM frame to the remote endpoint and updates the connection state appropriately.writeRstStream in interface Http2LifecycleManagerpublic io.netty.channel.ChannelFuture writeGoAway(io.netty.channel.ChannelHandlerContext ctx,
int lastStreamId,
long errorCode,
io.netty.buffer.ByteBuf debugData,
io.netty.channel.ChannelPromise promise)
GO_AWAY frame to the remote endpoint and updates the connection state appropriately.writeGoAway in interface Http2LifecycleManagerCopyright © 2008–2015 The Netty Project. All rights reserved.