Package reactor.netty.http.server
Class HttpServerConfig
java.lang.Object
reactor.netty.transport.TransportConfig
reactor.netty.transport.ServerTransportConfig<HttpServerConfig>
reactor.netty.http.server.HttpServerConfig
Encapsulate all necessary configuration for HTTP server transport. The public API is read-only.
- Author:
- Stephane Maldini, Violeta Georgieva, Andrey Shlykov
-
Method Summary
Modifier and TypeMethodDescriptionchannelInitializer
(ConnectionObserver connectionObserver, @Nullable SocketAddress remoteAddress, boolean onServer) Return theChannelInitializer
that will be used for initializing the channel pipeline.channelType
(boolean isDomainSocket) Return the channel type this configuration is associated with, it can be one of the following.@Nullable BiPredicate<HttpServerRequest,
HttpServerResponse> Return the configured compression predicate or null.Deprecated.as of 1.1.0.Deprecated.as of 1.1.0.decoder()
Return the configured HTTP request decoder options or the default.protected LoggingHandler
Return the defaultLoggingHandler
to wiretap this transport.protected LoopResources
Return the defaultLoopResources
for this transport.protected ChannelMetricsRecorder
Return the configured metrics recorder.protected ChannelPipelineConfigurer
Return the default callback if any orChannelPipelineConfigurer.emptyConfigurer()
.Return the configured HTTP form decoder or the default.@Nullable Http2SettingsSpec
Return the HTTP/2 configuration.@Nullable Http3SettingsSpec
Return the HTTP/3 configuration.@Nullable Duration
Return the configured idle timeout for the connection when it is waiting for an HTTP request or null.boolean
Returns whether thatHttpServer
supports the"Forwarded"
and"X-Forwarded-*"
HTTP request headers for deriving information about the connection.boolean
isSecure()
Returns true if thatHttpServer
secured via SSL transport.protected void
loggingHandler
(LoggingHandler loggingHandler) int
The configured maximum number of HTTP/1.1 requests which can be served until the connection is closed by the server.protected void
metricsRecorder
(@Nullable Supplier<? extends ChannelMetricsRecorder> metricsRecorder) Obtains immediately theChannelMetricsRecorder
from the providedSupplier
.int
Compression is performed once response size exceeds the minimum compression size in bytes.Return the HTTP protocol to support.Return the supported type for the"HAProxy proxy protocol"
.@Nullable Duration
Return the configured read timeout for the request or null.boolean
Returns true if thatHttpServer
will redirect HTTP to HTTPS by changing the scheme only but otherwise leaving the port the same when SSL is enabled.@Nullable Duration
Return the configured request timeout for the request or null.@Nullable SslProvider
Returns the currentSslProvider
if thatHttpServer
secured via SSL transport or null.Returns the configured function that receives the actual uri and returns the uri tag value that will be used for the metrics withMetrics.URI
tag.Methods inherited from class reactor.netty.transport.ServerTransportConfig
childAttributes, childObserver, childOptions, defaultChildObserver, defaultConnectionObserver, doOnBind, doOnBound, doOnConnection, doOnUnbound, eventLoopGroup
Methods inherited from class reactor.netty.transport.TransportConfig
attributes, bindAddress, bindAddress, channelGroup, channelHash, channelOperationsProvider, connectionFactory, connectionObserver, doOnChannelInit, isPreferNative, loggingHandler, loopResources, metricsRecorder, metricsRecorderInternal, options, updateMap
-
Method Details
-
compressPredicate
Return the configured compression predicate or null.- Returns:
- the configured compression predicate or null
-
cookieDecoder
Deprecated.as of 1.1.0. This will be removed in 2.0.0 as Netty 5 supports only strict validation.Return the configuredServerCookieDecoder
or the defaultServerCookieDecoder.STRICT
.- Returns:
- the configured
ServerCookieDecoder
or the defaultServerCookieDecoder.STRICT
-
cookieEncoder
Deprecated.as of 1.1.0. This will be removed in 2.0.0 as Netty 5 supports only strict validation.Return the configuredServerCookieEncoder
or the defaultServerCookieEncoder.STRICT
.- Returns:
- the configured
ServerCookieEncoder
or the defaultServerCookieEncoder.STRICT
-
decoder
Return the configured HTTP request decoder options or the default.- Returns:
- the configured HTTP request decoder options or the default
-
formDecoderProvider
Return the configured HTTP form decoder or the default.- Returns:
- the configured HTTP form decoder or the default
- Since:
- 1.0.11
-
http2SettingsSpec
Return the HTTP/2 configuration.- Returns:
- the HTTP/2 configuration
-
http3SettingsSpec
Return the HTTP/3 configuration.- Returns:
- the HTTP/3 configuration
- Since:
- 1.2.0
-
idleTimeout
Return the configured idle timeout for the connection when it is waiting for an HTTP request or null.- Returns:
- the configured idle timeout for the connection when it is waiting for an HTTP request or null
-
isForwarded
public boolean isForwarded()Returns whether thatHttpServer
supports the"Forwarded"
and"X-Forwarded-*"
HTTP request headers for deriving information about the connection.- Returns:
- true if that
HttpServer
supports the"Forwarded"
and"X-Forwarded-*"
HTTP request headers for deriving information about the connection
-
isSecure
public boolean isSecure()Returns true if thatHttpServer
secured via SSL transport.- Returns:
- true if that
HttpServer
secured via SSL transport
-
maxKeepAliveRequests
public int maxKeepAliveRequests()The configured maximum number of HTTP/1.1 requests which can be served until the connection is closed by the server.- Returns:
- the configured maximum number of HTTP/1.1 requests which can be served until the connection is closed by the server.
- Since:
- 1.0.13
- See Also:
-
minCompressionSize
public int minCompressionSize()Compression is performed once response size exceeds the minimum compression size in bytes.- Returns:
- the minimum compression size in bytes
-
protocols
Return the HTTP protocol to support. Default isHttpProtocol.HTTP11
.- Returns:
- the HTTP protocol to support
-
proxyProtocolSupportType
Return the supported type for the"HAProxy proxy protocol"
. The default isProxyProtocolSupportType.OFF
.- Returns:
- the supported type for the
"HAProxy proxy protocol"
-
readTimeout
Return the configured read timeout for the request or null.- Returns:
- the configured read timeout for the request or null
- Since:
- 1.1.9
-
redirectHttpToHttps
public boolean redirectHttpToHttps()Returns true if thatHttpServer
will redirect HTTP to HTTPS by changing the scheme only but otherwise leaving the port the same when SSL is enabled. This configuration is applicable only for HTTP/1.x.- Returns:
- true if that
HttpServer
will redirect HTTP to HTTPS by changing the scheme only but otherwise leaving the port the same when SSL is enabled. This configuration is applicable only for HTTP/1.x.
-
requestTimeout
Return the configured request timeout for the request or null.- Returns:
- the configured request timeout for the request or null
- Since:
- 1.1.9
-
sslProvider
Returns the currentSslProvider
if thatHttpServer
secured via SSL transport or null.- Returns:
- the current
SslProvider
if thatHttpServer
secured via SSL transport or null
-
uriTagValue
Returns the configured function that receives the actual uri and returns the uri tag value that will be used for the metrics withMetrics.URI
tag.- Returns:
- the configured function that receives the actual uri and returns the uri tag value
that will be used for the metrics with
Metrics.URI
tag
-
channelInitializer
public ChannelInitializer<Channel> channelInitializer(ConnectionObserver connectionObserver, @Nullable SocketAddress remoteAddress, boolean onServer) Description copied from class:TransportConfig
Return theChannelInitializer
that will be used for initializing the channel pipeline.- Overrides:
channelInitializer
in classTransportConfig
- Parameters:
connectionObserver
- the configuredConnectionObserver
remoteAddress
- the remote addressonServer
- channel initializer for the server or for the client- Returns:
- the
ChannelInitializer
that will be used for initializing the channel pipeline
-
channelType
Description copied from class:TransportConfig
Return the channel type this configuration is associated with, it can be one of the following.- Overrides:
channelType
in classServerTransportConfig<HttpServerConfig>
- Parameters:
isDomainSocket
- true ifDomainSocketChannel
orServerDomainSocketChannel
is needed, false otherwise- Returns:
- the channel type this configuration is associated with
-
defaultLoggingHandler
Description copied from class:TransportConfig
Return the defaultLoggingHandler
to wiretap this transport.- Specified by:
defaultLoggingHandler
in classTransportConfig
- Returns:
- the default
LoggingHandler
to wiretap this transport
-
defaultLoopResources
Description copied from class:TransportConfig
Return the defaultLoopResources
for this transport.- Specified by:
defaultLoopResources
in classTransportConfig
- Returns:
- the default
LoopResources
for this transport
-
defaultMetricsRecorder
Description copied from class:TransportConfig
Return the configured metrics recorder.- Specified by:
defaultMetricsRecorder
in classTransportConfig
- Returns:
- the configured metrics recorder
-
defaultOnChannelInit
Description copied from class:TransportConfig
Return the default callback if any orChannelPipelineConfigurer.emptyConfigurer()
.- Overrides:
defaultOnChannelInit
in classServerTransportConfig<HttpServerConfig>
- Returns:
- the default callback if any or
ChannelPipelineConfigurer.emptyConfigurer()
-
loggingHandler
- Overrides:
loggingHandler
in classTransportConfig
-
metricsRecorder
protected void metricsRecorder(@Nullable Supplier<? extends ChannelMetricsRecorder> metricsRecorder) Description copied from class:TransportConfig
Obtains immediately theChannelMetricsRecorder
from the providedSupplier
.- Overrides:
metricsRecorder
in classTransportConfig
- Parameters:
metricsRecorder
- a supplier for theChannelMetricsRecorder
-