public class Http2EventAdapter extends Object implements Http2Connection.Listener, Http2FrameListener
Http2Connection.Listener and Http2FrameListener together to provide
NOOP implementation so inheriting classes can selectively choose which methods to override.| Constructor and Description |
|---|
Http2EventAdapter() |
| Modifier and Type | Method and Description |
|---|---|
void |
goingAway()
Called when a GO_AWAY frame has either been sent or received for the connection.
|
int |
onDataRead(ChannelHandlerContext ctx,
int streamId,
ByteBuf data,
int padding,
boolean endOfStream)
Handles an inbound
DATA frame. |
void |
onGoAwayRead(ChannelHandlerContext ctx,
int lastStreamId,
long errorCode,
ByteBuf debugData)
Handles an inbound GO_AWAY frame.
|
void |
onHeadersRead(ChannelHandlerContext ctx,
int streamId,
Http2Headers headers,
int padding,
boolean endStream)
Handles an inbound HEADERS frame.
|
void |
onHeadersRead(ChannelHandlerContext ctx,
int streamId,
Http2Headers headers,
int streamDependency,
short weight,
boolean exclusive,
int padding,
boolean endStream)
Handles an inbound HEADERS frame with priority information specified.
|
void |
onPingAckRead(ChannelHandlerContext ctx,
ByteBuf data)
Handles an inbound PING acknowledgment.
|
void |
onPingRead(ChannelHandlerContext ctx,
ByteBuf data)
Handles an inbound PING frame.
|
void |
onPriorityRead(ChannelHandlerContext ctx,
int streamId,
int streamDependency,
short weight,
boolean exclusive)
Handles an inbound PRIORITY frame.
|
void |
onPushPromiseRead(ChannelHandlerContext ctx,
int streamId,
int promisedStreamId,
Http2Headers headers,
int padding)
Handles an inbound PUSH_PROMISE frame.
|
void |
onRstStreamRead(ChannelHandlerContext ctx,
int streamId,
long errorCode)
Handles an inbound RST_STREAM frame.
|
void |
onSettingsAckRead(ChannelHandlerContext ctx)
Handles an inbound SETTINGS acknowledgment frame.
|
void |
onSettingsRead(ChannelHandlerContext ctx,
Http2Settings settings)
Handles an inbound SETTINGS frame.
|
void |
onUnknownFrame(ChannelHandlerContext ctx,
byte frameType,
int streamId,
Http2Flags flags,
ByteBuf payload)
Handler for a frame not defined by the HTTP/2 spec.
|
void |
onWeightChanged(Http2Stream stream,
short oldWeight)
Notifies the listener that the weight has changed for
stream |
void |
onWindowUpdateRead(ChannelHandlerContext ctx,
int streamId,
int windowSizeIncrement)
Handles an inbound WINDOW_UPDATE frame.
|
void |
priorityTreeParentChanged(Http2Stream stream,
Http2Stream oldParent)
Notifies the listener that a priority tree parent change has occurred.
|
void |
priorityTreeParentChanging(Http2Stream stream,
Http2Stream newParent)
Notifies the listener that a parent dependency is about to change
This is called while the tree is being restructured and so the tree
structure is not necessarily steady state.
|
void |
streamActive(Http2Stream stream)
Notifies the listener that the given stream was made active (i.e. open in at least one
direction).
|
void |
streamAdded(Http2Stream stream)
Notifies the listener that the given stream was added to the connection.
|
void |
streamHalfClosed(Http2Stream stream)
Notifies the listener that the given stream is now half-closed.
|
void |
streamInactive(Http2Stream stream)
Notifies the listener that the given stream is now closed in both directions.
|
void |
streamRemoved(Http2Stream stream)
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 int onDataRead(ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding, boolean endOfStream) throws Http2Exception
Http2FrameListenerDATA frame.onDataRead in interface Http2FrameListenerctx - the context from the handler where the frame was read.streamId - the subject stream for the frame.data - payload buffer for the frame. This buffer will be released by the codec.padding - the number of padding bytes found at the end of the frame.endOfStream - Indicates whether this is the last frame to be sent from the remote
endpoint for this stream.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
Http2InboundFlowState#returnProcessedBytes(ChannelHandlerContext, int). The
returned value must be >= 0 and <= data.readableBytes() +
padding.Http2Exceptionpublic void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int padding, boolean endStream) throws Http2Exception
Http2FrameListenerOnly 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.
Http2FrameListener.onHeadersRead(ChannelHandlerContext, int, Http2Headers, int, boolean)Http2FrameListener.onHeadersRead(ChannelHandlerContext, int, Http2Headers, int, short, boolean, int, boolean)Http2FrameListener.onPushPromiseRead(ChannelHandlerContext, int, int, Http2Headers, int)
To say it another way; the Http2Headers will contain all of the headers
for the current message exchange step (additional queuing is not necessary).
onHeadersRead in interface Http2FrameListenerctx - the context from the handler where the frame was read.streamId - the subject stream for the frame.headers - the received headers.padding - the number of padding bytes found at the end of the frame.endStream - Indicates whether this is the last frame to be sent from the remote endpoint
for this stream.Http2Exceptionpublic void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int streamDependency, short weight, boolean exclusive, int padding, boolean endStream) throws Http2Exception
Http2FrameListenerOnly 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.
Http2FrameListener.onHeadersRead(ChannelHandlerContext, int, Http2Headers, int, boolean)Http2FrameListener.onHeadersRead(ChannelHandlerContext, int, Http2Headers, int, short, boolean, int, boolean)Http2FrameListener.onPushPromiseRead(ChannelHandlerContext, int, int, Http2Headers, int)
To say it another way; the Http2Headers will contain all of the headers
for the current message exchange step (additional queuing is not necessary).
onHeadersRead in interface Http2FrameListenerctx - the context from the handler where the frame was read.streamId - the subject stream for the frame.headers - the received headers.streamDependency - the stream on which this stream depends, or 0 if dependent on the
connection.weight - the new weight for the stream.exclusive - whether or not the stream should be the exclusive dependent of its parent.padding - the number of padding bytes found at the end of the frame.endStream - Indicates whether this is the last frame to be sent from the remote endpoint
for this stream.Http2Exceptionpublic void onPriorityRead(ChannelHandlerContext ctx, int streamId, int streamDependency, short weight, boolean exclusive) throws Http2Exception
Http2FrameListeneronPriorityRead in interface Http2FrameListenerctx - the context from the handler where the frame was read.streamId - the subject stream for the frame.streamDependency - the stream on which this stream depends, or 0 if dependent on the
connection.weight - the new weight for the stream.exclusive - whether or not the stream should be the exclusive dependent of its parent.Http2Exceptionpublic void onRstStreamRead(ChannelHandlerContext ctx, int streamId, long errorCode) throws Http2Exception
Http2FrameListeneronRstStreamRead in interface Http2FrameListenerctx - the context from the handler where the frame was read.streamId - the stream that is terminating.errorCode - the error code identifying the type of failure.Http2Exceptionpublic void onSettingsAckRead(ChannelHandlerContext ctx) throws Http2Exception
Http2FrameListeneronSettingsAckRead in interface Http2FrameListenerctx - the context from the handler where the frame was read.Http2Exceptionpublic void onSettingsRead(ChannelHandlerContext ctx, Http2Settings settings) throws Http2Exception
Http2FrameListeneronSettingsRead in interface Http2FrameListenerctx - the context from the handler where the frame was read.settings - the settings received from the remote endpoint.Http2Exceptionpublic void onPingRead(ChannelHandlerContext ctx, ByteBuf data) throws Http2Exception
Http2FrameListeneronPingRead in interface Http2FrameListenerctx - the context from the handler where the frame was read.data - the payload of the frame. If this buffer needs to be retained by the listener
they must make a copy.Http2Exceptionpublic void onPingAckRead(ChannelHandlerContext ctx, ByteBuf data) throws Http2Exception
Http2FrameListeneronPingAckRead in interface Http2FrameListenerctx - the context from the handler where the frame was read.data - the payload of the frame. If this buffer needs to be retained by the listener
they must make a copy.Http2Exceptionpublic void onPushPromiseRead(ChannelHandlerContext ctx, int streamId, int promisedStreamId, Http2Headers headers, int padding) throws Http2Exception
Http2FrameListener
Promised requests MUST be cacheable
(see [RFC7231], Section 4.2.3) and
MUST be safe (see [RFC7231], Section 4.2.1).
If these conditions do not hold the application MUST throw a Http2Exception.StreamException with
error type Http2Error.PROTOCOL_ERROR.
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.
Http2FrameListener.onHeadersRead(ChannelHandlerContext, int, Http2Headers, int, boolean)Http2FrameListener.onHeadersRead(ChannelHandlerContext, int, Http2Headers, int, short, boolean, int, boolean)Http2FrameListener.onPushPromiseRead(ChannelHandlerContext, int, int, Http2Headers, int)
To say it another way; the Http2Headers will contain all of the headers
for the current message exchange step (additional queuing is not necessary).
onPushPromiseRead in interface Http2FrameListenerctx - the context from the handler where the frame was read.streamId - the stream the frame was sent on.promisedStreamId - the ID of the promised stream.headers - the received headers.padding - the number of padding bytes found at the end of the frame.Http2Exceptionpublic void onGoAwayRead(ChannelHandlerContext ctx, int lastStreamId, long errorCode, ByteBuf debugData) throws Http2Exception
Http2FrameListeneronGoAwayRead in interface Http2FrameListenerctx - the context from the handler where the frame was read.lastStreamId - the last known stream of the remote endpoint.errorCode - the error code, if abnormal closure.debugData - application-defined debug data. If this buffer needs to be retained by the
listener they must make a copy.Http2Exceptionpublic void onWindowUpdateRead(ChannelHandlerContext ctx, int streamId, int windowSizeIncrement) throws Http2Exception
Http2FrameListeneronWindowUpdateRead in interface Http2FrameListenerctx - the context from the handler where the frame was read.streamId - the stream the frame was sent on.windowSizeIncrement - the increased number of bytes of the remote endpoint's flow
control window.Http2Exceptionpublic void onUnknownFrame(ChannelHandlerContext ctx, byte frameType, int streamId, Http2Flags flags, ByteBuf payload)
Http2FrameListeneronUnknownFrame in interface Http2FrameListenerctx - the context from the handler where the frame was read.frameType - the frame type from the HTTP/2 header.streamId - the stream the frame was sent on.flags - the flags in the frame header.payload - the payload of the frame.public void streamAdded(Http2Stream stream)
Http2Connection.ListenerstreamAdded in interface Http2Connection.Listenerpublic void streamActive(Http2Stream stream)
Http2Connection.ListenerstreamActive in interface Http2Connection.Listenerpublic void streamHalfClosed(Http2Stream stream)
Http2Connection.ListenerstreamHalfClosed in interface Http2Connection.Listenerpublic void streamInactive(Http2Stream stream)
Http2Connection.ListenerstreamInactive in interface Http2Connection.Listenerpublic void streamRemoved(Http2Stream stream)
Http2Connection.ListenerHttp2Connection.stream(int). The connection may
maintain inactive streams for some time before removing them.streamRemoved in interface Http2Connection.Listenerpublic void priorityTreeParentChanged(Http2Stream stream, Http2Stream oldParent)
Http2Connection.ListenerpriorityTreeParentChanged in interface Http2Connection.Listenerstream - The stream which had a parent change (new parent and children will be steady state)oldParent - The old parent which stream used to be a child of (may be null)public void priorityTreeParentChanging(Http2Stream stream, Http2Stream newParent)
Http2Connection.ListenerpriorityTreeParentChanging in interface Http2Connection.Listenerstream - The stream which the parent is about to change to newParentnewParent - The stream which will be the parent of streampublic void onWeightChanged(Http2Stream stream, short oldWeight)
Http2Connection.ListenerstreamonWeightChanged in interface Http2Connection.Listenerstream - The stream which the weight has changedoldWeight - The old weight for streampublic void goingAway()
Http2Connection.ListenergoingAway in interface Http2Connection.ListenerCopyright © 2008–2015 The Netty Project. All rights reserved.