Top Description Inners Fields Constructors Methods
io.netty5.handler.codec.http2

public Class Http2ConnectionHandler

extends ByteToMessageDecoder
implements Http2LifecycleManager
Class Inheritance
All Implemented Interfaces
io.netty5.handler.codec.http2.Http2LifecycleManager
Known Direct Subclasses
io.netty5.handler.codec.http2.HttpToHttp2ConnectionHandler, io.netty5.handler.codec.http2.Http2FrameCodec
Annotations
@UnstableApi
Imports
io.netty5.buffer.BufferUtil, .Buffer, .BufferAllocator, io.netty5.channel.ChannelHandlerContext, .ChannelOption, io.netty5.handler.codec.ByteToMessageDecoder, io.netty5.handler.codec.http.HttpResponseStatus, io.netty5.handler.codec.http2.Http2Exception.CompositeStreamException, .Http2Exception.StreamException, io.netty5.handler.codec.http2.headers.Http2Headers, io.netty5.util.concurrent.Future, .FutureListener, .Promise, io.netty5.util.internal.UnstableApi, io.netty5.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.nio.charset.StandardCharsets, java.util.concurrent.TimeUnit

Provides the default implementation for processing inbound frame events and delegates to a Http2FrameListener

This class will read HTTP/2 frames and delegate the events to a Http2FrameListener

This interface enforces inbound flow control functionality through Http2LocalFlowController

Nested and Inner Type Summary

Modifier and TypeClass and Description
private abstract class
private static class
Http2ConnectionHandler.ClosingChannelFutureListener

Closes the channel when the future completes.

private class
private class

Field Summary

Modifier and TypeField and Description
private Http2ConnectionHandler.BaseDecoder
private FutureListener<Object>
private final Http2ConnectionDecoder
private final boolean
private final Http2ConnectionEncoder
private final boolean
private long
private static final Http2Headers
private static final Buffer
private final Http2Settings
private static final InternalLogger
Inherited from io.netty5.handler.codec.ByteToMessageDecoder:
COMPOSITE_CUMULATORMERGE_CUMULATOR

Constructor Summary

AccessConstructor and Description
protected
protected
Http2ConnectionHandler(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings, boolean decoupleCloseAndGoAway)

protected
Http2ConnectionHandler(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings, boolean decoupleCloseAndGoAway, boolean flushPreface)

Method Summary

Modifier and TypeMethod and Description
public void
public void
channelExceptionCaught(ChannelHandlerContext ctx, Throwable cause)

Overrides default io.netty5.channel.ChannelHandler.channelExceptionCaught.

Handles Http2Exception objects that were thrown from other handlers.
public void
channelInactive(ChannelHandlerContext ctx)

Overrides io.netty5.handler.codec.ByteToMessageDecoder.channelInactive.

Overrides default io.netty5.channel.ChannelHandler.channelInactive.

The Channel of the ChannelHandlerContext was registered is now inactive and reached its end of lifetime.
public void
pack-priv final void
public void
channelWritabilityChanged(ChannelHandlerContext ctx)

Overrides default io.netty5.channel.ChannelHandler.channelWritabilityChanged.

Gets called once the writable state of a Channel changed.
private void
checkCloseConnection(Future<?>
Represents the status that will be passed to the closeListener.
future
)

Closes the connection if the graceful shutdown process has completed.

private static Buffer
clientPrefaceString(Http2Connection connection)

Returns the client preface string if this is a client connection, otherwise returns null.

public Future<Void>
close(ChannelHandlerContext
the ChannelHandlerContext for which the close operation is made
ctx
)

Overrides default io.netty5.channel.ChannelHandler.close.

Called once a close operation is made.
private void
public void
closeStream(final Http2Stream
the stream to be closed and deactivated.
stream
,
Future<Void>
when completed if Http2Connection#numActiveStreams() is 0 then the underlying channel will be closed.
future
)

Implements io.netty5.handler.codec.http2.Http2LifecycleManager.closeStream.

Closes and deactivates the given stream.
public void
closeStreamLocal(Http2Stream
the stream to be half closed.
stream
,
Future<Void>
If closing, the future after which to close the channel.
future
)

Implements io.netty5.handler.codec.http2.Http2LifecycleManager.closeStreamLocal.

Closes the local side of the given stream.
public void
closeStreamRemote(Http2Stream
the stream to be half closed.
stream
,
Future<Void>
If closing, the future after which to close the channel.
future
)

Implements io.netty5.handler.codec.http2.Http2LifecycleManager.closeStreamRemote.

Closes the remote side of the given stream.
public Http2Connection
protected void
decode(ChannelHandlerContext ctx, Buffer
the Buffer from which to read data
in
)

