Class WebClientConfig
- Direct Known Subclasses:
CachingWebClientConfig
- Author:
- Thomas Segismont
-
Field Summary
Fields inherited from class HttpClientConfig
DEFAULT_QUIC_INITIAL_MAX_DATA, DEFAULT_QUIC_INITIAL_MAX_STREAM_BIDI, DEFAULT_QUIC_INITIAL_MAX_STREAM_DATA_BIDI_LOCAL, DEFAULT_QUIC_INITIAL_MAX_STREAM_DATA_BIDI_REMOTE, DEFAULT_QUIC_INITIAL_MAX_STREAM_DATA_UNI, DEFAULT_QUIC_INITIAL_MAX_STREAM_UNI, DEFAULT_SUPPORTED_VERSIONS -
Constructor Summary
ConstructorsConstructorDescriptionWebClientConfig(HttpClientConfig other) Copy constructor.WebClientConfig(WebClientConfig other) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleansetConnectTimeout(Duration connectTimeout) Set the connect timeoutsetDecompressionEnabled(boolean decompressionEnabled) Whether the client should send requests with anaccepting-encodingheader set to a compression algorithm.setDefaultHost(String defaultHost) Set the default host name to be used by this client in requests if none is provided when making the request.setDefaultPort(int defaultPort) Set the default port to be used by this client in requests if none is provided when making the request.setFollowAlternativeServices(boolean followAlternativeServices) Configure whether the client follows alternative services advertisements, the default setting does not.setFollowRedirects(boolean followRedirects) Configure the default behavior of the client to follow HTTP30xredirections.setHttp1Config(Http1ClientConfig config) Set the HTTP/1.x configuration to usesetHttp2Config(Http2ClientConfig config) Set the HTTP/2 configuration to usesetHttp3Config(Http3ClientConfig config) Set the HTTP/2 configuration to usesetIdleTimeout(Duration idleTimeout) Set the idle timeout, zero ornullmeans don't time out.setKeepAliveTimeout(Duration keepAliveTimeout) Set the keep alive timeout for HTTP connections.setLogConfig(LogConfig config) Configure the per stream networking logging: Netty's stream pipeline is configured for logging on Netty's logger.setMaxRedirects(int maxRedirects) Set tomaxRedirectsthe maximum number of redirection a request can follow.Set the client name, used when the client is shared, otherwise ignored.setObservabilityConfig(ObservabilityConfig observabilityConfig) Set the client observability config.setReadIdleTimeout(Duration idleTimeout) Set the read idle timeout, zero ornullmeans or null means don't time out.setShared(boolean shared) Set totrueto share the client.setSsl(boolean ssl) Set whether SSL/TLS is enabledsetTemplateExpandOptions(ExpandOptions templateExpandOptions) setUserAgent(String userAgent) Sets the Web Client user agent header.setUserAgentEnabled(boolean userAgentEnabled) Sets whether the Web Client should send a user agent header.setVerifyHost(boolean verifyHost) Set whether hostname verification is enabledsetVersions(HttpVersion... versions) LikeHttpClientConfig.setVersions(List)using an array.setVersions(List<HttpVersion> versions) Set the list ofHttpVersionsupported by the client, the first element of the list is considered as the default protocol to choose when none is specified at the request level.setWriteIdleTimeout(Duration idleTimeout) Set the write idle timeout, zero ornullmeans don't time out.Methods inherited from class HttpClientConfig
getDefaultHost, getDefaultPort, getFollowAlternativeServices, getHttp1Config, getHttp2Config, getHttp3Config, getMaxRedirects, getName, getObservabilityConfig, getQuicConfig, getTcpConfig, getVersions, isDecompressionEnabled, isShared, isSsl, isVerifyHost
-
Constructor Details
-
WebClientConfig
public WebClientConfig() -
WebClientConfig
Copy constructor.- Parameters:
other- the options to copy
-
WebClientConfig
Copy constructor.- Parameters:
other- the options to copy
-
-
Method Details
-
isUserAgentEnabled
public boolean isUserAgentEnabled()- Returns:
- true if the Web Client should send a user agent header, false otherwise
-
setUserAgentEnabled
Sets whether the Web Client should send a user agent header. Defaults to true.- Parameters:
userAgentEnabled- true to send a user agent header, false otherwise- Returns:
- a reference to this, so the API can be used fluently
-
getUserAgent
- Returns:
- the user agent header string
-
setUserAgent
Sets the Web Client user agent header. Defaults to Vert.x-WebClient/<version>.- Parameters:
userAgent- user agent header value- Returns:
- a reference to this, so the API can be used fluently
-
isFollowRedirects
public boolean isFollowRedirects()- Returns:
- the default behavior of the client for following HTTP
30xredirections
-
setFollowRedirects
Configure the default behavior of the client to follow HTTP30xredirections.- Parameters:
followRedirects- true when a redirect is followed- Returns:
- a reference to this, so the API can be used fluently
-
getTemplateExpandOptions
-
setTemplateExpandOptions
-
setKeepAliveTimeout
Description copied from class:HttpClientConfigSet the keep alive timeout for HTTP connections. This value determines how long a connection remains unused in the pool before being evicted and closed. A timeout of zero or
nullmeans there is no timeout.This configures each HTTP version with the same value, you can override this and configure each version separately.
- Overrides:
setKeepAliveTimeoutin classHttpClientConfig- Parameters:
keepAliveTimeout- the timeout, in seconds- Returns:
- a reference to this, so the API can be used fluently
-
setVersions
Description copied from class:HttpClientConfigLikeHttpClientConfig.setVersions(List)using an array.- Overrides:
setVersionsin classHttpClientConfig- Parameters:
versions- the ordered list of supported versions- Returns:
- a reference to this, so the API can be used fluently
-
setConnectTimeout
Description copied from class:HttpClientConfigSet the connect timeout- Overrides:
setConnectTimeoutin classHttpClientConfig- Parameters:
connectTimeout- connect timeout, in ms- Returns:
- a reference to this, so the API can be used fluently
-
setIdleTimeout
Description copied from class:HttpClientConfigSet the idle timeout, zero ornullmeans don't time out. This determines if a connection will timeout and be closed if no data is received nor sent within the timeout.This configures both TCP and QUIC nested configurations, you can configure each of them separately if you need to.
- Overrides:
setIdleTimeoutin classHttpClientConfig- Parameters:
idleTimeout- the timeout- Returns:
- a reference to this, so the API can be used fluently
-
setReadIdleTimeout
Description copied from class:HttpClientConfigSet the read idle timeout, zero or
nullmeans or null means don't time out. This determines if a connection will timeout and be closed if no data is received within the timeout.This configures both TCP and QUIC nested configurations, you can configure each of them separately if you need to.
- Overrides:
setReadIdleTimeoutin classHttpClientConfig- Parameters:
idleTimeout- the read timeout- Returns:
- a reference to this, so the API can be used fluently
-
setWriteIdleTimeout
Description copied from class:HttpClientConfigSet the write idle timeout, zero or
nullmeans don't time out. This determines if a connection will timeout and be closed if no data is sent within the timeout.This configures both TCP and QUIC nested configurations, you can configure each of them separately if you need to.
- Overrides:
setWriteIdleTimeoutin classHttpClientConfig- Parameters:
idleTimeout- the write timeout- Returns:
- a reference to this, so the API can be used fluently
-
setLogConfig
Description copied from class:HttpClientConfigConfigure the per stream networking logging: Netty's stream pipeline is configured for logging on Netty's logger.
This configures both TCP and QUIC nested configurations, you can configure each of them separately if you need to.
- Overrides:
setLogConfigin classHttpClientConfig- Parameters:
config- the stream network logging config,nullmeans disabled- Returns:
- a reference to this, so the API can be used fluently
-
setSsl
Description copied from class:HttpClientConfigSet whether SSL/TLS is enabled- Overrides:
setSslin classHttpClientConfig- Parameters:
ssl- true if enabled- Returns:
- a reference to this, so the API can be used fluently
-
setVersions
Description copied from class:HttpClientConfigSet the list of
HttpVersionsupported by the client, the first element of the list is considered as the default protocol to choose when none is specified at the request level.- Overrides:
setVersionsin classHttpClientConfig- Parameters:
versions- the ordered list of supported versions- Returns:
- a reference to this, so the API can be used fluently
-
setHttp1Config
Description copied from class:HttpClientConfigSet the HTTP/1.x configuration to use- Overrides:
setHttp1Configin classHttpClientConfig- Parameters:
config- the config- Returns:
- a reference to this, so the API can be used fluently
-
setHttp2Config
Description copied from class:HttpClientConfigSet the HTTP/2 configuration to use- Overrides:
setHttp2Configin classHttpClientConfig- Parameters:
config- the config- Returns:
- a reference to this, so the API can be used fluently
-
setHttp3Config
Description copied from class:HttpClientConfigSet the HTTP/2 configuration to use- Overrides:
setHttp3Configin classHttpClientConfig- Parameters:
config- the config- Returns:
- a reference to this, so the API can be used fluently
-
setVerifyHost
Description copied from class:HttpClientConfigSet whether hostname verification is enabled- Overrides:
setVerifyHostin classHttpClientConfig- Parameters:
verifyHost-trueif enabled- Returns:
- a reference to this, so the API can be used fluently
-
setDecompressionEnabled
Description copied from class:HttpClientConfigWhether the client should send requests with anaccepting-encodingheader set to a compression algorithm.- Overrides:
setDecompressionEnabledin classHttpClientConfig- Parameters:
decompressionEnabled-trueif the client should send a request with anaccepting-encodingheader set to a compression algorithm,falseotherwise- Returns:
- a reference to this, so the API can be used fluently
-
setDefaultHost
Description copied from class:HttpClientConfigSet the default host name to be used by this client in requests if none is provided when making the request.- Overrides:
setDefaultHostin classHttpClientConfig- Returns:
- a reference to this, so the API can be used fluently
-
setDefaultPort
Description copied from class:HttpClientConfigSet the default port to be used by this client in requests if none is provided when making the request.- Overrides:
setDefaultPortin classHttpClientConfig- Returns:
- a reference to this, so the API can be used fluently
-
setMaxRedirects
Description copied from class:HttpClientConfigSet tomaxRedirectsthe maximum number of redirection a request can follow.- Overrides:
setMaxRedirectsin classHttpClientConfig- Parameters:
maxRedirects- the maximum number of redirection- Returns:
- a reference to this, so the API can be used fluently
-
setObservabilityConfig
Description copied from class:HttpClientConfigSet the client observability config.- Overrides:
setObservabilityConfigin classHttpClientConfig- Parameters:
observabilityConfig- the server observability config- Returns:
- a reference to this, so the API can be used fluently
-
setName
Description copied from class:HttpClientConfigSet the client name, used when the client is shared, otherwise ignored.- Overrides:
setNamein classHttpClientConfig- Parameters:
name- the new name- Returns:
- a reference to this, so the API can be used fluently
-
setFollowAlternativeServices
Description copied from class:HttpClientConfigConfigure whether the client follows alternative services advertisements, the default setting does not.
Setting this to true, instructs the client to use most appropriate alternative services advertised by HTTP servers.
The client only follows alternative services it can trust for a given origin, in practice this means this only the
httpsscheme is supported and alternatives handshake uses the alternative origin.- Overrides:
setFollowAlternativeServicesin classHttpClientConfig- Parameters:
followAlternativeServices- the config value
-