Class DefaultHttp2ConnectionDecoder
java.lang.Object
io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder
- All Implemented Interfaces:
Http2ConnectionDecoder, Closeable, AutoCloseable
Provides the default implementation for processing inbound frame events and delegates to a
Http2FrameListener
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
ConstructorsConstructorDescriptionDefaultHttp2ConnectionDecoder(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) Deprecated.DefaultHttp2ConnectionDecoder(Http2Connection connection, Http2ConnectionEncoder encoder, Http2FrameReader frameReader, Http2PromisedRequestVerifier requestVerifier, boolean autoAckSettings, boolean autoAckPing, boolean validateHeaders) Create a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected longcalculateMaxHeaderListSizeGoAway(long maxHeaderListSize) Calculate the threshold in bytes which should trigger aGO_AWAYif a set of headers exceeds this amount.voidclose()Provides direct access to the underlying connection.voiddecodeFrame(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) Called by theHttp2ConnectionHandlerto decode the next frame from the input buffer.final Http2LocalFlowControllerProvides the local flow controller for managing inbound traffic.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.Gets the local settings for this endpoint of the HTTP/2 connection.booleanIndicates whether or not the first initialSETTINGSframe was received from the remote endpoint.
-
Constructor Details
-
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 Details
-
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
Description copied from interface:Http2ConnectionDecoderProvides direct access to the underlying connection.- Specified by:
connectionin interfaceHttp2ConnectionDecoder
-
flowController
Description copied from interface:Http2ConnectionDecoderProvides the local flow controller for managing inbound traffic.- Specified by:
flowControllerin interfaceHttp2ConnectionDecoder
-
frameListener
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
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, List<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
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 interfaceAutoCloseable- Specified by:
closein interfaceCloseable- 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.
-