Package io.netty.handler.codec.http2
Class HttpToHttp2ConnectionHandlerBuilder
- java.lang.Object
-
- io.netty.handler.codec.http2.AbstractHttp2ConnectionHandlerBuilder<HttpToHttp2ConnectionHandler,HttpToHttp2ConnectionHandlerBuilder>
-
- io.netty.handler.codec.http2.HttpToHttp2ConnectionHandlerBuilder
-
public final class HttpToHttp2ConnectionHandlerBuilder extends AbstractHttp2ConnectionHandlerBuilder<HttpToHttp2ConnectionHandler,HttpToHttp2ConnectionHandlerBuilder>
Builder which buildsHttpToHttp2ConnectionHandler
objects.
-
-
Constructor Summary
Constructors Constructor Description HttpToHttp2ConnectionHandlerBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description HttpToHttp2ConnectionHandler
build()
Create a newHttp2ConnectionHandler
.protected HttpToHttp2ConnectionHandler
build(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings)
Implement this method to create a newHttp2ConnectionHandler
or its subtype instance.HttpToHttp2ConnectionHandlerBuilder
codec(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder)
Sets theHttp2ConnectionDecoder
andHttp2ConnectionEncoder
to use.HttpToHttp2ConnectionHandlerBuilder
connection(Http2Connection connection)
Sets theHttp2Connection
to use.HttpToHttp2ConnectionHandlerBuilder
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.HttpToHttp2ConnectionHandlerBuilder
decoderEnforceMaxRstFramesPerWindow(int maxRstFramesPerWindow, int secondsPerWindow)
Sets the maximum number RST frames that are allowed per window before the connection is closed.HttpToHttp2ConnectionHandlerBuilder
decoupleCloseAndGoAway(boolean decoupleCloseAndGoAway)
Determine if theChannel.close()
should be coupled with goaway and graceful close.HttpToHttp2ConnectionHandlerBuilder
encoderEnforceMaxConcurrentStreams(boolean encoderEnforceMaxConcurrentStreams)
Sets if the encoder should queue frames if the maximum number of concurrent streams would otherwise be exceeded.HttpToHttp2ConnectionHandlerBuilder
encoderIgnoreMaxHeaderListSize(boolean encoderIgnoreMaxHeaderListSize)
Sets if the SETTINGS_MAX_HEADER_LIST_SIZE should be ignored when encoding headers.HttpToHttp2ConnectionHandlerBuilder
flushPreface(boolean flushPreface)
HttpToHttp2ConnectionHandlerBuilder
frameListener(Http2FrameListener frameListener)
Sets the listener of inbound frames.HttpToHttp2ConnectionHandlerBuilder
frameLogger(Http2FrameLogger frameLogger)
Sets the logger that is used for the encoder and decoder.HttpToHttp2ConnectionHandlerBuilder
gracefulShutdownTimeoutMillis(long gracefulShutdownTimeoutMillis)
Sets the graceful shutdown timeout of theHttp2Connection
in milliseconds.HttpToHttp2ConnectionHandlerBuilder
headerSensitivityDetector(Http2HeadersEncoder.SensitivityDetector headerSensitivityDetector)
Sets theHttp2HeadersEncoder.SensitivityDetector
to use.HttpToHttp2ConnectionHandlerBuilder
httpScheme(HttpScheme httpScheme)
Addscheme
inHttp2Headers
if not already present.HttpToHttp2ConnectionHandlerBuilder
initialHuffmanDecodeCapacity(int initialHuffmanDecodeCapacity)
Deprecated.HttpToHttp2ConnectionHandlerBuilder
initialSettings(Http2Settings settings)
Sets theHttp2Settings
to use for the initial connection settings exchange.HttpToHttp2ConnectionHandlerBuilder
server(boolean isServer)
Sets ifAbstractHttp2ConnectionHandlerBuilder.build()
will to create aHttp2Connection
in server mode (true
) or client mode (false
).HttpToHttp2ConnectionHandlerBuilder
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
autoAckPingFrame, autoAckSettingsFrame, connection, decoder, decoderEnforceMaxConsecutiveEmptyDataFrames, decoupleCloseAndGoAway, encoder, encoderEnforceMaxConcurrentStreams, encoderEnforceMaxQueuedControlFrames, encoderEnforceMaxQueuedControlFrames, flushPreface, frameListener, frameLogger, gracefulShutdownTimeoutMillis, headerSensitivityDetector, initialSettings, isAutoAckPingFrame, isAutoAckSettingsFrame, isServer, isValidateHeaders, maxReservedStreams, maxReservedStreams, promisedRequestVerifier, promisedRequestVerifier, self
-
-
-
-
Method Detail
-
validateHeaders
public HttpToHttp2ConnectionHandlerBuilder validateHeaders(boolean validateHeaders)
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets if HTTP headers should be validated according to RFC 7540, 8.1.2.6.
-
initialSettings
public HttpToHttp2ConnectionHandlerBuilder initialSettings(Http2Settings settings)
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets theHttp2Settings
to use for the initial connection settings exchange.
-
frameListener
public HttpToHttp2ConnectionHandlerBuilder frameListener(Http2FrameListener frameListener)
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets the listener of inbound frames. This listener will only be set if the decoder's listener isnull
.
-
gracefulShutdownTimeoutMillis
public HttpToHttp2ConnectionHandlerBuilder gracefulShutdownTimeoutMillis(long gracefulShutdownTimeoutMillis)
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets the graceful shutdown timeout of theHttp2Connection
in milliseconds.
-
server
public HttpToHttp2ConnectionHandlerBuilder server(boolean isServer)
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets ifAbstractHttp2ConnectionHandlerBuilder.build()
will to create aHttp2Connection
in server mode (true
) or client mode (false
).
-
connection
public HttpToHttp2ConnectionHandlerBuilder connection(Http2Connection connection)
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets theHttp2Connection
to use.
-
codec
public HttpToHttp2ConnectionHandlerBuilder codec(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder)
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets theHttp2ConnectionDecoder
andHttp2ConnectionEncoder
to use.
-
frameLogger
public HttpToHttp2ConnectionHandlerBuilder frameLogger(Http2FrameLogger frameLogger)
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets the logger that is used for the encoder and decoder.
-
encoderEnforceMaxConcurrentStreams
public HttpToHttp2ConnectionHandlerBuilder 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.
-
headerSensitivityDetector
public HttpToHttp2ConnectionHandlerBuilder headerSensitivityDetector(Http2HeadersEncoder.SensitivityDetector headerSensitivityDetector)
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets theHttp2HeadersEncoder.SensitivityDetector
to use.
-
encoderIgnoreMaxHeaderListSize
public HttpToHttp2ConnectionHandlerBuilder encoderIgnoreMaxHeaderListSize(boolean encoderIgnoreMaxHeaderListSize)
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Sets if the SETTINGS_MAX_HEADER_LIST_SIZE should be ignored when encoding headers.- Overrides:
encoderIgnoreMaxHeaderListSize
in classAbstractHttp2ConnectionHandlerBuilder<HttpToHttp2ConnectionHandler,HttpToHttp2ConnectionHandlerBuilder>
- Parameters:
encoderIgnoreMaxHeaderListSize
-true
to ignore SETTINGS_MAX_HEADER_LIST_SIZE.- Returns:
- this.
-
decoderEnforceMaxConsecutiveEmptyDataFrames
public HttpToHttp2ConnectionHandlerBuilder 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 HttpToHttp2ConnectionHandlerBuilder 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.
-
initialHuffmanDecodeCapacity
@Deprecated public HttpToHttp2ConnectionHandlerBuilder initialHuffmanDecodeCapacity(int initialHuffmanDecodeCapacity)
Deprecated.Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Does nothing, do not call.
-
decoupleCloseAndGoAway
public HttpToHttp2ConnectionHandlerBuilder decoupleCloseAndGoAway(boolean decoupleCloseAndGoAway)
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Determine if theChannel.close()
should be coupled with goaway and graceful close.- Overrides:
decoupleCloseAndGoAway
in classAbstractHttp2ConnectionHandlerBuilder<HttpToHttp2ConnectionHandler,HttpToHttp2ConnectionHandlerBuilder>
- Parameters:
decoupleCloseAndGoAway
-true
to makeChannel.close()
directly close the underlying transport, and not attempt graceful closure via GOAWAY.- Returns:
this
.
-
flushPreface
public HttpToHttp2ConnectionHandlerBuilder flushPreface(boolean 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<HttpToHttp2ConnectionHandler,HttpToHttp2ConnectionHandlerBuilder>
- Parameters:
flushPreface
-true
to automatically flush,false otherwise
.- Returns:
this
.- See Also:
- HTTP/2 Connection Preface
-
httpScheme
public HttpToHttp2ConnectionHandlerBuilder httpScheme(HttpScheme httpScheme)
Addscheme
inHttp2Headers
if not already present.- Parameters:
httpScheme
-HttpScheme
type- Returns:
this
.
-
build
public HttpToHttp2ConnectionHandler build()
Description copied from class:AbstractHttp2ConnectionHandlerBuilder
Create a newHttp2ConnectionHandler
.
-
build
protected HttpToHttp2ConnectionHandler 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<HttpToHttp2ConnectionHandler,HttpToHttp2ConnectionHandlerBuilder>
-
-