public final class HttpClientConfig extends ClientTransportConfig<HttpClientConfig>
Modifier and Type | Method and Description |
---|---|
String |
baseUrl()
Return the configured base URL to use for this request/response or null.
|
protected void |
bindAddress(Supplier<? extends SocketAddress> bindAddressSupplier) |
int |
channelHash() |
ChannelInitializer<Channel> |
channelInitializer(ConnectionObserver connectionObserver,
SocketAddress remoteAddress,
boolean onServer)
Return the
ChannelInitializer that will be used for initializing the channel pipeline. |
ChannelOperations.OnSetup |
channelOperationsProvider()
Return the associated
ChannelOperations.OnSetup , config implementations might override this. |
protected Class<? extends Channel> |
channelType(boolean isDomainSocket)
Return the channel type this configuration is associated with, it can be one of the following.
|
ConnectionProvider |
connectionProvider()
Return the
ConnectionProvider . |
ClientCookieDecoder |
cookieDecoder()
Deprecated.
as of 1.1.0. This will be removed in 2.0.0 as Netty 5 supports only strict validation.
|
ClientCookieEncoder |
cookieEncoder()
Deprecated.
as of 1.1.0. This will be removed in 2.0.0 as Netty 5 supports only strict validation.
|
HttpResponseDecoderSpec |
decoder()
Return the configured HTTP response decoder options or the default.
|
AddressResolverGroup<?> |
defaultAddressResolverGroup()
Provides a global
AddressResolverGroup from HttpResources
that is shared amongst all HTTP clients. |
protected ConnectionObserver |
defaultConnectionObserver()
Return the configured default
ConnectionObserver . |
protected LoggingHandler |
defaultLoggingHandler()
Return the default
LoggingHandler to wiretap this transport. |
protected LoopResources |
defaultLoopResources()
Return the default
LoopResources for this transport. |
protected ChannelMetricsRecorder |
defaultMetricsRecorder()
Return the configured metrics recorder.
|
protected ChannelPipelineConfigurer |
defaultOnChannelInit()
Return the default callback if any or
ChannelPipelineConfigurer.emptyConfigurer() . |
BiPredicate<HttpClientRequest,HttpClientResponse> |
followRedirectPredicate()
Return the configured follow redirect predicate or null.
|
HttpHeaders |
headers()
Return a copy of the request headers.
|
Http2SettingsSpec |
http2SettingsSpec()
Return the HTTP/2 configuration.
|
Http3SettingsSpec |
http3SettingsSpec()
Return the HTTP/3 configuration.
|
boolean |
isAcceptBrotli()
Return whether Brotli compression is enabled.
|
boolean |
isAcceptGzip()
Return whether GZip compression is enabled.
|
boolean |
isRetryDisabled()
Return true if
retry once is disabled, false otherwise. |
boolean |
isSecure()
Returns true if that
HttpClient secured via SSL transport. |
protected void |
loggingHandler(LoggingHandler loggingHandler) |
HttpMethod |
method()
Return the configured request method.
|
protected void |
metricsRecorder(Supplier<? extends ChannelMetricsRecorder> metricsRecorder)
Obtains immediately the
ChannelMetricsRecorder from the provided Supplier . |
HttpProtocol[] |
protocols()
Return the HTTP protocol to support.
|
protected void |
proxyProvider(ProxyProvider proxyProvider) |
BiConsumer<HttpHeaders,HttpClientRequest> |
redirectRequestBiConsumer()
Return the configured redirect request
BiConsumer or null. |
Consumer<HttpClientRequest> |
redirectRequestConsumer()
Return the configured redirect request consumer or null.
|
protected AddressResolverGroup<?> |
resolverInternal() |
Duration |
responseTimeout()
Return the configured response timeout or null.
|
SslProvider |
sslProvider()
Returns the current
SslProvider if that HttpClient secured via SSL
transport or null. |
String |
uri()
Return the configured request uri.
|
Function<String,String> |
uriTagValue()
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 |
websocketClientSpec()
Return the configured websocket client configuration.
|
doOnConnect, doOnConnected, doOnDisconnected, eventLoopGroup, getNameResolverProvider, hasProxy, proxyProvider, remoteAddress, resolver
attributes, bindAddress, channelGroup, connectionFactory, connectionObserver, doOnChannelInit, isPreferNative, loggingHandler, loopResources, metricsRecorder, metricsRecorderInternal, options, updateMap
@Nullable public String baseUrl()
public int channelHash()
channelHash
in class ClientTransportConfig<HttpClientConfig>
public ChannelOperations.OnSetup channelOperationsProvider()
TransportConfig
ChannelOperations.OnSetup
, config implementations might override this.channelOperationsProvider
in class TransportConfig
ChannelOperations.OnSetup
public ConnectionProvider connectionProvider()
ClientTransportConfig
ConnectionProvider
.connectionProvider
in class ClientTransportConfig<HttpClientConfig>
ConnectionProvider
@Deprecated public ClientCookieDecoder cookieDecoder()
ClientCookieDecoder
or the default ClientCookieDecoder.STRICT
.ClientCookieDecoder
or the default ClientCookieDecoder.STRICT
@Deprecated public ClientCookieEncoder cookieEncoder()
ClientCookieEncoder
or the default ClientCookieEncoder.STRICT
.ClientCookieEncoder
or the default ClientCookieEncoder.STRICT
public HttpResponseDecoderSpec decoder()
@Nullable public BiPredicate<HttpClientRequest,HttpClientResponse> followRedirectPredicate()
public HttpHeaders headers()
public Http2SettingsSpec http2SettingsSpec()
@Incubating @Nullable public Http3SettingsSpec http3SettingsSpec()
public boolean isAcceptBrotli()
public boolean isAcceptGzip()
public boolean isRetryDisabled()
retry once
is disabled, false otherwise.retry once
is disabled, false otherwisepublic boolean isSecure()
HttpClient
secured via SSL transport.HttpClient
secured via SSL transportpublic HttpMethod method()
public HttpProtocol[] protocols()
HttpProtocol.HTTP11
.@Nullable public BiConsumer<HttpHeaders,HttpClientRequest> redirectRequestBiConsumer()
BiConsumer
or null.BiConsumer
or null@Nullable public Consumer<HttpClientRequest> redirectRequestConsumer()
@Nullable public Duration responseTimeout()
@Nullable public SslProvider sslProvider()
SslProvider
if that HttpClient
secured via SSL
transport or null.SslProvider
if that HttpClient
secured via SSL
transport or nullpublic String uri()
@Nullable public Function<String,String> uriTagValue()
Metrics.URI
tag.Metrics.URI
tagpublic WebsocketClientSpec websocketClientSpec()
public ChannelInitializer<Channel> channelInitializer(ConnectionObserver connectionObserver, @Nullable SocketAddress remoteAddress, boolean onServer)
TransportConfig
ChannelInitializer
that will be used for initializing the channel pipeline.channelInitializer
in class TransportConfig
connectionObserver
- the configured ConnectionObserver
remoteAddress
- the remote addressonServer
- channel initializer for the server or for the clientChannelInitializer
that will be used for initializing the channel pipelinepublic AddressResolverGroup<?> defaultAddressResolverGroup()
AddressResolverGroup
from HttpResources
that is shared amongst all HTTP clients. AddressResolverGroup
uses the global
LoopResources
from HttpResources
.defaultAddressResolverGroup
in class ClientTransportConfig<HttpClientConfig>
AddressResolverGroup
protected void bindAddress(Supplier<? extends SocketAddress> bindAddressSupplier)
bindAddress
in class TransportConfig
protected Class<? extends Channel> channelType(boolean isDomainSocket)
TransportConfig
channelType
in class ClientTransportConfig<HttpClientConfig>
isDomainSocket
- true if DomainSocketChannel
or
ServerDomainSocketChannel
is needed, false otherwiseprotected ConnectionObserver defaultConnectionObserver()
TransportConfig
ConnectionObserver
.defaultConnectionObserver
in class ClientTransportConfig<HttpClientConfig>
ConnectionObserver
protected LoggingHandler defaultLoggingHandler()
TransportConfig
LoggingHandler
to wiretap this transport.defaultLoggingHandler
in class TransportConfig
LoggingHandler
to wiretap this transportprotected LoopResources defaultLoopResources()
TransportConfig
LoopResources
for this transport.defaultLoopResources
in class TransportConfig
LoopResources
for this transportprotected ChannelMetricsRecorder defaultMetricsRecorder()
TransportConfig
defaultMetricsRecorder
in class TransportConfig
protected ChannelPipelineConfigurer defaultOnChannelInit()
TransportConfig
ChannelPipelineConfigurer.emptyConfigurer()
.defaultOnChannelInit
in class ClientTransportConfig<HttpClientConfig>
ChannelPipelineConfigurer.emptyConfigurer()
protected void loggingHandler(LoggingHandler loggingHandler)
loggingHandler
in class TransportConfig
protected void metricsRecorder(@Nullable Supplier<? extends ChannelMetricsRecorder> metricsRecorder)
TransportConfig
ChannelMetricsRecorder
from the provided Supplier
.metricsRecorder
in class TransportConfig
metricsRecorder
- a supplier for the ChannelMetricsRecorder
protected void proxyProvider(ProxyProvider proxyProvider)
proxyProvider
in class ClientTransportConfig<HttpClientConfig>
protected AddressResolverGroup<?> resolverInternal()
resolverInternal
in class ClientTransportConfig<HttpClientConfig>