Module io.helidon.webclient.api
Package io.helidon.webclient.api
Class HttpClientConfig.BuilderBase<BUILDER extends HttpClientConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends HttpClientConfig>
java.lang.Object
io.helidon.webclient.api.HttpConfigBase.BuilderBase<BUILDER,PROTOTYPE>
io.helidon.webclient.api.HttpClientConfig.BuilderBase<BUILDER,PROTOTYPE>
- Type Parameters:
BUILDER
- type of the builder extending this abstract builderPROTOTYPE
- type of the prototype interface that would be built byPrototype.Builder.buildPrototype()
- All Implemented Interfaces:
Prototype.Builder<BUILDER,
,PROTOTYPE> Prototype.ConfiguredBuilder<BUILDER,
PROTOTYPE>
- Direct Known Subclasses:
GrpcClientConfig.BuilderBase
,Http1ClientConfig.BuilderBase
,Http2ClientConfig.BuilderBase
,HttpClientConfig.Builder
,WebClientConfig.BuilderBase
,WsClientConfig.BuilderBase
- Enclosing interface:
HttpClientConfig
public abstract static class HttpClientConfig.BuilderBase<BUILDER extends HttpClientConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends HttpClientConfig>
extends HttpConfigBase.BuilderBase<BUILDER,PROTOTYPE>
implements Prototype.ConfiguredBuilder<BUILDER,PROTOTYPE>
Fluent API builder base for
HttpClientConfig
.-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Generated implementation of the prototype, can be extended by descendant prototype implementations.Nested classes/interfaces inherited from class io.helidon.webclient.api.HttpConfigBase.BuilderBase
HttpConfigBase.BuilderBase.HttpConfigBaseImpl
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddDefaultHeadersMap
(Map<? extends String, ? extends String> defaultHeadersMap) This method keeps existing values, then puts all new values into the map.Default headers to be used in every request.addHeader
(HeaderName name, int value) Add a default header value.addHeader
(HeaderName name, long value) Add a default header value.addHeader
(HeaderName name, String value) Add a default header value.Add default header value.Add default header value.Add default header value.addHeaders
(Set<? extends Header> headers) Default headers to be used in every request.addMediaSupport
(MediaSupport mediaSupport) Media supports (manually added).addMediaSupports
(List<? extends MediaSupport> mediaSupports) Media supports (manually added).addService
(WebClientService service) WebClient services.addServices
(List<? extends WebClientService> services) WebClient services.Base fragment used by the client in all requests (unless overwritten on per-request basis).baseFragment
(UriFragment baseFragment) Base fragment used by the client in all requests (unless overwritten on per-request basis).Base query used by the client in all requests.Base query used by the client in all requests.baseUri()
Base uri used by the client in all requests.Base uri used by the client in all requests.Base uri used by the client in all requests.Base URI of the client.Base URI of the client.Clear existing value of this property.Clear existing value of this property.Clear existing value of this property.Clear existing value of this property.config()
If this instance was configured, this would be the config instance used.Update builder from configuration (node of this type).int
Maximal size of the connection cache.connectionCacheSize
(int connectionCacheSize) Maximal size of the connection cache.Configure the listener specificContentEncodingContext
.contentEncoding
(ContentEncodingContext contentEncoding) Configure the listener specificContentEncodingContext
.contentEncoding
(ContentEncodingContextConfig contentEncodingConfig) Configure the listener specificContentEncodingContext
.Configure the listener specificContentEncodingContext
.contentEncoding
(Supplier<? extends ContentEncodingContext> supplier) Configure the listener specificContentEncodingContext
.WebClient cookie manager.cookieManager
(WebClientCookieManager cookieManager) WebClient cookie manager.cookieManager
(WebClientCookieManagerConfig cookieManagerConfig) WebClient cookie manager.WebClient cookie manager.Default headers to be used in every request from configuration.defaultHeadersMap
(Map<? extends String, ? extends String> defaultHeadersMap) This method replaces all values with the new ones.DNS address lookup preferences to be used by this client.dnsAddressLookup
(DnsAddressLookup dnsAddressLookup) DNS address lookup preferences to be used by this client.DNS resolver to be used by this client.dnsResolver
(DnsResolver dnsResolver) DNS resolver to be used by this client.executor()
Client executor service.executor
(ExecutorService executor) Client executor service.from
(HttpClientConfig prototype) Update this builder from an existing prototype instance.from
(HttpClientConfig.BuilderBase<?, ?> builder) Update this builder from an existing prototype builder instance.headers()
Default headers to be used in every request.Default headers to be used in every request.int
If the entity is expected to be smaller that this number of bytes, it would be buffered in memory to optimize performance.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.Configure the listener specificMediaContext
.mediaContext
(MediaContext mediaContext) Configure the listener specificMediaContext
.mediaContext
(MediaContextConfig mediaContextConfig) Configure the listener specificMediaContext
.mediaContext
(Consumer<MediaContextConfig.Builder> consumer) Configure the listener specificMediaContext
.mediaContext
(Supplier<? extends MediaContext> supplier) Configure the listener specificMediaContext
.Media supports (manually added).mediaSupports
(List<? extends MediaSupport> mediaSupports) Media supports (manually added).Configure media type parsing mode for HTTPContent-Type
header.mediaTypeParserMode
(ParserMode mediaTypeParserMode) Configure media type parsing mode for HTTPContent-Type
header.protected void
Handles providers and decorators.Socket 100-Continue read timeout.readContinueTimeout
(Duration readContinueTimeout) Socket 100-Continue read timeout.boolean
Can be set totrue
to force the use of relative URIs in all requests, regardless of the presence or absence of proxies or no-proxy lists.relativeUris
(boolean relativeUris) Can be set totrue
to force the use of relative URIs in all requests, regardless of the presence or absence of proxies or no-proxy lists.boolean
Whether Expect-100-Continue header is sent to verify server availability before sending an entity.sendExpectContinue
(boolean sendExpectContinue) Whether Expect-100-Continue header is sent to verify server availability before sending an entity.services()
WebClient services.services
(List<? extends WebClientService> services) WebClient services.servicesDiscoverServices
(boolean discoverServices) WebClient services.boolean
Whether to share connection cache between all the WebClient instances in JVM.shareConnectionCache
(boolean shareConnectionCache) Whether to share connection cache between all the WebClient instances in JVM.Socket options for connections opened by this client.socketOptions
(SocketOptions socketOptions) Socket options for connections opened by this client.socketOptions
(Consumer<SocketOptions.Builder> consumer) Socket options for connections opened by this client.socketOptions
(Supplier<? extends SocketOptions> supplier) Socket options for connections opened by this client.toString()
protected void
Validates required properties.Methods inherited from class io.helidon.webclient.api.HttpConfigBase.BuilderBase
addProperties, clearConnectTimeout, clearReadTimeout, connectTimeout, connectTimeout, followRedirects, followRedirects, from, from, keepAlive, keepAlive, maxRedirects, maxRedirects, properties, properties, proxy, proxy, proxy, proxy, putProperty, readTimeout, readTimeout, tls, tls, tls, tls, tls
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.helidon.builder.api.Prototype.Builder
buildPrototype, self
Methods inherited from interface io.helidon.builder.api.Prototype.ConfiguredBuilder
discoverService, discoverServices
-
Constructor Details
-
BuilderBase
protected BuilderBase()Protected to support extensibility.
-
-
Method Details
-
from
Update this builder from an existing prototype instance. This method disables automatic service discovery.- Parameters:
prototype
- existing prototype to update this builder from- Returns:
- updated builder instance
-
from
Update this builder from an existing prototype builder instance.- Parameters:
builder
- existing builder prototype to update this builder from- Returns:
- updated builder instance
-
baseUri
Base URI of the client.- Parameters:
baseUri
- base URI to use, query is extracted to base query (if any)- Returns:
- updated builder instance
-
baseUri
Base URI of the client.- Parameters:
baseUri
- base URI to use, query is extracted to base query (if any)- Returns:
- updated builder instance
-
addHeader
Add a default header value.- Parameters:
name
- name of the headervalue
- value of the header- Returns:
- updated builder instance
-
addHeader
Add a default header value.- Parameters:
name
- name of the headervalue
- value of the header- Returns:
- updated builder instance
-
addHeader
Add a default header value.- Parameters:
name
- name of the headervalue
- value of the header- Returns:
- updated builder instance
-
addHeader
Add default header value. This method is not optimal and should only be used when the header name is really obtained from a string, in other cases, use an alternative withHeaderName
orHeader
.- Parameters:
name
- name of the headervalue
- value of the header- Returns:
- updated builder instance
- See Also:
-
addHeader
Add default header value. This method is not optimal and should only be used when the header name is really obtained from a string, in other cases, use an alternative withHeaderName
orHeader
.- Parameters:
name
- name of the headervalue
- value of the header- Returns:
- updated builder instance
- See Also:
-
addHeader
Add default header value. This method is not optimal and should only be used when the header name is really obtained from a string, in other cases, use an alternative withHeaderName
orHeader
.- Parameters:
name
- name of the headervalue
- value of the header- Returns:
- updated builder instance
- See Also:
-
config
Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.- Specified by:
config
in interfacePrototype.ConfiguredBuilder<BUILDER extends HttpClientConfig.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends HttpClientConfig> - Overrides:
config
in classHttpConfigBase.BuilderBase<BUILDER extends HttpClientConfig.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends HttpClientConfig> - Parameters:
config
- configuration instance used to obtain values to update this builder- Returns:
- updated builder instance
-
clearBaseUri
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
baseUri
Base uri used by the client in all requests.- Parameters:
baseUri
- base uri of the client requests- Returns:
- updated builder instance
- See Also:
-
baseUri
Base uri used by the client in all requests.- Parameters:
baseUriConfig
- base uri of the client requests- Returns:
- updated builder instance
- See Also:
-
clearBaseQuery
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
baseQuery
Base query used by the client in all requests.- Parameters:
baseQuery
- base query of the client requests- Returns:
- updated builder instance
- See Also:
-
clearBaseFragment
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
baseFragment
Base fragment used by the client in all requests (unless overwritten on per-request basis).- Parameters:
baseFragment
- fragment to use- Returns:
- updated builder instance
- See Also:
-
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:- Parameters:
socketOptions
- socket options- Returns:
- updated builder instance
- See Also:
-
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:- Parameters:
consumer
- consumer of builder for socket options- Returns:
- updated builder instance
- See Also:
-
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:- Parameters:
supplier
- supplier of socket options- Returns:
- updated builder instance
- See Also:
-
dnsResolver
DNS resolver to be used by this client.- Parameters:
dnsResolver
- dns resolver- Returns:
- updated builder instance
- See Also:
-
dnsAddressLookup
DNS address lookup preferences to be used by this client. Default value is determined by capabilities of the system.- Parameters:
dnsAddressLookup
- dns address lookup strategy- Returns:
- updated builder instance
- See Also:
-
defaultHeadersMap
This method replaces all values with the new ones.- Parameters:
defaultHeadersMap
- default headers- Returns:
- updated builder instance
- See Also:
-
addDefaultHeadersMap
This method keeps existing values, then puts all new values into the map.- Parameters:
defaultHeadersMap
- default headers- Returns:
- updated builder instance
- See Also:
-
headers
Default headers to be used in every request.- Parameters:
headers
- default headers- Returns:
- updated builder instance
- See Also:
-
addHeaders
Default headers to be used in every request.- Parameters:
headers
- default headers- Returns:
- updated builder instance
- See Also:
-
addHeader
Default headers to be used in every request.- Parameters:
header
- default headers- Returns:
- updated builder instance
- See Also:
-
mediaTypeParserMode
Configure media type parsing mode for HTTPContent-Type
header.- Parameters:
mediaTypeParserMode
- media type parsing mode- Returns:
- updated builder instance
- See Also:
-
contentEncoding
Configure the listener specificContentEncodingContext
. This method discards all previously registered ContentEncodingContext. If no content encoding context is registered, default encoding context is used.- Parameters:
contentEncoding
- content encoding context- Returns:
- updated builder instance
- See Also:
-
contentEncoding
Configure the listener specificContentEncodingContext
. This method discards all previously registered ContentEncodingContext. If no content encoding context is registered, default encoding context is used.- Parameters:
contentEncodingConfig
- content encoding context- Returns:
- updated builder instance
- See Also:
-
contentEncoding
Configure the listener specificContentEncodingContext
. This method discards all previously registered ContentEncodingContext. If no content encoding context is registered, default encoding context is used.- Parameters:
consumer
- consumer of builder for content encoding context- Returns:
- updated builder instance
- See Also:
-
contentEncoding
Configure the listener specificContentEncodingContext
. This method discards all previously registered ContentEncodingContext. If no content encoding context is registered, default encoding context is used.- Parameters:
supplier
- supplier of content encoding context- Returns:
- updated builder instance
- See Also:
-
mediaContext
Configure the listener specificMediaContext
. This method discards all previously registered MediaContext. If no media context is registered, default media context is used.- Parameters:
mediaContext
- media context- Returns:
- updated builder instance
- See Also:
-
mediaContext
Configure the listener specificMediaContext
. This method discards all previously registered MediaContext. If no media context is registered, default media context is used.- Parameters:
mediaContextConfig
- media context- Returns:
- updated builder instance
- See Also:
-
mediaContext
Configure the listener specificMediaContext
. This method discards all previously registered MediaContext. If no media context is registered, default media context is used.- Parameters:
consumer
- consumer of builder for media context- Returns:
- updated builder instance
- See Also:
-
mediaContext
Configure the listener specificMediaContext
. This method discards all previously registered MediaContext. If no media context is registered, default media context is used.- Parameters:
supplier
- supplier of media context- Returns:
- updated builder instance
- See Also:
-
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()
.- Parameters:
mediaSupports
- list of explicitly added media supports- Returns:
- updated builder instance
- See Also:
-
addMediaSupports
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()
.- Parameters:
mediaSupports
- list of explicitly added media supports- Returns:
- updated builder instance
- See Also:
-
addMediaSupport
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()
.- Parameters:
mediaSupport
- list of explicitly added media supports- Returns:
- updated builder instance
- See Also:
-
servicesDiscoverServices
WebClient services.- Parameters:
discoverServices
- whether to discover implementations through service loader- Returns:
- updated builder instance
- See Also:
-
services
WebClient services.- Parameters:
services
- services to use with this web client- Returns:
- updated builder instance
- See Also:
-
addServices
WebClient services.- Parameters:
services
- services to use with this web client- Returns:
- updated builder instance
- See Also:
-
addService
WebClient services.- Parameters:
service
- services to use with this web client- Returns:
- updated builder instance
- See Also:
-
relativeUris
Can be set totrue
to force the use of relative URIs in all requests, regardless of the presence or absence of proxies or no-proxy lists.- Parameters:
relativeUris
- relative URIs flag- Returns:
- updated builder instance
- See Also:
-
executor
Client executor service.- Parameters:
executor
- executor service to use when needed (such as for HTTP/2)- Returns:
- updated builder instance
- See Also:
-
sendExpectContinue
Whether Expect-100-Continue header is sent to verify server availability before sending an entity.Defaults to
true
.- Parameters:
sendExpectContinue
- whether Expect:100-Continue header should be sent on streamed transfers- Returns:
- updated builder instance
- See Also:
-
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.- Parameters:
connectionCacheSize
-- Returns:
- updated builder instance
- See Also:
-
clearCookieManager
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
cookieManager
WebClient cookie manager.- Parameters:
cookieManager
- cookie manager to use- Returns:
- updated builder instance
- See Also:
-
cookieManager
WebClient cookie manager.- Parameters:
cookieManagerConfig
- cookie manager to use- Returns:
- updated builder instance
- See Also:
-
cookieManager
WebClient cookie manager.- Parameters:
consumer
- cookie manager to use- Returns:
- updated builder instance
- See Also:
-
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.- Parameters:
readContinueTimeout
- read 100-Continue timeout duration- Returns:
- updated builder instance
- See Also:
-
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.
- Parameters:
maxInMemoryEntity
- maximal number of bytes to buffer in memory for supported writers- Returns:
- updated builder instance
- See Also:
-
baseUri
Base uri used by the client in all requests.- Returns:
- the base uri
-
baseQuery
Base query used by the client in all requests.- Returns:
- the base query
-
baseFragment
Base fragment used by the client in all requests (unless overwritten on per-request basis).- Returns:
- the base fragment
-
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:
- the socket options
-
dnsResolver
DNS resolver to be used by this client.- Returns:
- the dns resolver
-
dnsAddressLookup
DNS address lookup preferences to be used by this client. Default value is determined by capabilities of the system.- Returns:
- the dns address lookup
-
defaultHeadersMap
Default headers to be used in every request from configuration.- Returns:
- the default headers map
-
headers
Default headers to be used in every request.- Returns:
- the headers
-
mediaTypeParserMode
Configure media type parsing mode for HTTPContent-Type
header.- Returns:
- the media type parser mode
-
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:
- the content encoding
-
mediaContext
Configure the listener specificMediaContext
. This method discards all previously registered MediaContext. If no media context is registered, default media context is used.- Returns:
- the media context
-
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:
- the media supports
-
services
WebClient services.- Returns:
- the services
-
relativeUris
public boolean relativeUris()Can be set totrue
to force the use of relative URIs in all requests, regardless of the presence or absence of proxies or no-proxy lists.- Returns:
- the relative uris
-
executor
Client executor service.- Returns:
- the executor
-
sendExpectContinue
public boolean sendExpectContinue()Whether Expect-100-Continue header is sent to verify server availability before sending an entity.Defaults to
true
.- Returns:
- the send expect continue
-
connectionCacheSize
public 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.- Returns:
- the connection cache size
-
cookieManager
WebClient cookie manager.- Returns:
- the cookie manager
-
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:
- the read continue timeout
-
maxInMemoryEntity
public 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:
- the max in memory entity
-
config
If this instance was configured, this would be the config instance used.- Overrides:
config
in classHttpConfigBase.BuilderBase<BUILDER extends HttpClientConfig.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends HttpClientConfig> - Returns:
- config node used to configure this builder, or empty if not configured
-
toString
- Overrides:
toString
in classHttpConfigBase.BuilderBase<BUILDER extends HttpClientConfig.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends HttpClientConfig>
-
preBuildPrototype
protected void preBuildPrototype()Handles providers and decorators.- Overrides:
preBuildPrototype
in classHttpConfigBase.BuilderBase<BUILDER extends HttpClientConfig.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends HttpClientConfig>
-
validatePrototype
protected void validatePrototype()Validates required properties.- Overrides:
validatePrototype
in classHttpConfigBase.BuilderBase<BUILDER extends HttpClientConfig.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends HttpClientConfig>
-