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

public Class Http2EventAdapter

extends Object
implements Listener, Http2FrameListener
Class Inheritance
All Implemented Interfaces
io.netty5.handler.codec.http2.Http2FrameListener, io.netty5.handler.codec.http2.Http2Connection.Listener
Known Direct Subclasses
io.netty5.handler.codec.http2.InboundHttp2ToHttpAdapter
Annotations
@UnstableApi
Imports
io.netty5.buffer.Buffer, io.netty5.channel.ChannelHandlerContext, io.netty5.handler.codec.http2.headers.Http2Headers, io.netty5.util.internal.UnstableApi

This class brings Http2Connection.Listener and Http2FrameListener together to provide NOOP implementation so inheriting classes can selectively choose which methods to override.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
onDataRead(ChannelHandlerContext
the context from the handler where the frame was read.
ctx
,
int
the subject stream for the frame.
streamId
,
Buffer
payload buffer for the frame. This buffer will be closed by the codec when the method returns (the buffer will be inaccessible after the method call).
data
,
int
additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).
padding
,
boolean
Indicates whether this is the last frame to be sent from the remote endpoint for this stream.
endOfStream
)

Implements io.netty5.handler.codec.http2.Http2FrameListener.onDataRead.

Handles an inbound DATA frame.
public void
onGoAwayRead(ChannelHandlerContext
the context from the handler where the frame was read.
ctx
,
int
the last known stream of the remote endpoint.
lastStreamId
,
long
the error code, if abnormal closure.
errorCode
,
Buffer
application-defined debug data. This buffer will be closed by the codec when the method returns (the buffer will be inaccessible after the method call).
debugData
)

Implements io.netty5.handler.codec.http2.Http2FrameListener.onGoAwayRead.

Handles an inbound GO_AWAY frame.
public void
onGoAwayReceived(int
the last known stream of the remote endpoint.
lastStreamId
,
long
the error code, if abnormal closure.
errorCode
,
Buffer
application-defined debug data.
debugData
)

Implements io.netty5.handler.codec.http2.Http2Connection.Listener.onGoAwayReceived.

Called when a GOAWAY was received from the remote endpoint.
public void
onGoAwaySent(int
the last known stream of the remote endpoint.
lastStreamId
,
long
the error code, if abnormal closure.
errorCode
,
Buffer
application-defined debug data.
debugData
)

Implements io.netty5.handler.codec.http2.Http2Connection.Listener.onGoAwaySent.

Called when a GOAWAY frame was sent for the connection.
public void
onHeadersRead(ChannelHandlerContext
the context from the handler where the frame was read.
ctx
,
int
the subject stream for the frame.
streamId
,
Http2Headers
the received headers.
headers
,
int
additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).
padding
,
boolean
Indicates whether this is the last frame to be sent from the remote endpoint for this stream.
endStream
)

Implements io.netty5.handler.codec.http2.Http2FrameListener.onHeadersRead.

Handles an inbound HEADERS frame.
public void
onHeadersRead(ChannelHandlerContext
the context from the handler where the frame was read.
ctx
,
int
the subject stream for the frame.
streamId
,
Http2Headers
the received headers.
headers
,
int
the stream on which this stream depends, or 0 if dependent on the connection.
streamDependency
,
short
the new weight for the stream.
weight
,
boolean
whether or not the stream should be the exclusive dependent of its parent.
exclusive
,
int
additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).
padding
,
boolean
Indicates whether this is the last frame to be sent from the remote endpoint for this stream.
endStream
)

Implements io.netty5.handler.codec.http2.Http2FrameListener.onHeadersRead.

Handles an inbound HEADERS frame with priority information specified.
public void
onPingAckRead(ChannelHandlerContext
the context from the handler where the frame was read.
ctx
,
long
the payload of the frame.
data
)

Implements io.netty5.handler.codec.http2.Http2FrameListener.onPingAckRead.

Handles an inbound PING acknowledgment.
public void
onPingRead(ChannelHandlerContext
the context from the handler where the frame was read.
ctx
,
long
the payload of the frame.
data
)

Implements io.netty5.handler.codec.http2.Http2FrameListener.onPingRead.

Handles an inbound PING frame.
public void
onPriorityRead(ChannelHandlerContext
the context from the handler where the frame was read.
ctx
,
int
the subject stream for the frame.
streamId
,
int
the stream on which this stream depends, or 0 if dependent on the connection.
streamDependency
,
short
the new weight for the stream.
weight
,
boolean
whether or not the stream should be the exclusive dependent of its parent.
exclusive
)

