Package reactor.netty.http.client
Class HttpClientConfig
java.lang.Object
reactor.netty.transport.TransportConfig
reactor.netty.transport.ClientTransportConfig<HttpClientConfig>
reactor.netty.http.client.HttpClientConfig
Encapsulate all necessary configuration for HTTP client transport. The public API is read-only.
- Author:
- Stephane Maldini, Violeta Georgieva
-
Method Summary
Modifier and TypeMethodDescription@Nullable String
baseUrl()
Return the configured base URL to use for this request/response or null.protected void
bindAddress
(Supplier<? extends SocketAddress> bindAddressSupplier) int
channelInitializer
(ConnectionObserver connectionObserver, @Nullable SocketAddress remoteAddress, boolean onServer) Return theChannelInitializer
that will be used for initializing the channel pipeline.Return the associatedChannelOperations.OnSetup
, config implementations might override this.channelType
(boolean isDomainSocket) Return the channel type this configuration is associated with, it can be one of the following.Return theConnectionProvider
.Deprecated.as of 1.1.0.Deprecated.as of 1.1.0.decoder()
Return the configured HTTP response decoder options or the default.Provides a globalAddressResolverGroup
fromHttpResources
that is shared amongst all HTTP clients.protected ConnectionObserver
Return the configured defaultConnectionObserver
.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()
.@Nullable BiPredicate<HttpClientRequest,
HttpClientResponse> Return the configured follow redirect predicate or null.headers()
Return a copy of the request headers.@Nullable Http2SettingsSpec
Return the HTTP/2 configuration.@Nullable Http3SettingsSpec
Return the HTTP/3 configuration.boolean
Return whether Brotli compression is enabled.boolean
Return whether GZip compression is enabled.boolean
Return true ifretry once
is disabled, false otherwise.boolean
isSecure()
Returns true if thatHttpClient
secured via SSL transport.protected void
loggingHandler
(LoggingHandler loggingHandler) method()
Return the configured request method.protected void
metricsRecorder
(@Nullable Supplier<? extends ChannelMetricsRecorder> metricsRecorder) Obtains immediately theChannelMetricsRecorder
from the providedSupplier
.Return the HTTP protocol to support.protected void
proxyProvider
(ProxyProvider proxyProvider) protected void
proxyProviderSupplier
(Supplier<ProxyProvider> proxyProviderSupplier) @Nullable BiConsumer<HttpHeaders,
HttpClientRequest> Return the configured redirect requestBiConsumer
or null.@Nullable Consumer<HttpClientRequest>
Return the configured redirect request consumer or null.protected AddressResolverGroup<?>
@Nullable Duration
Return the configured response timeout or null.@Nullable SslProvider
Returns the currentSslProvider
if thatHttpClient
secured via SSL transport or null.@Nullable String
uri()
Return the configured request uri.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.@Nullable WebsocketClientSpec
Return the configured websocket client configuration.Methods inherited from class reactor.netty.transport.ClientTransportConfig
doOnConnect, doOnConnected, doOnDisconnected, eventLoopGroup, getNameResolverProvider, hasProxy, proxyProvider, proxyProviderSupplier, remoteAddress, resolver
Methods inherited from class reactor.netty.transport.TransportConfig
attributes, bindAddress, channelGroup, connectionFactory, connectionObserver, doOnChannelInit, isPreferNative, loggingHandler, loopResources, metricsRecorder, metricsRecorderInternal, options, updateMap
-
Method Details
-
baseUrl
Return the configured base URL to use for this request/response or null.- Returns:
- the configured base URL to use for this request/response or null
-
channelHash
public int channelHash()- Overrides:
channelHash
in classClientTransportConfig<HttpClientConfig>
-
channelOperationsProvider
Description copied from class:TransportConfig
Return the associatedChannelOperations.OnSetup
, config implementations might override this.- Overrides:
channelOperationsProvider
in classTransportConfig
- Returns:
- the associated
ChannelOperations.OnSetup
-
connectionProvider
Description copied from class:ClientTransportConfig
Return theConnectionProvider
.- Overrides:
connectionProvider
in classClientTransportConfig<HttpClientConfig>
- Returns:
- the
ConnectionProvider
-
cookieDecoder
Deprecated.as of 1.1.0. This will be removed in 2.0.0 as Netty 5 supports only strict validation.Return the configuredClientCookieDecoder
or the defaultClientCookieDecoder.STRICT
.- Returns:
- the configured
ClientCookieDecoder
or the defaultClientCookieDecoder.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 configuredClientCookieEncoder
or the defaultClientCookieEncoder.STRICT
.- Returns:
- the configured
ClientCookieEncoder
or the defaultClientCookieEncoder.STRICT
-
decoder
Return the configured HTTP response decoder options or the default.- Returns:
- the configured HTTP request decoder options or the default
-
followRedirectPredicate
Return the configured follow redirect predicate or null.- Returns:
- the configured follow redirect predicate or null
-
headers
Return a copy of the request headers.- Returns:
- a copy of the request headers
-
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
-
isAcceptBrotli
public boolean isAcceptBrotli()Return whether Brotli compression is enabled.- Returns:
- whether Brotli compression is enabled
-
isAcceptGzip
public boolean isAcceptGzip()Return whether GZip compression is enabled.- Returns:
- whether GZip compression is enabled
-
isRetryDisabled
public boolean isRetryDisabled()Return true ifretry once
is disabled, false otherwise.- Returns:
- true if
retry once
is disabled, false otherwise
-
isSecure
public boolean isSecure()Returns true if thatHttpClient
secured via SSL transport.- Returns:
- true if that
HttpClient
secured via SSL transport
-
method
Return the configured request method.- Returns:
- the configured request method
-
protocols
Return the HTTP protocol to support. Default isHttpProtocol.HTTP11
.- Returns:
- the HTTP protocol to support
-
redirectRequestBiConsumer
Return the configured redirect requestBiConsumer
or null.- Returns:
- the configured redirect request
BiConsumer
or null
-
redirectRequestConsumer
Return the configured redirect request consumer or null.- Returns:
- the configured redirect request consumer or null
-
responseTimeout
Return the configured response timeout or null.- Returns:
- the configured response timeout or null
-
sslProvider
Returns the currentSslProvider
if thatHttpClient
secured via SSL transport or null.- Returns:
- the current
SslProvider
if thatHttpClient
secured via SSL transport or null
-
uri
Return the configured request uri.- Returns:
- the configured request uri
-
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
-
websocketClientSpec
Return the configured websocket client configuration.- Returns:
- the configured websocket client configuration
-
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
-
defaultAddressResolverGroup
Provides a globalAddressResolverGroup
fromHttpResources
that is shared amongst all HTTP clients.AddressResolverGroup
uses the globalLoopResources
fromHttpResources
.- Specified by:
defaultAddressResolverGroup
in classClientTransportConfig<HttpClientConfig>
- Returns:
- the global
AddressResolverGroup
-
bindAddress
- Overrides:
bindAddress
in classTransportConfig
-
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 classClientTransportConfig<HttpClientConfig>
- Parameters:
isDomainSocket
- true ifDomainSocketChannel
orServerDomainSocketChannel
is needed, false otherwise- Returns:
- the channel type this configuration is associated with
-
defaultConnectionObserver
Description copied from class:TransportConfig
Return the configured defaultConnectionObserver
.- Overrides:
defaultConnectionObserver
in classClientTransportConfig<HttpClientConfig>
- Returns:
- the configured default
ConnectionObserver
-
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 classClientTransportConfig<HttpClientConfig>
- 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
-
proxyProvider
- Overrides:
proxyProvider
in classClientTransportConfig<HttpClientConfig>
-
proxyProviderSupplier
- Overrides:
proxyProviderSupplier
in classClientTransportConfig<HttpClientConfig>
-
resolverInternal
- Overrides:
resolverInternal
in classClientTransportConfig<HttpClientConfig>
-