Interface WebClientConfig

All Superinterfaces:
HttpClientConfig, HttpConfigBase, Prototype.Api, Prototype.Factory<WebClient>
All Known Implementing Classes:

public interface WebClientConfig extends Prototype.Api, HttpClientConfig, HttpConfigBase
WebClient configuration.
See Also:
  • Method Details

    • builder

      static WebClientConfig.Builder builder()
      Create a new fluent API builder to customize configuration.
      a new builder
    • builder

      static WebClientConfig.Builder builder(WebClientConfig instance)
      Create a new fluent API builder from an existing instance.
      instance - an existing instance used as a base for the builder
      a builder based on an instance
    • create

      static WebClientConfig create(Config config)
      Create a new instance from configuration.
      config - used to configure the new instance
      a new instance configured from configuration
    • create

      static WebClientConfig create()
      Create a new instance with default values.
      a new instance
    • protocolConfigs

      List<ProtocolConfig> protocolConfigs()
      Configuration of client protocols.
      client protocol configurations
    • protocolPreference

      List<String> protocolPreference()
      List of HTTP protocol IDs by order of preference. If left empty, all discovered providers will be used, ordered by weight.

      For example if both HTTP/2 and HTTP/1.1 providers are available (considering HTTP/2 has higher weights), for ALPN we will send h2 and http/1.1 and decide based on response. If TLS is not used, we would attempt an upgrade (or use prior knowledge if configured in protocolConfigs()).

      list of HTTP protocol IDs in order of preference
    • baseUri

      Optional<ClientUri> baseUri()
      Base uri used by the client in all requests.
      base uri of the client requests
    • baseQuery

      Optional<UriQuery> baseQuery()
      Base query used by the client in all requests.
      base query of the client requests
    • baseFragment

      Optional<UriFragment> baseFragment()
      Base fragment used by the client in all requests (unless overwritten on per-request basis).
      fragment to use
    • socketOptions

      SocketOptions socketOptions()
      Socket options for connections opened by this client. If there is a value explicitly configured on this type and on the socket options, the one configured on this type's builder will win:
      socket options
    • dnsResolver

      DnsResolver dnsResolver()
      DNS resolver to be used by this client.
      dns resolver
    • dnsAddressLookup

      DnsAddressLookup dnsAddressLookup()
      DNS address lookup preferences to be used by this client. Default value is determined by capabilities of the system.
      dns address lookup strategy
    • defaultHeadersMap

      Map<String,String> defaultHeadersMap()
      Default headers to be used in every request from configuration.
      default headers
    • headers

      Set<Header> headers()
      Default headers to be used in every request.
      default headers
    • defaultRequestHeaders

      default ClientRequestHeaders defaultRequestHeaders()
      Default headers as a headers object. Creates a new instance for each call, so the returned value can be safely mutated.
      default headers
    • mediaTypeParserMode

      ParserMode mediaTypeParserMode()
      Configure media type parsing mode for HTTP Content-Type header.
      media type parsing mode
    • contentEncoding

      ContentEncodingContext contentEncoding()
      Configure the listener specific ContentEncodingContext. This method discards all previously registered ContentEncodingContext. If no content encoding context is registered, default encoding context is used.
      content encoding context
    • mediaContext

      MediaContext mediaContext()
      Configure the listener specific MediaContext. This method discards all previously registered MediaContext. If no media context is registered, default media context is used.
      media context
    • mediaSupports

      List<MediaSupport> mediaSupports()
      Media supports (manually added). If both mediaContext() and this is configured, there will be a new context created from return of this method, with fallback of mediaContext().
      list of explicitly added media supports
    • services

      List<WebClientService> services()
      WebClient services.
      services to use with this web client
    • relativeUris

      boolean relativeUris()
      Can be set to true to force the use of relative URIs in all requests, regardless of the presence or absence of proxies or no-proxy lists.
      relative URIs flag
    • executor

      ExecutorService executor()
      Client executor service.
      executor service to use when needed (such as for HTTP/2)
    • sendExpectContinue

      boolean sendExpectContinue()
      Whether Expect-100-Continue header is sent to verify server availability before sending an entity.

      Defaults to true.

      whether Expect:100-Continue header should be sent on streamed transfers
    • connectionCacheSize

      int connectionCacheSize()
      Maximal size of the connection cache. For most HTTP protocols, we may cache connections to various endpoints for keep alive (or stream reuse in case of HTTP/2). This option limits the size. Setting this number lower than the "usual" number of target services will cause connections to be closed and reopened frequently.
    • cookieManager

      WebClient cookie manager.
      cookie manager to use
    • readContinueTimeout

      Duration readContinueTimeout()
      Socket 100-Continue read timeout. Default is 1 second. This read timeout is used when 100-Continue is sent by the client, before it sends an entity.
      read 100-Continue timeout duration
    • shareConnectionCache

      boolean shareConnectionCache()
      Whether to share connection cache between all the WebClient instances in JVM.
      true if connection cache is shared
    • maxInMemoryEntity

      int maxInMemoryEntity()
      If the entity is expected to be smaller that this number of bytes, it would be buffered in memory to optimize performance. If bigger, streaming will be used.

      Note that for some entity types we cannot use streaming, as they are already fully in memory (String, byte[]), for such cases, this option is ignored. Default is 128Kb.

      maximal number of bytes to buffer in memory for supported writers
    • followRedirects

      boolean followRedirects()
      Whether to follow redirects.
      whether to follow redirects
    • maxRedirects

      int maxRedirects()
      Max number of followed redirects. This is ignored if followRedirects() option is false.
      max number of followed redirects
    • tls

      Tls tls()
      TLS configuration for any TLS request from this client. TLS can also be configured per request. TLS is used when the protocol is set to https.
      TLS configuration to use
    • readTimeout

      Optional<Duration> readTimeout()
      Read timeout.
      read timeout
      See Also:
      • SocketOptionsBlueprint.readTimeout()
    • connectTimeout

      Optional<Duration> connectTimeout()
      Connect timeout.
      connect timeout
      See Also:
      • SocketOptionsBlueprint.connectTimeout()
    • keepAlive

      boolean keepAlive()
      Determines if connection keep alive is enabled (NOT socket keep alive, but HTTP connection keep alive, to re-use the same connection for multiple requests).
      keep alive for this connection
      See Also:
      • SocketOptionsBlueprint.socketKeepAlive()
    • proxy

      Proxy proxy()
      Proxy configuration to be used for requests.
      proxy to use, defaults to Proxy.noProxy()
    • properties

      Map<String,String> properties()
      Properties configured for this client. These properties are propagated through client request, to be used by services (and possibly for other purposes).
      map of client properties