Implements io.netty5.handler.codec.http2.Http2FrameListener.onPriorityRead.

Handles an inbound PRIORITY frame.
public void
onPushPromiseRead(ChannelHandlerContext
the context from the handler where the frame was read.
ctx
,
int
the stream the frame was sent on.
streamId
,
int
the ID of the promised stream.
promisedStreamId
,
Http2Headers
the received headers.
headers
,
int
additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).
padding
)

Implements io.netty5.handler.codec.http2.Http2FrameListener.onPushPromiseRead.

Handles an inbound PUSH_PROMISE frame.
public void
onRstStreamRead(ChannelHandlerContext
the context from the handler where the frame was read.
ctx
,
int
the stream that is terminating.
streamId
,
long
the error code identifying the type of failure.
errorCode
)

Implements io.netty5.handler.codec.http2.Http2FrameListener.onRstStreamRead.

Handles an inbound RST_STREAM frame.
public void
onSettingsAckRead(ChannelHandlerContext
the context from the handler where the frame was read.
ctx
)

Implements io.netty5.handler.codec.http2.Http2FrameListener.onSettingsAckRead.

Handles an inbound SETTINGS acknowledgment frame.
public void
onSettingsRead(ChannelHandlerContext
the context from the handler where the frame was read.
ctx
,
Http2Settings
the settings received from the remote endpoint.
settings
)

Implements io.netty5.handler.codec.http2.Http2FrameListener.onSettingsRead.

Handles an inbound SETTINGS frame.
public void
onStreamActive(Http2Stream stream)

Implements io.netty5.handler.codec.http2.Http2Connection.Listener.onStreamActive.

Notifies the listener that the given stream was made active (i.e. OPEN or HALF CLOSED).
public void
onStreamAdded(Http2Stream stream)

Implements io.netty5.handler.codec.http2.Http2Connection.Listener.onStreamAdded.

Notifies the listener that the given stream was added to the connection.
public void
onStreamClosed(Http2Stream stream)

Implements io.netty5.handler.codec.http2.Http2Connection.Listener.onStreamClosed.

Notifies the listener that the given stream is now CLOSED in both directions and will no longer be accessible via forEachActiveStream(Http2StreamVisitor).
public void
onStreamHalfClosed(Http2Stream stream)

Implements io.netty5.handler.codec.http2.Http2Connection.Listener.onStreamHalfClosed.

Notifies the listener that the given stream has transitioned from OPEN to HALF CLOSED.
public void
onStreamRemoved(Http2Stream stream)

Implements io.netty5.handler.codec.http2.Http2Connection.Listener.onStreamRemoved.

Notifies the listener that the given stream has now been removed from the connection and will no longer be returned via Http2Connection#stream(int).
public void
onUnknownFrame(ChannelHandlerContext
the context from the handler where the frame was read.
ctx
,
byte
the frame type from the HTTP/2 header.
frameType
,
int
the stream the frame was sent on.
streamId
,
Http2Flags
the flags in the frame header.
flags
,
Buffer
the payload of the frame. This buffer will be closed by the codec when the method returns (the buffer will be inaccessible after the method call).
payload
)

Implements io.netty5.handler.codec.http2.Http2FrameListener.onUnknownFrame.

Handler for a frame not defined by the HTTP/2 spec.
public void
onWindowUpdateRead(ChannelHandlerContext
the context from the handler where the frame was read.
ctx
,
int
the stream the frame was sent on.
streamId
,
int
the increased number of bytes of the remote endpoint's flow control window.
windowSizeIncrement
)

Implements io.netty5.handler.codec.http2.Http2FrameListener.onWindowUpdateRead.

Handles an inbound WINDOW_UPDATE frame.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Http2EventAdapterback to summary
public Http2EventAdapter()

Method Detail

onDataReadback to summary
public int onDataRead(ChannelHandlerContext ctx, int streamId, Buffer data, int padding, boolean endOfStream) throws Http2Exception

Implements io.netty5.handler.codec.http2.Http2FrameListener.onDataRead.

Doc from io.netty5.handler.codec.http2.Http2FrameListener.onDataRead.

Handles an inbound DATA frame.

Parameters
ctx:ChannelHandlerContext

the context from the handler where the frame was read.

streamId:int

the subject stream for the frame.

data:Buffer

payload buffer for the frame. This buffer will be closed by the codec when the method returns (the buffer will be inaccessible after the method call).

padding:int

additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).

endOfStream:boolean

Indicates whether this is the last frame to be sent from the remote endpoint for this stream.

Returns:int

