public class DelegatingDecompressorFrameListener extends Http2FrameListenerDecorator
content-encoding header for each
stream. The decompression provided by this class will be applied to the data for the entire stream.listener| Constructor and Description |
|---|
DelegatingDecompressorFrameListener(Http2Connection connection,
Http2FrameListener listener)
|
DelegatingDecompressorFrameListener(Http2Connection connection,
Http2FrameListener listener,
boolean strict)
|
DelegatingDecompressorFrameListener(Http2Connection connection,
Http2FrameListener listener,
boolean strict,
int maxAllocation)
Create a new instance.
|
DelegatingDecompressorFrameListener(Http2Connection connection,
Http2FrameListener listener,
int maxAllocation)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected CharSequence |
getTargetContentEncoding(CharSequence contentEncoding)
Returns the expected content encoding of the decoded content.
|
protected io.netty.channel.embedded.EmbeddedChannel |
newContentDecompressor(io.netty.channel.ChannelHandlerContext ctx,
CharSequence contentEncoding)
Returns a new
EmbeddedChannel that decodes the HTTP2 message content encoded in the specified
contentEncoding. |
int |
onDataRead(io.netty.channel.ChannelHandlerContext ctx,
int streamId,
io.netty.buffer.ByteBuf data,
int padding,
boolean endOfStream)
Handles an inbound
DATA frame. |
void |
onHeadersRead(io.netty.channel.ChannelHandlerContext ctx,
int streamId,
Http2Headers headers,
int padding,
boolean endStream)
Handles an inbound
HEADERS frame. |
void |
onHeadersRead(io.netty.channel.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. |
onGoAwayRead, onPingAckRead, onPingRead, onPriorityRead, onPushPromiseRead, onRstStreamRead, onSettingsAckRead, onSettingsRead, onUnknownFrame, onWindowUpdateRead@Deprecated public DelegatingDecompressorFrameListener(Http2Connection connection, Http2FrameListener listener)
connection - the connection to read data which should be decompressedlistener - the delegate listener used by Http2FrameListenerDecoratorpublic DelegatingDecompressorFrameListener(Http2Connection connection, Http2FrameListener listener, int maxAllocation)
connection - the connection to read data which should be decompressedlistener - the delegate listener used by Http2FrameListenerDecoratormaxAllocation - maximum size of the decompression buffer. Must be >= 0.
If zero, maximum size is not limited by decoder.@Deprecated public DelegatingDecompressorFrameListener(Http2Connection connection, Http2FrameListener listener, boolean strict)
DelegatingDecompressorFrameListener(Http2Connection,
Http2FrameListener, boolean, int)connection - the connection to read data which should be decompressedlistener - the delegate listener used by Http2FrameListenerDecoratorstrict - if `true`, ZlibWrapper.ZLIB will be used for the decoder,
otherwise the decoder can fallback to ZlibWrapper.NONEpublic DelegatingDecompressorFrameListener(Http2Connection connection, Http2FrameListener listener, boolean strict, int maxAllocation)
connection - the connection to read data which should be decompressedlistener - the delegate listener used by Http2FrameListenerDecoratorstrict - if `true`, ZlibWrapper.ZLIB will be used for the decoder,
otherwise the decoder can fallback to ZlibWrapper.NONEmaxAllocation - maximum size of the decompression buffer. Must be >= 0.
If zero, maximum size is not limited by decoder.public int onDataRead(io.netty.channel.ChannelHandlerContext ctx,
int streamId,
io.netty.buffer.ByteBuf data,
int padding,
boolean endOfStream)
throws Http2Exception
Http2FrameListenerDATA frame.onDataRead in interface Http2FrameListeneronDataRead in class Http2FrameListenerDecoratorctx - 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 - additional bytes that should be added to obscure the true content size. Must be between 0 and
256 (inclusive).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
Http2LocalFlowController.consumeBytes(Http2Stream, int). The returned value must
be >= 0 and <= data.readableBytes() + padding.Http2Exceptionpublic void onHeadersRead(io.netty.channel.ChannelHandlerContext ctx,
int streamId,
Http2Headers headers,
int padding,
boolean endStream)
throws Http2Exception
Http2FrameListenerHEADERS 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.
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 Http2FrameListeneronHeadersRead in class Http2FrameListenerDecoratorctx - the context from the handler where the frame was read.streamId - the subject stream for the frame.headers - the received headers.padding - additional bytes that should be added to obscure the true content size. Must be between 0 and
256 (inclusive).endStream - Indicates whether this is the last frame to be sent from the remote endpoint
for this stream.Http2Exceptionpublic void onHeadersRead(io.netty.channel.ChannelHandlerContext ctx,
int streamId,
Http2Headers headers,
int streamDependency,
short weight,
boolean exclusive,
int padding,
boolean endStream)
throws Http2Exception
Http2FrameListenerHEADERS 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.
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 Http2FrameListeneronHeadersRead in class Http2FrameListenerDecoratorctx - 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 - additional bytes that should be added to obscure the true content size. Must be between 0 and
256 (inclusive).endStream - Indicates whether this is the last frame to be sent from the remote endpoint
for this stream.Http2Exceptionprotected io.netty.channel.embedded.EmbeddedChannel newContentDecompressor(io.netty.channel.ChannelHandlerContext ctx,
CharSequence contentEncoding)
throws Http2Exception
EmbeddedChannel that decodes the HTTP2 message content encoded in the specified
contentEncoding.contentEncoding - the value of the content-encoding headerByteToMessageDecoder if the specified encoding is supported. null otherwise
(alternatively, you can throw a Http2Exception to block unknown encoding).Http2Exception - If the specified encoding is not supported and warrants an exceptionprotected CharSequence getTargetContentEncoding(CharSequence contentEncoding) throws Http2Exception
"identity" by
default, which is the case for most decompressors.contentEncoding - the value of the content-encoding headerHttp2Exception - if the contentEncoding is not supported and warrants an exceptionCopyright © 2008–2025 The Netty Project. All rights reserved.