Package io.netty.handler.codec.http2
Class DefaultHttp2ConnectionDecoder
- java.lang.Object
-
- io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder
-
- All Implemented Interfaces:
Http2ConnectionDecoder,java.io.Closeable,java.lang.AutoCloseable
public class DefaultHttp2ConnectionDecoder extends java.lang.Object implements Http2ConnectionDecoder
Provides the default implementation for processing inbound frame events and delegates to aHttp2FrameListenerThis class will read HTTP/2 frames and delegate the events to a
Http2FrameListenerThis interface enforces inbound flow control functionality through
Http2LocalFlowController
-
-
Constructor Summary
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected longcalculateMaxHeaderListSizeGoAway(long maxHeaderListSize)Calculate the threshold in bytes which should trigger aGO_AWAYif a set of headers exceeds this amount.voidclose()Http2Connectionconnection()Provides direct access to the underlying connection.voiddecodeFrame(ChannelHandlerContext ctx, ByteBuf in, java.util.List<java.lang.Object> out)Called by theHttp2ConnectionHandlerto decode the next frame from the input buffer.Http2LocalFlowControllerflowController()Provides the local flow controller for managing inbound traffic.Http2FrameListenerframeListener()Get theHttp2FrameListenerwhich will be notified when frames are decoded.voidframeListener(Http2FrameListener listener)Set theHttp2FrameListenerwhich will be notified when frames are decoded.voidlifecycleManager(Http2LifecycleManager lifecycleManager)Sets the lifecycle manager.Http2SettingslocalSettings()Gets the local settings for this endpoint of the HTTP/2 connection.booleanprefaceReceived()Indicates whether or not the first initialSETTINGSframe 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- TheHttp2Connectionassociated with this decoder.encoder- TheHttp2ConnectionEncoderassociated 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-falseto disable automatically applying and sending settings acknowledge frame. TheHttp2ConnectionEncoderis expected to be an instance ofHttp2SettingsReceivedConsumerand will apply the earliest received but not yet ACKed SETTINGS when writing the SETTINGS ACKs.trueto enable automatically applying and sending settings acknowledge frame.
-
DefaultHttp2ConnectionDecoder
@Deprecated public DefaultHttp2ConnectionDecoder(Http2Connection connection, Http2ConnectionEncoder encoder, Http2FrameReader frameReader, Http2PromisedRequestVerifier requestVerifier, boolean autoAckSettings, boolean autoAckPing)
Deprecated.
-
DefaultHttp2ConnectionDecoder
public DefaultHttp2ConnectionDecoder(Http2Connection connection, Http2ConnectionEncoder encoder, Http2FrameReader frameReader, Http2PromisedRequestVerifier requestVerifier, boolean autoAckSettings, boolean autoAckPing, boolean validateHeaders)
Create a new instance.- Parameters:
connection- TheHttp2Connectionassociated with this decoder.encoder- TheHttp2ConnectionEncoderassociated 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-falseto disable automatically applying and sending settings acknowledge frame. TheHttp2ConnectionEncoderis expected to be an instance ofHttp2SettingsReceivedConsumerand will apply the earliest received but not yet ACKed SETTINGS when writing the SETTINGS ACKs.trueto enable automatically applying and sending settings acknowledge frame.autoAckPing-falseto disable automatically sending ping acknowledge frame.trueto enable automatically sending ping ack frame.
-
-
Method Detail
-
lifecycleManager
public void lifecycleManager(Http2LifecycleManager lifecycleManager)
Description copied from interface:Http2ConnectionDecoderSets the lifecycle manager. Must be called as part of initialization before the decoder is used.- Specified by:
lifecycleManagerin interfaceHttp2ConnectionDecoder
-
connection
public Http2Connection connection()
Description copied from interface:Http2ConnectionDecoderProvides direct access to the underlying connection.- Specified by:
connectionin interfaceHttp2ConnectionDecoder
-
flowController
public final Http2LocalFlowController flowController()
Description copied from interface:Http2ConnectionDecoderProvides the local flow controller for managing inbound traffic.- Specified by:
flowControllerin interfaceHttp2ConnectionDecoder
-
frameListener
public void frameListener(Http2FrameListener listener)
Description copied from interface:Http2ConnectionDecoderSet theHttp2FrameListenerwhich will be notified when frames are decoded.This must be set before frames are decoded.
- Specified by:
frameListenerin interfaceHttp2ConnectionDecoder
-
frameListener
public Http2FrameListener frameListener()
Description copied from interface:Http2ConnectionDecoderGet theHttp2FrameListenerwhich will be notified when frames are decoded.- Specified by:
frameListenerin interfaceHttp2ConnectionDecoder
-
prefaceReceived
public boolean prefaceReceived()
Description copied from interface:Http2ConnectionDecoderIndicates whether or not the first initialSETTINGSframe was received from the remote endpoint.- Specified by:
prefaceReceivedin interfaceHttp2ConnectionDecoder
-
decodeFrame
public void decodeFrame(ChannelHandlerContext ctx, ByteBuf in, java.util.List<java.lang.Object> out) throws Http2Exception
Description copied from interface:Http2ConnectionDecoderCalled by theHttp2ConnectionHandlerto decode the next frame from the input buffer.- Specified by:
decodeFramein interfaceHttp2ConnectionDecoder- Throws:
Http2Exception
-
localSettings
public Http2Settings localSettings()
Description copied from interface:Http2ConnectionDecoderGets the local settings for this endpoint of the HTTP/2 connection.- Specified by:
localSettingsin interfaceHttp2ConnectionDecoder
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceHttp2ConnectionDecoder
-
calculateMaxHeaderListSizeGoAway
protected long calculateMaxHeaderListSizeGoAway(long maxHeaderListSize)
Calculate the threshold in bytes which should trigger aGO_AWAYif 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_AWAYif a set of headers exceeds this amount.
-
-