the number of bytes that have been processed by the application. The returned bytes are used by the inbound flow controller to determine the appropriate time to expand the inbound flow control window (i.e. send WINDOW_UPDATE). Returning a value equal to the length of data + padding will effectively opt-out of application-level flow control for this frame. Returning a value less than the length of data + padding will defer the returning of the processed bytes, which the application must later return via Http2LocalFlowController#consumeBytes(Http2Stream, int). The returned value must be >= 0 and <= data.readableBytes() + padding.

Annotations
@Override
onGoAwayReadback to summary
public void onGoAwayRead(ChannelHandlerContext ctx, int lastStreamId, long errorCode, Buffer debugData) throws Http2Exception

Implements io.netty5.handler.codec.http2.Http2FrameListener.onGoAwayRead.

Doc from io.netty5.handler.codec.http2.Http2FrameListener.onGoAwayRead.

Handles an inbound GO_AWAY frame.

Parameters
ctx:ChannelHandlerContext

the context from the handler where the frame was read.

lastStreamId:int

the last known stream of the remote endpoint.

errorCode:long

the error code, if abnormal closure.

debugData:Buffer

application-defined debug data. This buffer will be closed by the codec when the method returns (the buffer will be inaccessible after the method call).

Annotations
@Override
onGoAwayReceivedback to summary
public void onGoAwayReceived(int lastStreamId, long errorCode, Buffer debugData)

Implements io.netty5.handler.codec.http2.Http2Connection.Listener.onGoAwayReceived.

Doc from io.netty5.handler.codec.http2.Http2Connection.Listener.onGoAwayReceived.

Called when a GOAWAY was received from the remote endpoint. This event handler duplicates Http2FrameListener#onGoAwayRead(io.netty5.channel.ChannelHandlerContext, int, long, Buffer) but is added here in order to simplify application logic for handling GOAWAY in a uniform way. An application should generally not handle both events, but if it does this method is called second, after notifying the Http2FrameListener.

If a RuntimeException is thrown it will be logged and not propagated. Throwing from this method is not supported and is considered a programming error.

Parameters
lastStreamId:int

the last known stream of the remote endpoint.

errorCode:long

the error code, if abnormal closure.

debugData:Buffer

application-defined debug data.

Annotations
@Override
onGoAwaySentback to summary
public void onGoAwaySent(int lastStreamId, long errorCode, Buffer debugData)

Implements io.netty5.handler.codec.http2.Http2Connection.Listener.onGoAwaySent.

Doc from io.netty5.handler.codec.http2.Http2Connection.Listener.onGoAwaySent.

Called when a GOAWAY frame was sent for the connection.

If a RuntimeException is thrown it will be logged and not propagated. Throwing from this method is not supported and is considered a programming error.

Parameters
lastStreamId:int

the last known stream of the remote endpoint.

errorCode:long

the error code, if abnormal closure.

debugData:Buffer

application-defined debug data.

Annotations
@Override
onHeadersReadback to summary
public void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int padding, boolean endStream) throws Http2Exception

Implements io.netty5.handler.codec.http2.Http2FrameListener.onHeadersRead.

Doc from io.netty5.handler.codec.http2.Http2FrameListener.onHeadersRead.

Handles an inbound HEADERS frame.

Only one of the following methods will be called for each HEADERS frame sequence. One will be called when the END_HEADERS flag has been received.

To say it another way; the Http2Headers will contain all of the headers for the current message exchange step (additional queuing is not necessary).

Parameters
ctx:ChannelHandlerContext

the context from the handler where the frame was read.

streamId:int

the subject stream for the frame.

headers:Http2Headers

the received headers.

padding:int

additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).

endStream:boolean

Indicates whether this is the last frame to be sent from the remote endpoint for this stream.

Annotations
@Override
onHeadersReadback to summary
public void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int streamDependency, short weight, boolean exclusive, int padding, boolean endStream) throws Http2Exception

Implements io.netty5.handler.codec.http2.Http2FrameListener.onHeadersRead.

Doc from io.netty5.handler.codec.http2.Http2FrameListener.onHeadersRead.

Handles an inbound HEADERS frame with priority information specified. Only called if END_HEADERS encountered.

Only one of the following methods will be called for each HEADERS frame sequence. One will be called when the END_HEADERS flag has been received.

To say it another way; the Http2Headers will contain all of the headers for the current message exchange step (additional queuing is not necessary).

Parameters
ctx:ChannelHandlerContext

the context from the handler where the frame was read.

streamId:int

the subject stream for the frame.

headers:Http2Headers

the received headers.

streamDependency:int

