Package io.netty.handler.codec.http2
Class Http2ConnectionHandlerBuilder
- java.lang.Object
-
- io.netty.handler.codec.http2.AbstractHttp2ConnectionHandlerBuilder<Http2ConnectionHandler,Http2ConnectionHandlerBuilder>
-
- io.netty.handler.codec.http2.Http2ConnectionHandlerBuilder
-
public final class Http2ConnectionHandlerBuilder extends AbstractHttp2ConnectionHandlerBuilder<Http2ConnectionHandler,Http2ConnectionHandlerBuilder>
Builder which buildsHttp2ConnectionHandlerobjects.
-
-
Constructor Summary
Constructors Constructor Description Http2ConnectionHandlerBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Http2ConnectionHandlerbuild()Create a newHttp2ConnectionHandler.protected Http2ConnectionHandlerbuild(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings)Implement this method to create a newHttp2ConnectionHandleror its subtype instance.Http2ConnectionHandlerBuildercodec(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder)Sets theHttp2ConnectionDecoderandHttp2ConnectionEncoderto use.Http2ConnectionHandlerBuilderconnection(Http2Connection connection)Sets theHttp2Connectionto use.intdecoderEnforceMaxConsecutiveEmptyDataFrames()Returns the maximum number of consecutive empty DATA frames (without end_of_stream flag) that are allowed before the connection is closed.Http2ConnectionHandlerBuilderdecoderEnforceMaxConsecutiveEmptyDataFrames(int maxConsecutiveEmptyFrames)Sets the maximum number of consecutive empty DATA frames (without end_of_stream flag) that are allowed before the connection is closed.Http2ConnectionHandlerBuilderdecoderEnforceMaxRstFramesPerWindow(int maxRstFramesPerWindow, int secondsPerWindow)Sets the maximum number RST frames that are allowed per window before the connection is closed.Http2ConnectionHandlerBuilderdecoupleCloseAndGoAway(boolean decoupleCloseAndGoAway)Determine if theChannel.close()should be coupled with goaway and graceful close.Http2ConnectionHandlerBuilderencoderEnforceMaxConcurrentStreams(boolean encoderEnforceMaxConcurrentStreams)Sets if the encoder should queue frames if the maximum number of concurrent streams would otherwise be exceeded.Http2ConnectionHandlerBuilderencoderEnforceMaxRstFramesPerWindow(int maxRstFramesPerWindow, int secondsPerWindow)Sets the maximum number RST frames that are allowed per window before the connection is closed.Http2ConnectionHandlerBuilderencoderIgnoreMaxHeaderListSize(boolean encoderIgnoreMaxHeaderListSize)Sets if the SETTINGS_MAX_HEADER_LIST_SIZE should be ignored when encoding headers.Http2ConnectionHandlerBuilderflushPreface(boolean flushPreface)Http2ConnectionHandlerBuilderframeListener(Http2FrameListener frameListener)Sets the listener of inbound frames.Http2ConnectionHandlerBuilderframeLogger(Http2FrameLogger frameLogger)Sets the logger that is used for the encoder and decoder.Http2ConnectionHandlerBuildergracefulShutdownTimeoutMillis(long gracefulShutdownTimeoutMillis)Sets the graceful shutdown timeout of theHttp2Connectionin milliseconds.Http2ConnectionHandlerBuilderheaderSensitivityDetector(Http2HeadersEncoder.SensitivityDetector headerSensitivityDetector)Sets theHttp2HeadersEncoder.SensitivityDetectorto use.Http2ConnectionHandlerBuilderinitialHuffmanDecodeCapacity(int initialHuffmanDecodeCapacity)Deprecated.Http2SettingsinitialSettings()Sets theHttp2Settingsto use for the initial connection settings exchange.Http2ConnectionHandlerBuilderinitialSettings(Http2Settings settings)Sets theHttp2Settingsto use for the initial connection settings exchange.Http2ConnectionHandlerBuildermaxReservedStreams(int maxReservedStreams)Set the maximum number of streams which can be in the reserved state at any given time.Http2ConnectionHandlerBuilderserver(boolean isServer)Sets ifAbstractHttp2ConnectionHandlerBuilder.build()will to create aHttp2Connectionin server mode (true) or client mode (false).Http2ConnectionHandlerBuildervalidateHeaders(boolean validateHeaders)Sets if HTTP headers should be validated according to RFC 7540, 8.1.2.6.-
Methods inherited from class io.netty.handler.codec.http2.AbstractHttp2ConnectionHandlerBuilder
autoAckPingFrame, autoAckSettingsFrame, connection, decoder, decoupleCloseAndGoAway, encoder, encoderEnforceMaxConcurrentStreams, encoderEnforceMaxQueuedControlFrames, encoderEnforceMaxQueuedControlFrames, flushPreface, frameListener, frameLogger, gracefulShutdownTimeoutMillis, headerSensitivityDetector, isAutoAckPingFrame, isAutoAckSettingsFrame, isServer, isValidateHeaders, maxReservedStreams, promisedRequestVerifier, promisedRequestVerifier, self
-
-
-
-
Method Detail
-
validateHeaders
public Http2ConnectionHandlerBuilder validateHeaders(boolean validateHeaders)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets if HTTP headers should be validated according to RFC 7540, 8.1.2.6.
-
initialSettings
public Http2ConnectionHandlerBuilder initialSettings(Http2Settings settings)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets theHttp2Settingsto use for the initial connection settings exchange.
-
initialSettings
public Http2Settings initialSettings()
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets theHttp2Settingsto use for the initial connection settings exchange.
-
frameListener
public Http2ConnectionHandlerBuilder frameListener(Http2FrameListener frameListener)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets the listener of inbound frames. This listener will only be set if the decoder's listener isnull.
-
gracefulShutdownTimeoutMillis
public Http2ConnectionHandlerBuilder gracefulShutdownTimeoutMillis(long gracefulShutdownTimeoutMillis)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets the graceful shutdown timeout of theHttp2Connectionin milliseconds.
-
server
public Http2ConnectionHandlerBuilder server(boolean isServer)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets ifAbstractHttp2ConnectionHandlerBuilder.build()will to create aHttp2Connectionin server mode (true) or client mode (false).- Overrides:
serverin classAbstractHttp2ConnectionHandlerBuilder<Http2ConnectionHandler,Http2ConnectionHandlerBuilder>
-
connection
public Http2ConnectionHandlerBuilder connection(Http2Connection connection)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets theHttp2Connectionto use.- Overrides:
connectionin classAbstractHttp2ConnectionHandlerBuilder<Http2ConnectionHandler,Http2ConnectionHandlerBuilder>
-
maxReservedStreams
public Http2ConnectionHandlerBuilder maxReservedStreams(int maxReservedStreams)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSet the maximum number of streams which can be in the reserved state at any given time.
-
codec
public Http2ConnectionHandlerBuilder codec(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets theHttp2ConnectionDecoderandHttp2ConnectionEncoderto use.- Overrides:
codecin classAbstractHttp2ConnectionHandlerBuilder<Http2ConnectionHandler,Http2ConnectionHandlerBuilder>
-
frameLogger
public Http2ConnectionHandlerBuilder frameLogger(Http2FrameLogger frameLogger)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets the logger that is used for the encoder and decoder.- Overrides:
frameLoggerin classAbstractHttp2ConnectionHandlerBuilder<Http2ConnectionHandler,Http2ConnectionHandlerBuilder>
-
encoderEnforceMaxConcurrentStreams
public Http2ConnectionHandlerBuilder encoderEnforceMaxConcurrentStreams(boolean encoderEnforceMaxConcurrentStreams)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets if the encoder should queue frames if the maximum number of concurrent streams would otherwise be exceeded.
-
encoderIgnoreMaxHeaderListSize
public Http2ConnectionHandlerBuilder encoderIgnoreMaxHeaderListSize(boolean encoderIgnoreMaxHeaderListSize)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets if the SETTINGS_MAX_HEADER_LIST_SIZE should be ignored when encoding headers.- Overrides:
encoderIgnoreMaxHeaderListSizein classAbstractHttp2ConnectionHandlerBuilder<Http2ConnectionHandler,Http2ConnectionHandlerBuilder>- Parameters:
encoderIgnoreMaxHeaderListSize-trueto ignore SETTINGS_MAX_HEADER_LIST_SIZE.- Returns:
- this.
-
headerSensitivityDetector
public Http2ConnectionHandlerBuilder headerSensitivityDetector(Http2HeadersEncoder.SensitivityDetector headerSensitivityDetector)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets theHttp2HeadersEncoder.SensitivityDetectorto use.
-
initialHuffmanDecodeCapacity
@Deprecated public Http2ConnectionHandlerBuilder initialHuffmanDecodeCapacity(int initialHuffmanDecodeCapacity)
Deprecated.Description copied from class:AbstractHttp2ConnectionHandlerBuilderDoes nothing, do not call.
-
decoupleCloseAndGoAway
public Http2ConnectionHandlerBuilder decoupleCloseAndGoAway(boolean decoupleCloseAndGoAway)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderDetermine if theChannel.close()should be coupled with goaway and graceful close.- Overrides:
decoupleCloseAndGoAwayin classAbstractHttp2ConnectionHandlerBuilder<Http2ConnectionHandler,Http2ConnectionHandlerBuilder>- Parameters:
decoupleCloseAndGoAway-trueto makeChannel.close()directly close the underlying transport, and not attempt graceful closure via GOAWAY.- Returns:
this.
-
flushPreface
public Http2ConnectionHandlerBuilder flushPreface(boolean flushPreface)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderDetermine if the Preface should be automatically flushed when theChannelbecomes active or not.Client may choose to opt-out from this automatic behavior and manage flush manually if it's ready to send request frames immediately after the preface. It may help to avoid unnecessary latency.
- Overrides:
flushPrefacein classAbstractHttp2ConnectionHandlerBuilder<Http2ConnectionHandler,Http2ConnectionHandlerBuilder>- Parameters:
flushPreface-trueto automatically flush,false otherwise.- Returns:
this.- See Also:
- HTTP/2 Connection Preface
-
decoderEnforceMaxConsecutiveEmptyDataFrames
public int decoderEnforceMaxConsecutiveEmptyDataFrames()
Description copied from class:AbstractHttp2ConnectionHandlerBuilderReturns the maximum number of consecutive empty DATA frames (without end_of_stream flag) that are allowed before the connection is closed. This allows to protect against the remote peer flooding us with such frames and so use up a lot of CPU. There is no valid use-case for empty DATA frames without end_of_stream flag.0means no protection is in place.
-
decoderEnforceMaxConsecutiveEmptyDataFrames
public Http2ConnectionHandlerBuilder decoderEnforceMaxConsecutiveEmptyDataFrames(int maxConsecutiveEmptyFrames)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets the maximum number of consecutive empty DATA frames (without end_of_stream flag) that are allowed before the connection is closed. This allows to protect against the remote peer flooding us with such frames and so use up a lot of CPU. There is no valid use-case for empty DATA frames without end_of_stream flag.0means no protection should be applied.
-
decoderEnforceMaxRstFramesPerWindow
public Http2ConnectionHandlerBuilder decoderEnforceMaxRstFramesPerWindow(int maxRstFramesPerWindow, int secondsPerWindow)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets the maximum number RST frames that are allowed per window before the connection is closed. This allows to protect against the remote peer flooding us with such frames and so use up a lot of CPU.0for any of the parameters means no protection should be applied.
-
encoderEnforceMaxRstFramesPerWindow
public Http2ConnectionHandlerBuilder encoderEnforceMaxRstFramesPerWindow(int maxRstFramesPerWindow, int secondsPerWindow)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets the maximum number RST frames that are allowed per window before the connection is closed. This allows to protect against the remote peer that will trigger us to generate a flood of RST frames and so use up a lot of CPU.0for any of the parameters means no protection should be applied.
-
build
public Http2ConnectionHandler build()
Description copied from class:AbstractHttp2ConnectionHandlerBuilderCreate a newHttp2ConnectionHandler.- Overrides:
buildin classAbstractHttp2ConnectionHandlerBuilder<Http2ConnectionHandler,Http2ConnectionHandlerBuilder>
-
build
protected Http2ConnectionHandler build(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderImplement this method to create a newHttp2ConnectionHandleror its subtype instance.The return of this method will be subject to the following:
AbstractHttp2ConnectionHandlerBuilder.frameListener(Http2FrameListener)will be set if not already set in the decoderAbstractHttp2ConnectionHandlerBuilder.gracefulShutdownTimeoutMillis(long)will always be set
- Specified by:
buildin classAbstractHttp2ConnectionHandlerBuilder<Http2ConnectionHandler,Http2ConnectionHandlerBuilder>
-
-