- java.lang.Object
-
- io.netty5.handler.codec.http2.AbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,Http2FrameCodecBuilder>
-
- io.netty5.handler.codec.http2.Http2FrameCodecBuilder
-
@UnstableApi public class Http2FrameCodecBuilder extends AbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,Http2FrameCodecBuilder>
Builder for theHttp2FrameCodec.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedHttp2FrameCodecBuilder()Allows overriding behavior of existing builder.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Http2FrameCodecBuilderautoAckPingFrame(boolean autoAckPingFrame)Determine if PING frame should automatically be acknowledged or not.Http2FrameCodecBuilderautoAckSettingsFrame(boolean autoAckSettings)Determine if settings frame should automatically be acknowledged and applied.Http2FrameCodecbuild()Build aHttp2FrameCodecobject.protected Http2FrameCodecbuild(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings)Implement this method to create a newHttp2ConnectionHandleror its subtype instance.intdecoderEnforceMaxConsecutiveEmptyDataFrames()Returns the maximum number of consecutive empty DATA frames (without end_of_stream flag) that are allowed before the connection is closed.Http2FrameCodecBuilderdecoderEnforceMaxConsecutiveEmptyDataFrames(int maxConsecutiveEmptyFrames)Sets the maximum number of consecutive empty DATA frames (without end_of_stream flag) that are allowed before the connection is closed.Http2FrameCodecBuilderdecoupleCloseAndGoAway(boolean decoupleCloseAndGoAway)Determine if theChannel.close()should be coupled with goaway and graceful close.booleanencoderEnforceMaxConcurrentStreams()Returns if the encoder should queue frames if the maximum number of concurrent streams would otherwise be exceeded.Http2FrameCodecBuilderencoderEnforceMaxConcurrentStreams(boolean encoderEnforceMaxConcurrentStreams)Sets if the encoder should queue frames if the maximum number of concurrent streams would otherwise be exceeded.intencoderEnforceMaxQueuedControlFrames()Returns the maximum number of queued control frames that are allowed before the connection is closed.Http2FrameCodecBuilderencoderEnforceMaxQueuedControlFrames(int maxQueuedControlFrames)Sets the maximum number of queued control frames that are allowed before the connection is closed.Http2FrameCodecBuilderencoderIgnoreMaxHeaderListSize(boolean ignoreMaxHeaderListSize)Sets if the SETTINGS_MAX_HEADER_LIST_SIZE should be ignored when encoding headers.Http2FrameCodecBuilderflushPreface(boolean flushPreface)static Http2FrameCodecBuilderforClient()Creates a builder for an HTTP/2 client.static Http2FrameCodecBuilderforServer()Creates a builder for an HTTP/2 server.Http2FrameLoggerframeLogger()Returns the logger that is used for the encoder and decoder.Http2FrameCodecBuilderframeLogger(Http2FrameLogger frameLogger)Sets the logger that is used for the encoder and decoder.longgracefulShutdownTimeoutMillis()Returns the graceful shutdown timeout of theHttp2Connectionin milliseconds.Http2FrameCodecBuildergracefulShutdownTimeoutMillis(long gracefulShutdownTimeoutMillis)Sets the graceful shutdown timeout of theHttp2Connectionin milliseconds.Http2HeadersEncoder.SensitivityDetectorheaderSensitivityDetector()Returns theHttp2HeadersEncoder.SensitivityDetectorto use.Http2FrameCodecBuilderheaderSensitivityDetector(Http2HeadersEncoder.SensitivityDetector headerSensitivityDetector)Sets theHttp2HeadersEncoder.SensitivityDetectorto use.Http2FrameCodecBuilderinitialHuffmanDecodeCapacity(int initialHuffmanDecodeCapacity)Deprecated.Http2SettingsinitialSettings()Sets theHttp2Settingsto use for the initial connection settings exchange.Http2FrameCodecBuilderinitialSettings(Http2Settings settings)Sets theHttp2Settingsto use for the initial connection settings exchange.booleanisServer()Returns ifAbstractHttp2ConnectionHandlerBuilder.build()will to create aHttp2Connectionin server mode (true) or client mode (false).booleanisValidateHeaders()Returns if HTTP headers should be validated according to RFC 7540, 8.1.2.6.intmaxReservedStreams()Get the maximum number of streams which can be in the reserved state at any given time.Http2FrameCodecBuildermaxReservedStreams(int maxReservedStreams)Set the maximum number of streams which can be in the reserved state at any given time.Http2FrameCodecBuildervalidateHeaders(boolean validateHeaders)Sets if HTTP headers should be validated according to RFC 7540, 8.1.2.6.-
Methods inherited from class io.netty5.handler.codec.http2.AbstractHttp2ConnectionHandlerBuilder
codec, connection, connection, decoder, decoupleCloseAndGoAway, encoder, flushPreface, frameListener, frameListener, isAutoAckPingFrame, isAutoAckSettingsFrame, promisedRequestVerifier, promisedRequestVerifier, self, server
-
-
-
-
Constructor Detail
-
Http2FrameCodecBuilder
protected Http2FrameCodecBuilder()
Allows overriding behavior of existing builder.Users of this constructor are responsible for invoking
AbstractHttp2ConnectionHandlerBuilder.server(boolean)method or overridingisServer()method to give the builder information if theHttp2Connection(s) it creates are in server or client mode.- See Also:
AbstractHttp2ConnectionHandlerBuilder
-
-
Method Detail
-
forClient
public static Http2FrameCodecBuilder forClient()
Creates a builder for an HTTP/2 client.
-
forServer
public static Http2FrameCodecBuilder forServer()
Creates a builder for an HTTP/2 server.
-
initialSettings
public Http2Settings initialSettings()
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets theHttp2Settingsto use for the initial connection settings exchange.- Overrides:
initialSettingsin classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,Http2FrameCodecBuilder>
-
initialSettings
public Http2FrameCodecBuilder initialSettings(Http2Settings settings)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets theHttp2Settingsto use for the initial connection settings exchange.- Overrides:
initialSettingsin classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,Http2FrameCodecBuilder>
-
gracefulShutdownTimeoutMillis
public long gracefulShutdownTimeoutMillis()
Description copied from class:AbstractHttp2ConnectionHandlerBuilderReturns the graceful shutdown timeout of theHttp2Connectionin milliseconds. Returns -1 if the timeout is indefinite.
-
gracefulShutdownTimeoutMillis
public Http2FrameCodecBuilder gracefulShutdownTimeoutMillis(long gracefulShutdownTimeoutMillis)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets the graceful shutdown timeout of theHttp2Connectionin milliseconds.
-
isServer
public boolean isServer()
Description copied from class:AbstractHttp2ConnectionHandlerBuilderReturns ifAbstractHttp2ConnectionHandlerBuilder.build()will to create aHttp2Connectionin server mode (true) or client mode (false).- Overrides:
isServerin classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,Http2FrameCodecBuilder>
-
maxReservedStreams
public int maxReservedStreams()
Description copied from class:AbstractHttp2ConnectionHandlerBuilderGet the maximum number of streams which can be in the reserved state at any given time.By default this value will be ignored on the server for local endpoint. This is because the RFC provides no way to explicitly communicate a limit to how many states can be in the reserved state, and instead relies on the peer to send RST_STREAM frames when they will be rejected.
- Overrides:
maxReservedStreamsin classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,Http2FrameCodecBuilder>
-
maxReservedStreams
public Http2FrameCodecBuilder maxReservedStreams(int maxReservedStreams)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSet the maximum number of streams which can be in the reserved state at any given time.- Overrides:
maxReservedStreamsin classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,Http2FrameCodecBuilder>
-
isValidateHeaders
public boolean isValidateHeaders()
Description copied from class:AbstractHttp2ConnectionHandlerBuilderReturns if HTTP headers should be validated according to RFC 7540, 8.1.2.6.- Overrides:
isValidateHeadersin classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,Http2FrameCodecBuilder>
-
validateHeaders
public Http2FrameCodecBuilder validateHeaders(boolean validateHeaders)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets if HTTP headers should be validated according to RFC 7540, 8.1.2.6.- Overrides:
validateHeadersin classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,Http2FrameCodecBuilder>
-
frameLogger
public Http2FrameLogger frameLogger()
Description copied from class:AbstractHttp2ConnectionHandlerBuilderReturns the logger that is used for the encoder and decoder.- Overrides:
frameLoggerin classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,Http2FrameCodecBuilder>- Returns:
Http2FrameLoggerif set, ornullif not set.
-
frameLogger
public Http2FrameCodecBuilder frameLogger(Http2FrameLogger frameLogger)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets the logger that is used for the encoder and decoder.- Overrides:
frameLoggerin classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,Http2FrameCodecBuilder>
-
encoderEnforceMaxConcurrentStreams
public boolean encoderEnforceMaxConcurrentStreams()
Description copied from class:AbstractHttp2ConnectionHandlerBuilderReturns if the encoder should queue frames if the maximum number of concurrent streams would otherwise be exceeded.
-
encoderEnforceMaxConcurrentStreams
public Http2FrameCodecBuilder 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.
-
encoderEnforceMaxQueuedControlFrames
public int encoderEnforceMaxQueuedControlFrames()
Description copied from class:AbstractHttp2ConnectionHandlerBuilderReturns the maximum number of queued control frames that are allowed before the connection is closed. This allows to protected against various attacks that can lead to high CPU / memory usage if the remote-peer floods us with frames that would have us produce control frames, but stops to read from the underlying socket.0means no protection is in place.
-
encoderEnforceMaxQueuedControlFrames
public Http2FrameCodecBuilder encoderEnforceMaxQueuedControlFrames(int maxQueuedControlFrames)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets the maximum number of queued control frames that are allowed before the connection is closed. This allows to protected against various attacks that can lead to high CPU / memory usage if the remote-peer floods us with frames that would have us produce control frames, but stops to read from the underlying socket.0means no protection should be applied.
-
headerSensitivityDetector
public Http2HeadersEncoder.SensitivityDetector headerSensitivityDetector()
Description copied from class:AbstractHttp2ConnectionHandlerBuilderReturns theHttp2HeadersEncoder.SensitivityDetectorto use.- Overrides:
headerSensitivityDetectorin classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,Http2FrameCodecBuilder>
-
headerSensitivityDetector
public Http2FrameCodecBuilder headerSensitivityDetector(Http2HeadersEncoder.SensitivityDetector headerSensitivityDetector)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets theHttp2HeadersEncoder.SensitivityDetectorto use.- Overrides:
headerSensitivityDetectorin classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,Http2FrameCodecBuilder>
-
encoderIgnoreMaxHeaderListSize
public Http2FrameCodecBuilder encoderIgnoreMaxHeaderListSize(boolean ignoreMaxHeaderListSize)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderSets if the SETTINGS_MAX_HEADER_LIST_SIZE should be ignored when encoding headers.- Overrides:
encoderIgnoreMaxHeaderListSizein classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,Http2FrameCodecBuilder>- Parameters:
ignoreMaxHeaderListSize-trueto ignore SETTINGS_MAX_HEADER_LIST_SIZE.- Returns:
- this.
-
initialHuffmanDecodeCapacity
@Deprecated public Http2FrameCodecBuilder initialHuffmanDecodeCapacity(int initialHuffmanDecodeCapacity)
Deprecated.Description copied from class:AbstractHttp2ConnectionHandlerBuilderDoes nothing, do not call.
-
autoAckSettingsFrame
public Http2FrameCodecBuilder autoAckSettingsFrame(boolean autoAckSettings)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderDetermine if settings frame should automatically be acknowledged and applied.- Overrides:
autoAckSettingsFramein classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,Http2FrameCodecBuilder>- Returns:
- this.
-
autoAckPingFrame
public Http2FrameCodecBuilder autoAckPingFrame(boolean autoAckPingFrame)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderDetermine if PING frame should automatically be acknowledged or not.- Overrides:
autoAckPingFramein classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,Http2FrameCodecBuilder>- Returns:
- this.
-
decoupleCloseAndGoAway
public Http2FrameCodecBuilder decoupleCloseAndGoAway(boolean decoupleCloseAndGoAway)
Description copied from class:AbstractHttp2ConnectionHandlerBuilderDetermine if theChannel.close()should be coupled with goaway and graceful close.- Overrides:
decoupleCloseAndGoAwayin classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,Http2FrameCodecBuilder>- Parameters:
decoupleCloseAndGoAway-trueto makeChannel.close()directly close the underlying transport, and not attempt graceful closure via GOAWAY.- Returns:
this.
-
flushPreface
public Http2FrameCodecBuilder 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<Http2FrameCodec,Http2FrameCodecBuilder>- 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 protected 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 Http2FrameCodecBuilder 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 protected 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.
-
build
public Http2FrameCodec build()
Build aHttp2FrameCodecobject.- Overrides:
buildin classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,Http2FrameCodecBuilder>
-
build
protected Http2FrameCodec 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<Http2FrameCodec,Http2FrameCodecBuilder>
-
-