the stream on which this stream depends, or 0 if dependent on the connection.

weight:short

the new weight for the stream.

exclusive:boolean

whether or not the stream should be the exclusive dependent of its parent.

padding:int

additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).

endStream:boolean

Indicates whether this is the last frame to be sent from the remote endpoint for this stream.

Annotations
@Override
onPingAckReadback to summary
public void onPingAckRead(ChannelHandlerContext ctx, long data) throws Http2Exception

Implements io.netty5.handler.codec.http2.Http2FrameListener.onPingAckRead.

Doc from io.netty5.handler.codec.http2.Http2FrameListener.onPingAckRead.

Handles an inbound PING acknowledgment.

Parameters
ctx:ChannelHandlerContext

the context from the handler where the frame was read.

data:long

the payload of the frame.

Annotations
@Override
onPingReadback to summary
public void onPingRead(ChannelHandlerContext ctx, long data) throws Http2Exception

Implements io.netty5.handler.codec.http2.Http2FrameListener.onPingRead.

Doc from io.netty5.handler.codec.http2.Http2FrameListener.onPingRead.

Handles an inbound PING frame.

Parameters
ctx:ChannelHandlerContext

the context from the handler where the frame was read.

data:long

the payload of the frame.

Annotations
@Override
onPriorityReadback to summary
public void onPriorityRead(ChannelHandlerContext ctx, int streamId, int streamDependency, short weight, boolean exclusive) throws Http2Exception

Implements io.netty5.handler.codec.http2.Http2FrameListener.onPriorityRead.

Doc from io.netty5.handler.codec.http2.Http2FrameListener.onPriorityRead.

Handles an inbound PRIORITY frame.

Note that is it possible to have this method called and no stream object exist for either streamId, streamDependency, or both. This is because the PRIORITY frame can be sent/received when streams are in the CLOSED state.

Parameters
ctx:ChannelHandlerContext

the context from the handler where the frame was read.

streamId:int

the subject stream for the frame.

streamDependency:int

the stream on which this stream depends, or 0 if dependent on the connection.

weight:short

the new weight for the stream.

exclusive:boolean

whether or not the stream should be the exclusive dependent of its parent.

Annotations
@Override
onPushPromiseReadback to summary
public void onPushPromiseRead(ChannelHandlerContext ctx, int streamId, int promisedStreamId, Http2Headers headers, int padding) throws Http2Exception

Implements io.netty5.handler.codec.http2.Http2FrameListener.onPushPromiseRead.

Doc from io.netty5.handler.codec.http2.Http2FrameListener.onPushPromiseRead.

Handles an inbound PUSH_PROMISE frame. Only called if END_HEADERS encountered.

Promised requests MUST be authoritative, cacheable, and safe. See [RFC 7540], Section 8.2.

Only one of the following methods will be called for each HEADERS frame sequence. One will be called when the END_HEADERS flag has been received.

To say it another way; the Http2Headers will contain all of the headers for the current message exchange step (additional queuing is not necessary).

Parameters
ctx:ChannelHandlerContext

the context from the handler where the frame was read.

streamId:int

the stream the frame was sent on.

promisedStreamId:int

the ID of the promised stream.

headers:Http2Headers

the received headers.

padding:int

additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).

Annotations
@Override
onRstStreamReadback to summary
public void onRstStreamRead(ChannelHandlerContext ctx, int streamId, long errorCode) throws Http2Exception

Implements io.netty5.handler.codec.http2.Http2FrameListener.onRstStreamRead.

Doc from io.netty5.handler.codec.http2.Http2FrameListener.onRstStreamRead.

Handles an inbound RST_STREAM frame.

Parameters
ctx:ChannelHandlerContext

the context from the handler where the frame was read.

streamId:int

the stream that is terminating.

errorCode:long

the error code identifying the type of failure.

Annotations
@Override
onSettingsAckReadback to summary
public void onSettingsAckRead(ChannelHandlerContext ctx) throws Http2Exception

Implements io.netty5.handler.codec.http2.Http2FrameListener.onSettingsAckRead.

Doc from io.netty5.handler.codec.http2.Http2FrameListener.onSettingsAckRead.

Handles an inbound SETTINGS acknowledgment frame.

Parameters
ctx:ChannelHandlerContext

the context from the handler where the frame was read.

Annotations
@Override
onSettingsReadback to summary
public void onSettingsRead(ChannelHandlerContext ctx, Http2Settings settings) throws Http2Exception

Implements io.netty5.handler.codec.http2.Http2FrameListener.onSettingsRead.