Implements abstract io.netty5.handler.codec.ByteToMessageDecoder.decode.

Decode the from one Buffer to another.
public Http2ConnectionDecoder
private void
public Http2ConnectionEncoder
public void
flush(ChannelHandlerContext
the ChannelHandlerContext for which the flush operation is made
ctx
)

Overrides default io.netty5.channel.ChannelHandler.flush.

Called once a flush operation is made.
protected Http2FrameWriter
public Future<Void>
goAway(final ChannelHandlerContext
The context used for communication and buffer allocation if necessary.
ctx
,
final int
The last stream that the local endpoint is claiming it will accept.
lastStreamId
,
final long
The rational as to why the connection is being closed. See Http2Error.
errorCode
,
final Buffer
For diagnostic purposes (carries no semantic value).
debugData
)

Implements io.netty5.handler.codec.http2.Http2LifecycleManager.goAway.

Prevents the peer from creating streams and close the connection if errorCode is not Http2Error#NO_ERROR.
private Future<Void>
goAway(ChannelHandlerContext ctx, Http2Exception cause)

Close the remote endpoint with a GO_AWAY frame.

public long
gracefulShutdownTimeoutMillis()

Get the amount of time (in milliseconds) this endpoint will wait for all streams to be closed before closing the connection during the graceful shutdown process.

public void
gracefulShutdownTimeoutMillis(long
the amount of time (in milliseconds) this endpoint will wait for all streams to be closed before closing the connection during the graceful shutdown process.
gracefulShutdownTimeoutMillis
)

Set the amount of time (in milliseconds) this endpoint will wait for all streams to be closed before closing the connection during the graceful shutdown process.

public void
protected void
handlerRemoved0(ChannelHandlerContext ctx)

Overrides io.netty5.handler.codec.ByteToMessageDecoder.handlerRemoved0.

Gets called after the ByteToMessageDecoder was removed from the actual context and it doesn't handle events anymore.
protected void
handleServerHeaderDecodeSizeError(ChannelHandlerContext
the channel context
ctx
,
Http2Stream
the Http2Stream on which the header was received
stream
)

Notifies client that this server has received headers that are larger than what it is willing to accept.

protected boolean
isGracefulShutdownComplete()

Called by the graceful shutdown logic to determine when it is safe to close the connection.

private FutureListener<Object>
protected void
onConnectionError(ChannelHandlerContext
the channel context
ctx
,
boolean
true if the error was caused by an outbound operation.
outbound
,
Throwable
the exception that was caught
cause
,
Http2Exception
the Http2Exception that is embedded in the causality chain. This may be null if it's an unknown exception.
http2Ex
)

Handler for a connection error.

public void
onError(ChannelHandlerContext
The context used for communication and buffer allocation if necessary.
ctx
,
boolean
true if the error was caused by an outbound operation and so the corresponding Promise was failed as well.
outbound
,
Throwable
the error.
cause
)

Implements io.netty5.handler.codec.http2.Http2LifecycleManager.onError.

Central handler for all exceptions caught during HTTP/2 processing.
public void
onHttpClientUpgrade()

Handles the client-side (cleartext) upgrade from HTTP to HTTP/2.

public void
onHttpServerUpgrade(Http2Settings
the settings for the remote endpoint.
settings
)

Handles the server-side (cleartext) upgrade from HTTP to HTTP/2.

protected void
onStreamError(ChannelHandlerContext
the channel context
ctx
,
boolean
true if the error was caused by an outbound operation.
outbound
,
Throwable
the exception that was caught
cause
,
Http2Exception.StreamException
the StreamException that is embedded in the causality chain.
http2Ex
)

Handler for a stream error.

private boolean
private static void
processGoAwayWriteResult(final ChannelHandlerContext ctx, final int lastStreamId, final long errorCode, final Buffer debugData, Future<?> future)

private void
public Future<Void>
resetStream(final ChannelHandlerContext
The context used for communication and buffer allocation if necessary.
ctx
,
int
The identifier of the stream to reset.
streamId
,
long
Justification as to why this stream is being reset. See Http2Error.
errorCode
)

Implements io.netty5.handler.codec.http2.Http2LifecycleManager.resetStream.

Ensure the stream identified by streamId is reset.
private Future<Void>
resetStream(final ChannelHandlerContext ctx, final Http2Stream stream, long errorCode)

private Future<Void>
resetUnknownStream(final ChannelHandlerContext ctx, int streamId, long errorCode)

Sends a RST_STREAM frame even if we don't know about the stream.

Inherited from io.netty5.handler.codec.ByteToMessageDecoder:
actualReadableByteschannelReadchannelShutdowndecodeLastdiscardSomeReadByteshandlerAddedhandlerRemovedinternalBufferisSharableisSingleDecodesetSingleDecode