Module io.netty.codec.http2
Package io.netty5.handler.codec.http2
Class DefaultHttp2ConnectionDecoder
- java.lang.Object
-
- io.netty5.handler.codec.http2.DefaultHttp2ConnectionDecoder
-
- All Implemented Interfaces:
Http2ConnectionDecoder
,Closeable
,AutoCloseable
@UnstableApi public class DefaultHttp2ConnectionDecoder extends Object implements Http2ConnectionDecoder
Provides the default implementation for processing inbound frame events and delegates to aHttp2FrameListener
This class will read HTTP/2 frames and delegate the events to a
Http2FrameListener
This interface enforces inbound flow control functionality through
Http2LocalFlowController
-
-
Constructor Summary
Constructors Constructor Description DefaultHttp2ConnectionDecoder(Http2Connection connection, Http2ConnectionEncoder encoder, Http2FrameReader frameReader)
DefaultHttp2ConnectionDecoder(Http2Connection connection, Http2ConnectionEncoder encoder, Http2FrameReader frameReader, Http2PromisedRequestVerifier requestVerifier)
DefaultHttp2ConnectionDecoder(Http2Connection connection, Http2ConnectionEncoder encoder, Http2FrameReader frameReader, Http2PromisedRequestVerifier requestVerifier, boolean autoAckSettings)
Create a new instance.DefaultHttp2ConnectionDecoder(Http2Connection connection, Http2ConnectionEncoder encoder, Http2FrameReader frameReader, Http2PromisedRequestVerifier requestVerifier, boolean autoAckSettings, boolean autoAckPing)
Create a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected long
calculateMaxHeaderListSizeGoAway(long maxHeaderListSize)
Calculate the threshold in bytes which should trigger aGO_AWAY
if a set of headers exceeds this amount.void
close()
Http2Connection
connection()
Provides direct access to the underlying connection.void
decodeFrame(ChannelHandlerContext ctx, Buffer in)
Called by theHttp2ConnectionHandler
to decode the next frame from the input buffer.Http2LocalFlowController
flowController()
Provides the local flow controller for managing inbound traffic.Http2FrameListener
frameListener()
Get theHttp2FrameListener
which will be notified when frames are decoded.void
frameListener(Http2FrameListener listener)
Set theHttp2FrameListener
which will be notified when frames are decoded.void
lifecycleManager(Http2LifecycleManager lifecycleManager)
Sets the lifecycle manager.Http2Settings
localSettings()
Gets the local settings for this endpoint of the HTTP/2 connection.boolean
prefaceReceived()
Indicates whether or not the first initialSETTINGS
frame was received from the remote endpoint.
-
-
-
Constructor Detail
-
DefaultHttp2ConnectionDecoder
public DefaultHttp2ConnectionDecoder(Http2Connection connection, Http2ConnectionEncoder encoder, Http2FrameReader frameReader)
-
DefaultHttp2ConnectionDecoder
public DefaultHttp2ConnectionDecoder(Http2Connection connection, Http2ConnectionEncoder encoder, Http2FrameReader frameReader, Http2PromisedRequestVerifier requestVerifier)
-
DefaultHttp2ConnectionDecoder
public DefaultHttp2ConnectionDecoder(Http2Connection connection, Http2ConnectionEncoder encoder, Http2FrameReader frameReader, Http2PromisedRequestVerifier requestVerifier, boolean autoAckSettings)
Create a new instance.- Parameters:
connection
- TheHttp2Connection
associated with this decoder.encoder
- TheHttp2ConnectionEncoder
associated with this decoder.frameReader
- Responsible for reading/parsing the raw frames. As opposed to this object which applies h2 semantics on top of the frames.requestVerifier
- Determines if push promised streams are valid.autoAckSettings
-false
to disable automatically applying and sending settings acknowledge frame. TheHttp2ConnectionEncoder
is expected to be an instance ofHttp2SettingsReceivedConsumer
and will apply the earliest received but not yet ACKed SETTINGS when writing the SETTINGS ACKs.true
to enable automatically applying and sending settings acknowledge frame.
-
DefaultHttp2ConnectionDecoder
public DefaultHttp2ConnectionDecoder(Http2Connection connection, Http2ConnectionEncoder encoder, Http2FrameReader frameReader, Http2PromisedRequestVerifier requestVerifier, boolean autoAckSettings, boolean autoAckPing)
Create a new instance.- Parameters:
connection
- TheHttp2Connection
associated with this decoder.encoder
- TheHttp2ConnectionEncoder
associated with this decoder.frameReader
- Responsible for reading/parsing the raw frames. As opposed to this object which applies h2 semantics on top of the frames.requestVerifier
- Determines if push promised streams are valid.autoAckSettings
-false
to disable automatically applying and sending settings acknowledge frame. TheHttp2ConnectionEncoder
is expected to be an instance ofHttp2SettingsReceivedConsumer
and will apply the earliest received but not yet ACKed SETTINGS when writing the SETTINGS ACKs.true
to enable automatically applying and sending settings acknowledge frame.autoAckPing
-false
to disable automatically sending ping acknowledge frame.true
to enable automatically sending ping ack frame.
-
-
Method Detail
-
lifecycleManager
public void lifecycleManager(Http2LifecycleManager lifecycleManager)
Description copied from interface:Http2ConnectionDecoder
Sets the lifecycle manager. Must be called as part of initialization before the decoder is used.- Specified by:
lifecycleManager
in interfaceHttp2ConnectionDecoder
-
connection
public Http2Connection connection()
Description copied from interface:Http2ConnectionDecoder
Provides direct access to the underlying connection.- Specified by:
connection
in interfaceHttp2ConnectionDecoder
-
flowController
public final Http2LocalFlowController flowController()
Description copied from interface:Http2ConnectionDecoder
Provides the local flow controller for managing inbound traffic.- Specified by:
flowController
in interfaceHttp2ConnectionDecoder
-
frameListener
public void frameListener(Http2FrameListener listener)
Description copied from interface:Http2ConnectionDecoder
Set theHttp2FrameListener
which will be notified when frames are decoded.This must be set before frames are decoded.
- Specified by:
frameListener
in interfaceHttp2ConnectionDecoder
-
frameListener
public Http2FrameListener frameListener()
Description copied from interface:Http2ConnectionDecoder
Get theHttp2FrameListener
which will be notified when frames are decoded.- Specified by:
frameListener
in interfaceHttp2ConnectionDecoder
-
prefaceReceived
public boolean prefaceReceived()
Description copied from interface:Http2ConnectionDecoder
Indicates whether or not the first initialSETTINGS
frame was received from the remote endpoint.- Specified by:
prefaceReceived
in interfaceHttp2ConnectionDecoder
-
decodeFrame
public void decodeFrame(ChannelHandlerContext ctx, Buffer in) throws Http2Exception
Description copied from interface:Http2ConnectionDecoder
Called by theHttp2ConnectionHandler
to decode the next frame from the input buffer.- Specified by:
decodeFrame
in interfaceHttp2ConnectionDecoder
- Throws:
Http2Exception
-
localSettings
public Http2Settings localSettings()
Description copied from interface:Http2ConnectionDecoder
Gets the local settings for this endpoint of the HTTP/2 connection.- Specified by:
localSettings
in interfaceHttp2ConnectionDecoder
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceHttp2ConnectionDecoder
-
calculateMaxHeaderListSizeGoAway
protected long calculateMaxHeaderListSizeGoAway(long maxHeaderListSize)
Calculate the threshold in bytes which should trigger aGO_AWAY
if a set of headers exceeds this amount.- Parameters:
maxHeaderListSize
- SETTINGS_MAX_HEADER_LIST_SIZE for the local endpoint.- Returns:
- the threshold in bytes which should trigger a
GO_AWAY
if a set of headers exceeds this amount.
-
-