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 theChannelInitializerthat 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 LoggingHandlerReturn the defaultLoggingHandlerto wiretap this transport.protected LoopResourcesReturn the defaultLoopResourcesfor this transport.protected ChannelMetricsRecorderReturn the configured metrics recorder.protected ChannelPipelineConfigurerReturn the default callback if any orChannelPipelineConfigurer.emptyConfigurer().Return the configured HTTP form decoder or the default.@Nullable Http2SettingsSpecReturn the HTTP/2 configuration.@Nullable Http3SettingsSpecReturn the HTTP/3 configuration.@Nullable DurationReturn the configured idle timeout for the connection when it is waiting for an HTTP request or null.booleanReturns whether thatHttpServersupports the"Forwarded"and"X-Forwarded-*"HTTP request headers for deriving information about the connection.booleanisSecure()Returns true if thatHttpServersecured via SSL transport.protected voidloggingHandler(LoggingHandler loggingHandler) intThe configured maximum number of HTTP/1.1 requests which can be served until the connection is closed by the server.protected voidmetricsRecorder(@Nullable Supplier<? extends ChannelMetricsRecorder> metricsRecorder) Obtains immediately theChannelMetricsRecorderfrom the providedSupplier.intCompression 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 DurationReturn the configured read timeout for the request or null.booleanReturns true if thatHttpServerwill redirect HTTP to HTTPS by changing the scheme only but otherwise leaving the port the same when SSL is enabled.@Nullable DurationReturn the configured request timeout for the request or null.@Nullable SslProviderReturns the currentSslProviderif thatHttpServersecured 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.URItag.Methods inherited from class reactor.netty.transport.ServerTransportConfig
childAttributes, childObserver, childOptions, defaultChildObserver, defaultConnectionObserver, doOnBind, doOnBound, doOnConnection, doOnUnbound, eventLoopGroup, maxConnectionsMethods 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 configuredServerCookieDecoderor the defaultServerCookieDecoder.STRICT.- Returns:
- the configured
ServerCookieDecoderor 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 configuredServerCookieEncoderor the defaultServerCookieEncoder.STRICT.- Returns:
- the configured
ServerCookieEncoderor 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 thatHttpServersupports the"Forwarded"and"X-Forwarded-*"HTTP request headers for deriving information about the connection.- Returns:
- true if that
HttpServersupports the"Forwarded"and"X-Forwarded-*"HTTP request headers for deriving information about the connection
-
isSecure
public boolean isSecure()Returns true if thatHttpServersecured via SSL transport.- Returns:
- true if that
HttpServersecured 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 thatHttpServerwill 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
HttpServerwill 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 currentSslProviderif thatHttpServersecured via SSL transport or null.- Returns:
- the current
SslProviderif thatHttpServersecured 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.URItag.- Returns:
- the configured function that receives the actual uri and returns the uri tag value
that will be used for the metrics with
Metrics.URItag
-
channelInitializer
public ChannelInitializer<Channel> channelInitializer(ConnectionObserver connectionObserver, @Nullable SocketAddress remoteAddress, boolean onServer) Description copied from class:TransportConfigReturn theChannelInitializerthat will be used for initializing the channel pipeline.- Overrides:
channelInitializerin classTransportConfig- Parameters:
connectionObserver- the configuredConnectionObserverremoteAddress- the remote addressonServer- channel initializer for the server or for the client- Returns:
- the
ChannelInitializerthat will be used for initializing the channel pipeline
-
channelType
Description copied from class:TransportConfigReturn the channel type this configuration is associated with, it can be one of the following.- Overrides:
channelTypein classServerTransportConfig<HttpServerConfig>- Parameters:
isDomainSocket- true ifDomainSocketChannelorServerDomainSocketChannelis needed, false otherwise- Returns:
- the channel type this configuration is associated with
-
defaultLoggingHandler
Description copied from class:TransportConfigReturn the defaultLoggingHandlerto wiretap this transport.- Specified by:
defaultLoggingHandlerin classTransportConfig- Returns:
- the default
LoggingHandlerto wiretap this transport
-
defaultLoopResources
Description copied from class:TransportConfigReturn the defaultLoopResourcesfor this transport.- Specified by:
defaultLoopResourcesin classTransportConfig- Returns:
- the default
LoopResourcesfor this transport
-
defaultMetricsRecorder
Description copied from class:TransportConfigReturn the configured metrics recorder.- Specified by:
defaultMetricsRecorderin classTransportConfig- Returns:
- the configured metrics recorder
-
defaultOnChannelInit
Description copied from class:TransportConfigReturn the default callback if any orChannelPipelineConfigurer.emptyConfigurer().- Overrides:
defaultOnChannelInitin classServerTransportConfig<HttpServerConfig>- Returns:
- the default callback if any or
ChannelPipelineConfigurer.emptyConfigurer()
-
loggingHandler
- Overrides:
loggingHandlerin classTransportConfig
-
metricsRecorder
protected void metricsRecorder(@Nullable Supplier<? extends ChannelMetricsRecorder> metricsRecorder) Description copied from class:TransportConfigObtains immediately theChannelMetricsRecorderfrom the providedSupplier.- Overrides:
metricsRecorderin classTransportConfig- Parameters:
metricsRecorder- a supplier for theChannelMetricsRecorder
-