- java.lang.Object
-
- io.vertx.core.http.HttpClientConfig
-
- io.vertx.ext.web.client.WebClientConfig
-
- io.vertx.ext.web.client.CachingWebClientConfig
-
public class CachingWebClientConfig extends WebClientConfig
- Author:
- Craig Day
-
-
Field Summary
Fields Modifier and Type Field Description static Set<HttpMethod>DEFAULT_CACHED_METHODSstatic Set<Integer>DEFAULT_CACHED_STATUS_CODES-
Fields inherited from class io.vertx.core.http.HttpClientConfig
DEFAULT_FOLLOW_ALTERNATIVE_SERVICES, 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
Constructors Constructor Description CachingWebClientConfig()CachingWebClientConfig(WebClientConfig other)
-
Method Summary
-
Methods inherited from class io.vertx.ext.web.client.WebClientConfig
getTemplateExpandOptions, getUserAgent, isFollowRedirects, isUserAgentEnabled
-
Methods inherited from class io.vertx.core.http.HttpClientConfig
getDefaultHost, getDefaultPort, getFollowAlternativeServices, getHttp1Config, getHttp2Config, getHttp3Config, getMaxRedirects, getName, getObservabilityConfig, getQuicConfig, getRedirectConfig, getResolverConfig, getTcpConfig, getVersions, isDecompressionEnabled, isShared, isSsl, isVerifyHost, setRedirectConfig, setResolverConfig
-
-
-
-
Field Detail
-
DEFAULT_CACHED_METHODS
public static final Set<HttpMethod> DEFAULT_CACHED_METHODS
-
-
Constructor Detail
-
CachingWebClientConfig
public CachingWebClientConfig()
-
CachingWebClientConfig
public CachingWebClientConfig(WebClientConfig other)
-
-
Method Detail
-
setEnableVaryCaching
public CachingWebClientConfig setEnableVaryCaching(boolean enabled)
Configure the client cache behavior forVaryresponses.- Parameters:
enabled- true to enable caching varying responses- Returns:
- a reference to this, so the API can be used fluently
-
getCachedStatusCodes
public Set<Integer> getCachedStatusCodes()
- Returns:
- the set of status codes to consider cacheable.
-
setCachedStatusCodes
public CachingWebClientConfig setCachedStatusCodes(Set<Integer> codes)
Configure the status codes that can be cached.- Parameters:
codes- the cacheable status code numbers- Returns:
- a reference to this, so the API can be used fluently
-
addCachedStatusCode
public CachingWebClientConfig addCachedStatusCode(Integer code)
Add a status code that is cacheable.- Parameters:
code- the additional code number- Returns:
- a reference to this, so the API can be used fluently
-
removeCachedStatusCode
public CachingWebClientConfig removeCachedStatusCode(Integer code)
Remove a status code that is cacheable.- Parameters:
code- the code number to remove- Returns:
- a reference to this, so the API can be used fluently
-
getCachedMethods
public Set<HttpMethod> getCachedMethods()
- Returns:
- the set of HTTP methods to consider cacheable.
-
setCachedMethods
public CachingWebClientConfig setCachedMethods(Set<HttpMethod> methods)
Configure the HTTP methods that can be cached.- Parameters:
methods- the HTTP methods to cache- Returns:
- a reference to this, so the API can be used fluently
-
addCachedMethod
public CachingWebClientConfig addCachedMethod(HttpMethod method)
Add an HTTP method that is cacheable.- Parameters:
method- the method to add- Returns:
- a reference to this, so the API can be used fluently
-
removeCachedMethod
public CachingWebClientConfig removeCachedMethod(HttpMethod method)
Remove an HTTP method that is cacheable.- Parameters:
method- the method to remove- Returns:
- a reference to this, so the API can be used fluently
-
isVaryCachingEnabled
public boolean isVaryCachingEnabled()
- Returns:
- true if the client will cache responses with the
Varyheader, false otherwise
-
setUserAgentEnabled
public CachingWebClientConfig setUserAgentEnabled(boolean userAgentEnabled)
Description copied from class:WebClientConfigSets whether the Web Client should send a user agent header. Defaults to true.- Overrides:
setUserAgentEnabledin classWebClientConfig- Parameters:
userAgentEnabled- true to send a user agent header, false otherwise- Returns:
- a reference to this, so the API can be used fluently
-
setUserAgent
public CachingWebClientConfig setUserAgent(String userAgent)
Description copied from class:WebClientConfigSets the Web Client user agent header. Defaults to Vert.x-WebClient/<version>.- Overrides:
setUserAgentin classWebClientConfig- Parameters:
userAgent- user agent header value- Returns:
- a reference to this, so the API can be used fluently
-
setFollowRedirects
public CachingWebClientConfig setFollowRedirects(boolean followRedirects)
Description copied from class:WebClientConfigConfigure the default behavior of the client to follow HTTP30xredirections.- Overrides:
setFollowRedirectsin classWebClientConfig- Parameters:
followRedirects- true when a redirect is followed- Returns:
- a reference to this, so the API can be used fluently
-
setTemplateExpandOptions
public CachingWebClientConfig setTemplateExpandOptions(ExpandOptions templateExpandOptions)
- Overrides:
setTemplateExpandOptionsin classWebClientConfig
-
setConnectTimeout
public CachingWebClientConfig setConnectTimeout(Duration connectTimeout)
- Overrides:
setConnectTimeoutin classWebClientConfig
-
setIdleTimeout
public CachingWebClientConfig setIdleTimeout(Duration idleTimeout)
- Overrides:
setIdleTimeoutin classWebClientConfig
-
setReadIdleTimeout
public CachingWebClientConfig setReadIdleTimeout(Duration idleTimeout)
- Overrides:
setReadIdleTimeoutin classWebClientConfig
-
setWriteIdleTimeout
public CachingWebClientConfig setWriteIdleTimeout(Duration idleTimeout)
- Overrides:
setWriteIdleTimeoutin classWebClientConfig
-
setLogConfig
public CachingWebClientConfig setLogConfig(LogConfig config)
- Overrides:
setLogConfigin classWebClientConfig
-
setSsl
public CachingWebClientConfig setSsl(boolean ssl)
- Overrides:
setSslin classWebClientConfig
-
setVersions
public CachingWebClientConfig setVersions(List<HttpVersion> versions)
- Overrides:
setVersionsin classWebClientConfig
-
setHttp1Config
public CachingWebClientConfig setHttp1Config(Http1ClientConfig config)
- Overrides:
setHttp1Configin classWebClientConfig
-
setHttp2Config
public CachingWebClientConfig setHttp2Config(Http2ClientConfig config)
- Overrides:
setHttp2Configin classWebClientConfig
-
setHttp3Config
public CachingWebClientConfig setHttp3Config(Http3ClientConfig config)
- Overrides:
setHttp3Configin classWebClientConfig
-
setVerifyHost
public CachingWebClientConfig setVerifyHost(boolean verifyHost)
- Overrides:
setVerifyHostin classWebClientConfig
-
setDecompressionEnabled
public CachingWebClientConfig setDecompressionEnabled(boolean decompressionEnabled)
- Overrides:
setDecompressionEnabledin classWebClientConfig
-
setDefaultHost
public CachingWebClientConfig setDefaultHost(String defaultHost)
- Overrides:
setDefaultHostin classWebClientConfig
-
setDefaultPort
public CachingWebClientConfig setDefaultPort(int defaultPort)
- Overrides:
setDefaultPortin classWebClientConfig
-
setMaxRedirects
public CachingWebClientConfig setMaxRedirects(int maxRedirects)
- Overrides:
setMaxRedirectsin classWebClientConfig
-
setObservabilityConfig
public CachingWebClientConfig setObservabilityConfig(ObservabilityConfig observabilityConfig)
- Overrides:
setObservabilityConfigin classWebClientConfig
-
setVersions
public CachingWebClientConfig setVersions(HttpVersion... versions)
- Overrides:
setVersionsin classWebClientConfig
-
setKeepAliveTimeout
public CachingWebClientConfig setKeepAliveTimeout(Duration keepAliveTimeout)
- Overrides:
setKeepAliveTimeoutin classWebClientConfig
-
setShared
public CachingWebClientConfig setShared(boolean shared)
- Overrides:
setSharedin classWebClientConfig
-
setName
public CachingWebClientConfig setName(String name)
- Overrides:
setNamein classWebClientConfig
-
setFollowAlternativeServices
public CachingWebClientConfig setFollowAlternativeServices(boolean followAlternativeServices)
- Overrides:
setFollowAlternativeServicesin classWebClientConfig
-
-