Doc from io.netty5.handler.codec.http2.Http2FrameListener.onSettingsRead.

Handles an inbound SETTINGS frame.

Parameters
ctx:ChannelHandlerContext

the context from the handler where the frame was read.

settings:Http2Settings

the settings received from the remote endpoint.

Annotations
@Override
onStreamActiveback to summary
public void onStreamActive(Http2Stream stream)

Implements io.netty5.handler.codec.http2.Http2Connection.Listener.onStreamActive.

Doc from io.netty5.handler.codec.http2.Http2Connection.Listener.onStreamActive.

Notifies the listener that the given stream was made active (i.e. OPEN or HALF CLOSED).

If a RuntimeException is thrown it will be logged and not propagated. Throwing from this method is not supported and is considered a programming error.

Annotations
@Override
onStreamAddedback to summary
public void onStreamAdded(Http2Stream stream)

Implements io.netty5.handler.codec.http2.Http2Connection.Listener.onStreamAdded.

Doc from io.netty5.handler.codec.http2.Http2Connection.Listener.onStreamAdded.

Notifies the listener that the given stream was added to the connection. This stream may not yet be active (i.e. OPEN or HALF CLOSED).

If a RuntimeException is thrown it will be logged and not propagated. Throwing from this method is not supported and is considered a programming error.

Annotations
@Override
onStreamClosedback to summary
public void onStreamClosed(Http2Stream stream)

Implements io.netty5.handler.codec.http2.Http2Connection.Listener.onStreamClosed.

Doc from io.netty5.handler.codec.http2.Http2Connection.Listener.onStreamClosed.

Notifies the listener that the given stream is now CLOSED in both directions and will no longer be accessible via forEachActiveStream(Http2StreamVisitor).

If a RuntimeException is thrown it will be logged and not propagated. Throwing from this method is not supported and is considered a programming error.

Annotations
@Override
onStreamHalfClosedback to summary
public void onStreamHalfClosed(Http2Stream stream)

Implements io.netty5.handler.codec.http2.Http2Connection.Listener.onStreamHalfClosed.

Doc from io.netty5.handler.codec.http2.Http2Connection.Listener.onStreamHalfClosed.

Notifies the listener that the given stream has transitioned from OPEN to HALF CLOSED. This method will not be called until a state transition occurs from when onStreamActive(Http2Stream) was called. The stream can be inspected to determine which side is HALF CLOSED.

If a RuntimeException is thrown it will be logged and not propagated. Throwing from this method is not supported and is considered a programming error.

Annotations
@Override
onStreamRemovedback to summary
public void onStreamRemoved(Http2Stream stream)

Implements io.netty5.handler.codec.http2.Http2Connection.Listener.onStreamRemoved.

Doc from io.netty5.handler.codec.http2.Http2Connection.Listener.onStreamRemoved.

Notifies the listener that the given stream has now been removed from the connection and will no longer be returned via Http2Connection#stream(int). The connection may maintain inactive streams for some time before removing them.

If a RuntimeException is thrown it will be logged and not propagated. Throwing from this method is not supported and is considered a programming error.

Annotations
@Override
onUnknownFrameback to summary
public void onUnknownFrame(ChannelHandlerContext ctx, byte frameType, int streamId, Http2Flags flags, Buffer payload) throws Http2Exception

Implements io.netty5.handler.codec.http2.Http2FrameListener.onUnknownFrame.

Doc from io.netty5.handler.codec.http2.Http2FrameListener.onUnknownFrame.

Handler for a frame not defined by the HTTP/2 spec.

Parameters
ctx:ChannelHandlerContext

the context from the handler where the frame was read.

frameType:byte

the frame type from the HTTP/2 header.

streamId:int

the stream the frame was sent on.

flags:Http2Flags

the flags in the frame header.

payload:Buffer

the payload of the frame. This buffer will be closed by the codec when the method returns (the buffer will be inaccessible after the method call).

Annotations
@Override
onWindowUpdateReadback to summary
public void onWindowUpdateRead(ChannelHandlerContext ctx, int streamId, int windowSizeIncrement) throws Http2Exception

Implements io.netty5.handler.codec.http2.Http2FrameListener.onWindowUpdateRead.

Doc from io.netty5.handler.codec.http2.Http2FrameListener.onWindowUpdateRead.

Handles an inbound WINDOW_UPDATE frame.

Parameters
ctx:ChannelHandlerContext

the context from the handler where the frame was read.

streamId:int

the stream the frame was sent on.

windowSizeIncrement:int

the increased number of bytes of the remote endpoint's flow control window.

Annotations
@Override