Class Http2FrameCodecBuilder
Http2FrameCodec
.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Allows overriding behavior of existing builder.(package private)
Http2FrameCodecBuilder
(boolean server) -
Method Summary
Modifier and TypeMethodDescriptionautoAckPingFrame
(boolean autoAckPingFrame) Determine if PING frame should automatically be acknowledged or not.autoAckSettingsFrame
(boolean autoAckSettings) Determine if settings frame should automatically be acknowledged and applied.build()
Build aHttp2FrameCodec
object.protected Http2FrameCodec
build
(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings) Implement this method to create a newHttp2ConnectionHandler
or its subtype instance.int
Returns the maximum number of consecutive empty DATA frames (without end_of_stream flag) that are allowed before the connection is closed.decoderEnforceMaxConsecutiveEmptyDataFrames
(int maxConsecutiveEmptyFrames) Sets the maximum number of consecutive empty DATA frames (without end_of_stream flag) that are allowed before the connection is closed.decoderEnforceMaxRstFramesPerWindow
(int maxRstFramesPerWindow, int secondsPerWindow) Sets the maximum number RST frames that are allowed per window before the connection is closed.decoupleCloseAndGoAway
(boolean decoupleCloseAndGoAway) Determine if theChannelOutboundInvoker.close()
should be coupled with goaway and graceful close.boolean
Returns if the encoder should queue frames if the maximum number of concurrent streams would otherwise be exceeded.encoderEnforceMaxConcurrentStreams
(boolean encoderEnforceMaxConcurrentStreams) Sets if the encoder should queue frames if the maximum number of concurrent streams would otherwise be exceeded.int
Returns the maximum number of queued control frames that are allowed before the connection is closed.encoderEnforceMaxQueuedControlFrames
(int maxQueuedControlFrames) Sets the maximum number of queued control frames that are allowed before the connection is closed.encoderIgnoreMaxHeaderListSize
(boolean ignoreMaxHeaderListSize) Sets if the SETTINGS_MAX_HEADER_LIST_SIZE should be ignored when encoding headers.flushPreface
(boolean flushPreface) static Http2FrameCodecBuilder
Creates a builder for an HTTP/2 client.static Http2FrameCodecBuilder
Creates a builder for an HTTP/2 server.Returns the logger that is used for the encoder and decoder.frameLogger
(Http2FrameLogger frameLogger) Sets the logger that is used for the encoder and decoder.(package private) Http2FrameCodecBuilder
frameWriter
(Http2FrameWriter frameWriter) long
Returns the graceful shutdown timeout of theHttp2Connection
in milliseconds.gracefulShutdownTimeoutMillis
(long gracefulShutdownTimeoutMillis) Sets the graceful shutdown timeout of theHttp2Connection
in milliseconds.Returns theHttp2HeadersEncoder.SensitivityDetector
to use.headerSensitivityDetector
(Http2HeadersEncoder.SensitivityDetector headerSensitivityDetector) Sets theHttp2HeadersEncoder.SensitivityDetector
to use.initialHuffmanDecodeCapacity
(int initialHuffmanDecodeCapacity) Deprecated.Sets theHttp2Settings
to use for the initial connection settings exchange.initialSettings
(Http2Settings settings) Sets theHttp2Settings
to use for the initial connection settings exchange.boolean
isServer()
Returns ifAbstractHttp2ConnectionHandlerBuilder.build()
will to create aHttp2Connection
in server mode (true
) or client mode (false
).boolean
Returns if HTTP headers should be validated according to RFC 7540, 8.1.2.6.int
Get the maximum number of streams which can be in the reserved state at any given time.maxReservedStreams
(int maxReservedStreams) Set the maximum number of streams which can be in the reserved state at any given time.validateHeaders
(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
codec, connection, connection, decoder, decoupleCloseAndGoAway, encoder, flushPreface, frameListener, frameListener, isAutoAckPingFrame, isAutoAckSettingsFrame, promisedRequestVerifier, promisedRequestVerifier, self, server
-
Field Details
-
frameWriter
-
-
Constructor Details
-
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:
-
Http2FrameCodecBuilder
Http2FrameCodecBuilder(boolean server)
-
-
Method Details
-
forClient
Creates a builder for an HTTP/2 client. -
forServer
Creates a builder for an HTTP/2 server. -
frameWriter
-
initialSettings
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets theHttp2Settings
to use for the initial connection settings exchange.- Overrides:
initialSettings
in classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,
Http2FrameCodecBuilder>
-
initialSettings
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets theHttp2Settings
to use for the initial connection settings exchange.- Overrides:
initialSettings
in classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,
Http2FrameCodecBuilder>
-
gracefulShutdownTimeoutMillis
public long gracefulShutdownTimeoutMillis()Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Returns the graceful shutdown timeout of theHttp2Connection
in milliseconds. Returns -1 if the timeout is indefinite. -
gracefulShutdownTimeoutMillis
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets the graceful shutdown timeout of theHttp2Connection
in milliseconds. -
isServer
public boolean isServer()Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Returns ifAbstractHttp2ConnectionHandlerBuilder.build()
will to create aHttp2Connection
in server mode (true
) or client mode (false
).- Overrides:
isServer
in classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,
Http2FrameCodecBuilder>
-
maxReservedStreams
public int maxReservedStreams()Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Get 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:
maxReservedStreams
in classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,
Http2FrameCodecBuilder>
-
maxReservedStreams
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Set the maximum number of streams which can be in the reserved state at any given time.- Overrides:
maxReservedStreams
in classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,
Http2FrameCodecBuilder>
-
isValidateHeaders
public boolean isValidateHeaders()Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Returns if HTTP headers should be validated according to RFC 7540, 8.1.2.6.- Overrides:
isValidateHeaders
in classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,
Http2FrameCodecBuilder>
-
validateHeaders
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets if HTTP headers should be validated according to RFC 7540, 8.1.2.6.- Overrides:
validateHeaders
in classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,
Http2FrameCodecBuilder>
-
frameLogger
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Returns the logger that is used for the encoder and decoder.- Overrides:
frameLogger
in classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,
Http2FrameCodecBuilder> - Returns:
Http2FrameLogger
if set, ornull
if not set.
-
frameLogger
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets the logger that is used for the encoder and decoder.- Overrides:
frameLogger
in classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,
Http2FrameCodecBuilder>
-
encoderEnforceMaxConcurrentStreams
public boolean encoderEnforceMaxConcurrentStreams()Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Returns 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:AbstractHttp2ConnectionHandlerBuilder
Sets 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:AbstractHttp2ConnectionHandlerBuilder
Returns 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.0
means no protection is in place. -
encoderEnforceMaxQueuedControlFrames
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets 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.0
means no protection should be applied. -
headerSensitivityDetector
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Returns theHttp2HeadersEncoder.SensitivityDetector
to use. -
headerSensitivityDetector
public Http2FrameCodecBuilder headerSensitivityDetector(Http2HeadersEncoder.SensitivityDetector headerSensitivityDetector) Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets theHttp2HeadersEncoder.SensitivityDetector
to use. -
encoderIgnoreMaxHeaderListSize
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets if the SETTINGS_MAX_HEADER_LIST_SIZE should be ignored when encoding headers.- Overrides:
encoderIgnoreMaxHeaderListSize
in classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,
Http2FrameCodecBuilder> - Parameters:
ignoreMaxHeaderListSize
-true
to ignore SETTINGS_MAX_HEADER_LIST_SIZE.- Returns:
- this.
-
initialHuffmanDecodeCapacity
@Deprecated public Http2FrameCodecBuilder initialHuffmanDecodeCapacity(int initialHuffmanDecodeCapacity) Deprecated.Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Does nothing, do not call. -
autoAckSettingsFrame
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Determine if settings frame should automatically be acknowledged and applied.- Overrides:
autoAckSettingsFrame
in classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,
Http2FrameCodecBuilder> - Returns:
- this.
-
autoAckPingFrame
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Determine if PING frame should automatically be acknowledged or not.- Overrides:
autoAckPingFrame
in classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,
Http2FrameCodecBuilder> - Returns:
- this.
-
decoupleCloseAndGoAway
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Determine if theChannelOutboundInvoker.close()
should be coupled with goaway and graceful close.- Overrides:
decoupleCloseAndGoAway
in classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,
Http2FrameCodecBuilder> - Parameters:
decoupleCloseAndGoAway
-true
to makeChannelOutboundInvoker.close()
directly close the underlying transport, and not attempt graceful closure via GOAWAY.- Returns:
this
.
-
flushPreface
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Determine if the Preface should be automatically flushed when theChannel
becomes 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:
flushPreface
in classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,
Http2FrameCodecBuilder> - Parameters:
flushPreface
-true
to automatically flush,false otherwise
.- Returns:
this
.- See Also:
-
decoderEnforceMaxConsecutiveEmptyDataFrames
public int decoderEnforceMaxConsecutiveEmptyDataFrames()Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Returns 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.0
means no protection is in place. -
decoderEnforceMaxConsecutiveEmptyDataFrames
public Http2FrameCodecBuilder decoderEnforceMaxConsecutiveEmptyDataFrames(int maxConsecutiveEmptyFrames) Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets 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.0
means no protection should be applied. -
decoderEnforceMaxRstFramesPerWindow
public Http2FrameCodecBuilder decoderEnforceMaxRstFramesPerWindow(int maxRstFramesPerWindow, int secondsPerWindow) Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets 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.0
for any of the parameters means no protection should be applied. -
build
Build aHttp2FrameCodec
object.- Overrides:
build
in classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,
Http2FrameCodecBuilder>
-
build
protected Http2FrameCodec build(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings) Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Implement this method to create a newHttp2ConnectionHandler
or 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:
build
in classAbstractHttp2ConnectionHandlerBuilder<Http2FrameCodec,
Http2FrameCodecBuilder>
-