Interface HttpClientConfig
- All Superinterfaces:
HttpConfigBase, Prototype.Api
- All Known Subinterfaces:
GrpcClientConfig, io.helidon.webclient.grpc.GrpcClientConfigBlueprint, Http1ClientConfig, io.helidon.webclient.http1.Http1ClientConfigBlueprint, Http2ClientConfig, io.helidon.webclient.http2.Http2ClientConfigBlueprint, JsonRpcClientConfig, io.helidon.webclient.jsonrpc.JsonRpcClientConfigBlueprint, WebClientConfig, WsClientConfig, io.helidon.webclient.websocket.WsClientConfigBlueprint
- All Known Implementing Classes:
GrpcClientConfig.BuilderBase.GrpcClientConfigImpl, Http1ClientConfig.BuilderBase.Http1ClientConfigImpl, Http2ClientConfig.BuilderBase.Http2ClientConfigImpl, HttpClientConfig.BuilderBase.HttpClientConfigImpl, JsonRpcClientConfig.BuilderBase.JsonRpcClientConfigImpl, WebClientConfig.BuilderBase.WebClientConfigImpl, WsClientConfig.BuilderBase.WsClientConfigImpl
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classFluent API builder forHttpClientConfig.static classHttpClientConfig.BuilderBase<BUILDER extends HttpClientConfig.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends HttpClientConfig>Fluent API builder base forHttpClientConfig. -
Method Summary
Modifier and TypeMethodDescriptionaltSvc()Client policy for accepting and using HTTPAlt-Svcresponse advertisements.Base address used by the client in all requests.Base fragment used by the client in all requests (unless overwritten on per-request basis).Base query used by the client in all requests.baseUri()Base uri used by the client in all requests.static HttpClientConfig.Builderbuilder()Create a new fluent API builder to customize configuration.static HttpClientConfig.Builderbuilder(HttpClientConfig instance) Create a new fluent API builder from an existing instance.intMaximum number of reusable physical connections each HTTP protocol retains for a single connection target.Socket lifecycle callbacks.Configure the listener specificContentEncodingContext.WebClient cookie manager.static HttpClientConfigcreate()Create a new instance with default values.static HttpClientConfigCreate a new instance from configuration.Default headers to be used in every request from configuration.default ClientRequestHeadersDefault headers as a headers object.DNS address lookup preferences to be used by this client.DNS resolver to be used by this client.executor()Client executor service.booleanWhether headers sensitive to cross-origin redirects should be filtered before the redirected request is sent.booleanWhether redirects that preserve request method and entity may be followed across origins.headers()Default headers to be used in every request.intIf the entity is expected to be smaller that this number of bytes, it would be buffered in memory to optimize performance.Configure the listener specificMediaContext.Media supports (manually added).Configure media type parsing mode for HTTPContent-Typeheader.Socket 100-Continue read timeout.Request header names to strip on cross-origin redirects.booleanCan be set totrueto force the use of relative URIs in all requests, regardless of the presence or absence of proxies or no-proxy lists.booleanWhether Expect-100-Continue header is sent to verify server availability before sending an entity.services()WebClient services.booleanWhether to use protocol-specific JVM-wide connection caches shared by compatible WebClient instances.sni()Client-side TLS SNI configuration.Socket options for connections opened by this client.intBuffer size used when writing data to the underlying socket on a client TCP connection.Methods inherited from interface HttpConfigBase
connectTimeout, followRedirects, keepAlive, maxRedirects, properties, proxy, readTimeout, tlsModifier and TypeMethodDescriptionConnect timeout.booleanWhether to follow redirects.booleanDetermines if connection keep alive is enabled (NOT socket keep alive, but HTTP connection keep alive, to re-use the same connection for multiple requests).intMax number of followed redirects.Properties configured for this client.proxy()Proxy configuration to be used for requests.Read timeout.tls()TLS configuration for any TLS request from this client.
-
Method Details
-
builder
Create a new fluent API builder to customize configuration.- Returns:
- a new builder
-
builder
Create a new fluent API builder from an existing instance.- Parameters:
instance- an existing instance used as a base for the builder- Returns:
- a builder based on an instance
-
create
Create a new instance from configuration.- Parameters:
config- used to configure the new instance- Returns:
- a new instance configured from configuration
-
create
-
defaultRequestHeaders
Default headers as a headers object. Creates a new instance for each call, so the returned value can be safely mutated.- Returns:
- default headers
-
baseUri
-
baseAddress
Optional<SocketAddress> baseAddress()Base address used by the client in all requests. This may be either an Inet address or a UNIX domain socket address.A UNIX domain socket address overrides only the physical transport. The request URI resolved against
baseUri()or an absolute request URI still provides the logical HTTP authority used for theHostheader, HTTP/2:authority, SNI, and endpoint identification.- Returns:
- base address of the client requests
-
sni
-
altSvc
Optional<ClientAltSvcConfig> altSvc()Client policy for accepting and using HTTPAlt-Svcresponse advertisements.Alternative service handling is disabled when this configuration is absent. Configure an empty
ClientAltSvcConfigto opt in with its defaults.- Returns:
- alternative service policy, or empty if alternative service handling is disabled
-
baseQuery
-
baseFragment
Optional<UriFragment> baseFragment()Base fragment used by the client in all requests (unless overwritten on per-request basis).- Returns:
- 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:- Returns:
- socket options
-
dnsResolver
-
dnsAddressLookup
DnsAddressLookup dnsAddressLookup()DNS address lookup preferences to be used by this client. Default value is determined by capabilities of the system.- Returns:
- dns address lookup strategy
-
defaultHeadersMap
-
headers
-
filterRedirectHeaders
boolean filterRedirectHeaders()Whether headers sensitive to cross-origin redirects should be filtered before the redirected request is sent.When enabled, header names from
redirectSensitiveHeaders()are stripped on cross-origin redirects.- Returns:
- whether redirect header filtering is enabled
-
followCrossOriginEntityRedirects
boolean followCrossOriginEntityRedirects()Whether redirects that preserve request method and entity may be followed across origins.When disabled,
307and308redirects, and301and302redirects of aQUERYrequest, to a different origin fail instead of replaying the request entity to the redirect target.- Returns:
- whether cross-origin redirects may replay request entities
-
redirectSensitiveHeaders
Set<HeaderName> redirectSensitiveHeaders()Request header names to strip on cross-origin redirects.Header names are matched case-insensitively. The returned set always contains "Authorization", "Cookie", and "Proxy-Authorization", even if any was not explicitly configured.
- Returns:
- sensitive redirect headers
-
mediaTypeParserMode
ParserMode mediaTypeParserMode()Configure media type parsing mode for HTTPContent-Typeheader.- Returns:
- media type parsing mode
-
contentEncoding
ContentEncodingContext contentEncoding()Configure the listener specificContentEncodingContext. This method discards all previously registered ContentEncodingContext. If no content encoding context is registered, default encoding context is used.- Returns:
- content encoding context
-
mediaContext
MediaContext mediaContext()Configure the listener specificMediaContext. This method discards all previously registered MediaContext. If no media context is registered, default media context is used.- Returns:
- media context
-
mediaSupports
List<MediaSupport> mediaSupports()Media supports (manually added). If bothmediaContext()and this is configured, there will be a new context created from return of this method, with fallback ofmediaContext().- Returns:
- list of explicitly added media supports
-
services
-
relativeUris
boolean relativeUris()Can be set totrueto force the use of relative URIs in all requests, regardless of the presence or absence of proxies or no-proxy lists.- Returns:
- relative URIs flag
-
executor
ExecutorService executor()Client executor service.- Returns:
- 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.- Returns:
- whether Expect:100-Continue header should be sent on streamed transfers
-
connectionCacheSize
int connectionCacheSize()Maximum number of reusable physical connections each HTTP protocol retains for a single connection target. A connection target identifies the logical HTTP authority, TLS configuration and generation, configured SNI, DNS resolver and address lookup, selected proxy route, and physical transport. For UNIX domain socket transports, the target includes the socket path and does not include proxy configuration.Each configured HTTP protocol honors this common option independently; it is not an aggregate cache quota across protocol versions. This is a retention limit, not a limit on concurrent requests or streams and not a hard cap on live sockets. Active or draining connections may temporarily cause the number of live sockets for a target to exceed this value. Each protocol retains at most
1,000connection-target entries; adding another target retires the oldest cached target entry. The value must be greater than zero. Defaults to256.- Returns:
- maximum number of reusable physical connections retained per target by each HTTP protocol
-
cookieManager
Optional<WebClientCookieManager> cookieManager()WebClient cookie manager.- Returns:
- 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.- Returns:
- read 100-Continue timeout duration
-
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.
- Returns:
- maximal number of bytes to buffer in memory for supported writers
-
writeBufferSize
int writeBufferSize()Buffer size used when writing data to the underlying socket on a client TCP connection. A value that is less or equal to 1 can be set to disable buffering at this level. Note that if writing data to the socket in small chunks, they may not be delivered to the network immediately due to Nagle's algorithm (i.e., if TCP_NO_DELAY is turned off).- Returns:
- number of bytes in write buffer
-
connectionListener
ConnectionListener connectionListener()Socket lifecycle callbacks. The default implementation does nothing, and Initializer logic that is called immediately after the client connection is established, before any TLS or HTTP data is written. The default initializer does nothing.- Returns:
- The socket listener.
-