Class CachingWebClientOptions

    • Field Detail

      • DEFAULT_CACHED_STATUS_CODES

        public static final Set<Integer> DEFAULT_CACHED_STATUS_CODES
      • DEFAULT_CACHED_METHODS

        public static final Set<HttpMethod> DEFAULT_CACHED_METHODS
    • Constructor Detail

      • CachingWebClientOptions

        public CachingWebClientOptions()
      • CachingWebClientOptions

        public CachingWebClientOptions​(boolean enableVaryCaching)
      • CachingWebClientOptions

        public CachingWebClientOptions​(WebClientOptions other)
      • CachingWebClientOptions

        public CachingWebClientOptions​(JsonObject json)
    • Method Detail

      • setEnableVaryCaching

        public CachingWebClientOptions setEnableVaryCaching​(boolean enabled)
        Configure the client cache behavior for Vary responses.
        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 CachingWebClientOptions 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 CachingWebClientOptions 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 CachingWebClientOptions 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 CachingWebClientOptions 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 CachingWebClientOptions 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 CachingWebClientOptions 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 Vary header, false otherwise
      • setUserAgentEnabled

        public CachingWebClientOptions setUserAgentEnabled​(boolean userAgentEnabled)
        Description copied from class: WebClientOptions
        Sets whether the Web Client should send a user agent header. Defaults to true.
        Overrides:
        setUserAgentEnabled in class WebClientOptions
        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 CachingWebClientOptions setUserAgent​(String userAgent)
        Description copied from class: WebClientOptions
        Sets the Web Client user agent header. Defaults to Vert.x-WebClient/<version>.
        Overrides:
        setUserAgent in class WebClientOptions
        Parameters:
        userAgent - user agent header value
        Returns:
        a reference to this, so the API can be used fluently
      • setFollowRedirects

        public CachingWebClientOptions setFollowRedirects​(boolean followRedirects)
        Description copied from class: WebClientOptions
        Configure the default behavior of the client to follow HTTP 30x redirections.
        Overrides:
        setFollowRedirects in class WebClientOptions
        Parameters:
        followRedirects - true when a redirect is followed
        Returns:
        a reference to this, so the API can be used fluently
      • setMaxRedirects

        public CachingWebClientOptions setMaxRedirects​(int maxRedirects)
        Description copied from class: HttpClientOptions
        Set to maxRedirects the maximum number of redirection a request can follow.
        Overrides:
        setMaxRedirects in class WebClientOptions
        Parameters:
        maxRedirects - the maximum number of redirection
        Returns:
        a reference to this, so the API can be used fluently
      • setReuseAddress

        public CachingWebClientOptions setReuseAddress​(boolean reuseAddress)
        Description copied from class: NetworkOptions
        Set the value of reuse address
        Overrides:
        setReuseAddress in class WebClientOptions
        Parameters:
        reuseAddress - the value of reuse address
        Returns:
        a reference to this, so the API can be used fluently
      • setTcpNoDelay

        public CachingWebClientOptions setTcpNoDelay​(boolean tcpNoDelay)
        Description copied from class: TCPSSLOptions
        Set whether TCP no delay is enabled
        Overrides:
        setTcpNoDelay in class WebClientOptions
        Parameters:
        tcpNoDelay - true if TCP no delay is enabled (Nagle disabled)
        Returns:
        a reference to this, so the API can be used fluently
      • setTcpKeepAlive

        public CachingWebClientOptions setTcpKeepAlive​(boolean tcpKeepAlive)
        Description copied from class: TCPSSLOptions
        Set whether TCP keep alive is enabled
        Overrides:
        setTcpKeepAlive in class WebClientOptions
        Parameters:
        tcpKeepAlive - true if TCP keep alive is enabled
        Returns:
        a reference to this, so the API can be used fluently
      • setSoLinger

        public CachingWebClientOptions setSoLinger​(int soLinger)
        Description copied from class: TCPSSLOptions
        Set whether SO_linger keep alive is enabled
        Overrides:
        setSoLinger in class WebClientOptions
        Parameters:
        soLinger - true if SO_linger is enabled
        Returns:
        a reference to this, so the API can be used fluently
      • setIdleTimeout

        public CachingWebClientOptions setIdleTimeout​(int idleTimeout)
        Description copied from class: TCPSSLOptions
        Set the idle timeout, default time unit is seconds. Zero means don't timeout. This determines if a connection will timeout and be closed if no data is received nor sent within the timeout. If you want change default time unit, use TCPSSLOptions.setIdleTimeoutUnit(TimeUnit)
        Overrides:
        setIdleTimeout in class WebClientOptions
        Parameters:
        idleTimeout - the timeout
        Returns:
        a reference to this, so the API can be used fluently
      • setTrustAll

        public CachingWebClientOptions setTrustAll​(boolean trustAll)
        Description copied from class: ClientOptionsBase
        Set whether all server certificates should be trusted
        Overrides:
        setTrustAll in class WebClientOptions
        Parameters:
        trustAll - true if all should be trusted
        Returns:
        a reference to this, so the API can be used fluently
      • setHttp2MultiplexingLimit

        public CachingWebClientOptions setHttp2MultiplexingLimit​(int limit)
        Description copied from class: HttpClientOptions
        Set a client limit of the number concurrent streams for each HTTP/2 connection, this limits the number of streams the client can create for a connection. The effective number of streams for a connection is the min of this value and the server's initial settings.

        Setting the value to -1 means to use the value sent by the server's initial settings. -1 is the default value.

        Overrides:
        setHttp2MultiplexingLimit in class WebClientOptions
        Parameters:
        limit - the maximum concurrent for an HTTP/2 connection
        Returns:
        a reference to this, so the API can be used fluently
      • setHttp2ConnectionWindowSize

        public CachingWebClientOptions setHttp2ConnectionWindowSize​(int http2ConnectionWindowSize)
        Description copied from class: HttpClientOptions
        Set the default HTTP/2 connection window size. It overrides the initial window size set by Http2Settings.getInitialWindowSize(), so the connection window size is greater than for its streams, in order the data throughput.

        A value of -1 reuses the initial window size setting.

        Overrides:
        setHttp2ConnectionWindowSize in class WebClientOptions
        Parameters:
        http2ConnectionWindowSize - the window size applied to the connection
        Returns:
        a reference to this, so the API can be used fluently
      • setPipeliningLimit

        public CachingWebClientOptions setPipeliningLimit​(int limit)
        Description copied from class: HttpClientOptions
        Set the limit of pending requests a pipe-lined HTTP/1 connection can send.
        Overrides:
        setPipeliningLimit in class WebClientOptions
        Parameters:
        limit - the limit of pending requests
        Returns:
        a reference to this, so the API can be used fluently
      • setDecompressionSupported

        public CachingWebClientOptions setDecompressionSupported​(boolean tryUseCompression)
        Description copied from class: HttpClientOptions
        Whether the client should send requests with an accepting-encoding header set to a compression algorithm.
        Overrides:
        setDecompressionSupported in class WebClientOptions
        Parameters:
        tryUseCompression - true if the client should send a request with an accepting-encoding header set to a compression algorithm, false otherwise
        Returns:
        a reference to this, so the API can be used fluently
      • setDefaultPort

        public CachingWebClientOptions setDefaultPort​(int defaultPort)
        Description copied from class: HttpClientOptions
        Set the default port to be used by this client in requests if none is provided when making the request.
        Overrides:
        setDefaultPort in class WebClientOptions
        Returns:
        a reference to this, so the API can be used fluently
      • setMaxHeaderSize

        public CachingWebClientOptions setMaxHeaderSize​(int maxHeaderSize)
        Description copied from class: HttpClientOptions
        Set the maximum length of all headers for HTTP/1.x .
        Overrides:
        setMaxHeaderSize in class WebClientOptions
        Parameters:
        maxHeaderSize - the new maximum length
        Returns:
        a reference to this, so the API can be used fluently
      • setHttp2ClearTextUpgrade

        public CachingWebClientOptions setHttp2ClearTextUpgrade​(boolean value)
        Description copied from class: HttpClientOptions
        Set to true when an h2c connection is established using an HTTP/1.1 upgrade request, and false when an h2c connection is established directly (with prior knowledge).
        Overrides:
        setHttp2ClearTextUpgrade in class WebClientOptions
        Parameters:
        value - the upgrade value
        Returns:
        a reference to this, so the API can be used fluently
      • setMetricsName

        public CachingWebClientOptions setMetricsName​(String metricsName)
        Description copied from class: ClientOptionsBase
        Set the metrics name identifying the reported metrics, useful for grouping metrics with the same name.
        Overrides:
        setMetricsName in class WebClientOptions
        Parameters:
        metricsName - the metrics name
        Returns:
        a reference to this, so the API can be used fluently
      • setLocalAddress

        public CachingWebClientOptions setLocalAddress​(String localAddress)
        Description copied from class: ClientOptionsBase
        Set the local interface to bind for network connections. When the local address is null, it will pick any local address, the default local address is null.
        Overrides:
        setLocalAddress in class WebClientOptions
        Parameters:
        localAddress - the local address
        Returns:
        a reference to this, so the API can be used fluently
      • setLogActivity

        public CachingWebClientOptions setLogActivity​(boolean logEnabled)
        Description copied from class: NetworkOptions
        Set to true to enabled network activity logging: Netty's pipeline is configured for logging on Netty's logger.
        Overrides:
        setLogActivity in class WebClientOptions
        Parameters:
        logEnabled - true for logging the network activity
        Returns:
        a reference to this, so the API can be used fluently
      • setReusePort

        public CachingWebClientOptions setReusePort​(boolean reusePort)
        Description copied from class: NetworkOptions
        Set the value of reuse port.

        This is only supported by native transports.

        Overrides:
        setReusePort in class WebClientOptions
        Parameters:
        reusePort - the value of reuse port
        Returns:
        a reference to this, so the API can be used fluently
      • setHttp2KeepAliveTimeout

        public CachingWebClientOptions setHttp2KeepAliveTimeout​(int keepAliveTimeout)
        Description copied from class: HttpClientOptions
        Set the keep alive timeout for HTTP/2 connections, in seconds.

        This value determines how long a connection remains unused in the pool before being evicted and closed.

        A timeout of 0 means there is no timeout.

        Overrides:
        setHttp2KeepAliveTimeout in class WebClientOptions
        Parameters:
        keepAliveTimeout - the timeout, in seconds
        Returns:
        a reference to this, so the API can be used fluently
      • setForceSni

        public CachingWebClientOptions setForceSni​(boolean forceSni)
        Description copied from class: HttpClientOptions
        By default, the server name is only sent for Fully Qualified Domain Name (FQDN), setting this property to true forces the server name to be always sent.
        Overrides:
        setForceSni in class WebClientOptions
        Parameters:
        forceSni - true when the client should always use SNI on TLS/SSL connections
        Returns:
        a reference to this, so the API can be used fluently
      • setDecoderInitialBufferSize

        public CachingWebClientOptions setDecoderInitialBufferSize​(int decoderInitialBufferSize)
        Description copied from class: HttpClientOptions
        set to initialBufferSizeHttpDecoder the initial buffer of the HttpDecoder.
        Overrides:
        setDecoderInitialBufferSize in class WebClientOptions
        Parameters:
        decoderInitialBufferSize - the initial buffer size
        Returns:
        a reference to this, so the API can be used fluently
      • setKeepAliveTimeout

        public CachingWebClientOptions setKeepAliveTimeout​(int keepAliveTimeout)
        Description copied from class: HttpClientOptions
        Set the keep alive timeout for HTTP/1.x, in seconds.

        This value determines how long a connection remains unused in the pool before being evicted and closed.

        A timeout of 0 means there is no timeout.

        Overrides:
        setKeepAliveTimeout in class WebClientOptions
        Parameters:
        keepAliveTimeout - the timeout, in seconds
        Returns:
        a reference to this, so the API can be used fluently
      • setMaxInitialLineLength

        public CachingWebClientOptions setMaxInitialLineLength​(int maxInitialLineLength)
        Description copied from class: HttpClientOptions
        Set the maximum length of the initial line for HTTP/1.x (e.g. "HTTP/1.1 200 OK")
        Overrides:
        setMaxInitialLineLength in class WebClientOptions
        Parameters:
        maxInitialLineLength - the new maximum initial length
        Returns:
        a reference to this, so the API can be used fluently
      • setSslHandshakeTimeout

        public CachingWebClientOptions setSslHandshakeTimeout​(long sslHandshakeTimeout)
        Description copied from class: TCPSSLOptions
        Set the SSL handshake timeout, default time unit is seconds.
        Overrides:
        setSslHandshakeTimeout in class WebClientOptions
        Parameters:
        sslHandshakeTimeout - the SSL handshake timeout to set, in milliseconds
        Returns:
        a reference to this, so the API can be used fluently
      • setSslHandshakeTimeoutUnit

        public CachingWebClientOptions setSslHandshakeTimeoutUnit​(TimeUnit sslHandshakeTimeoutUnit)
        Description copied from class: TCPSSLOptions
        Set the SSL handshake timeout unit. If not specified, default is seconds.
        Overrides:
        setSslHandshakeTimeoutUnit in class WebClientOptions
        Parameters:
        sslHandshakeTimeoutUnit - specify time unit.
        Returns:
        a reference to this, so the API can be used fluently