Interface MultiAddressHttpClientBuilder<U,R>
- Type Parameters:
U
- the type of address before resolution (unresolved address)R
- the type of address after resolution (resolved address)
- All Known Implementing Classes:
DelegatingMultiAddressHttpClientBuilder
StreamingHttpClient
instances which have a capacity to call any server based on the parsed
absolute-form URL address information from each StreamingHttpRequest
.
It also provides a good set of default settings and configurations, which could be used by most users as-is or could be overridden to address specific use cases.
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Initializes theSingleAddressHttpClientBuilder
for each new client. -
Method Summary
Modifier and TypeMethodDescriptionbufferAllocator
(BufferAllocator allocator) default HttpClient
build()
Builds a newHttpClient
.default BlockingHttpClient
Creates a newBlockingHttpClient
.default BlockingStreamingHttpClient
Creates a newBlockingStreamingHttpClient
.Builds a newStreamingHttpClient
.default MultiAddressHttpClientBuilder<U,
R> defaultHttpPort
(int port) Configures the default port for the HTTP scheme if not explicitly provided as part of theHttpRequestMetaData.requestTarget()
.default MultiAddressHttpClientBuilder<U,
R> defaultHttpsPort
(int port) Configures the default port for the HTTPS scheme if not explicitly provided as part of theHttpRequestMetaData.requestTarget()
.executionStrategy
(HttpExecutionStrategy strategy) Sets theHttpExecutionStrategy
to be used for client callbacks when executing client requests for all clients created from this builder.followRedirects
(RedirectConfig config) Configures redirection behavior.default MultiAddressHttpClientBuilder<U,
R> headersFactory
(HttpHeadersFactory headersFactory) Sets theHttpHeadersFactory
to be used for creatingHttpHeaders
for new requests.initializer
(MultiAddressHttpClientBuilder.SingleAddressInitializer<U, R> initializer) Set a function which can customize options for eachStreamingHttpClient
that is built.ioExecutor
(IoExecutor ioExecutor)
-
Method Details
-
ioExecutor
-
executor
-
executionStrategy
Sets theHttpExecutionStrategy
to be used for client callbacks when executing client requests for all clients created from this builder.Provides the base execution strategy for all clients created from this builder and the default strategy for the
SingleAddressHttpClientBuilder
used to construct client instances. Theinitializer(SingleAddressInitializer)
may be used for some customization of the execution strategy for a specific single address client instance, but may not reduce the offloading to be performed. Specifically, the initializer may introduce additional offloading viaSingleAddressHttpClientBuilder.executionStrategy(HttpExecutionStrategy)
and may add filters which influence the computed execution strategy.Specifying an execution strategy will affect the offloading used during the execution of client requests:
- Unspecified or
HttpExecutionStrategies.defaultStrategy()
- The resulting client instances will use the default safe strategy for each API variant and
SingleAddressHttpClientBuilder
instances generated will also have default strategy. HttpExecutionStrategies.offloadNone()
(or deprecatedHttpExecutionStrategies.offloadNever()
)SingleAddressHttpClientBuilder
instances created by the client will have a strategy ofHttpExecutionStrategies.offloadNone()
.HttpExecutionStrategies.offloadNone()
execution strategy requires that filters and asynchronous callbacks must not ever block during the execution of client requests. Aninitializer
may override to add offloads usingSingleAddressHttpClientBuilder.executionStrategy(HttpExecutionStrategy)
.- A custom execution strategy (
HttpExecutionStrategies.customStrategyBuilder()
) orHttpExecutionStrategies.offloadAll()
SingleAddressHttpClientBuilder
instances created by the client will start with the provided strategy and may add additional offloading as required by added filters.
- Parameters:
strategy
-HttpExecutionStrategy
to use. If callbacks to the application code may block then those callbacks must request to be offloaded.- Returns:
this
.- See Also:
- Unspecified or
-
bufferAllocator
-
headersFactory
Sets theHttpHeadersFactory
to be used for creatingHttpHeaders
for new requests.- Parameters:
headersFactory
-HttpHeadersFactory
to be used for creatingHttpHeaders
for new requests- Returns:
this
-
initializer
MultiAddressHttpClientBuilder<U,R> initializer(MultiAddressHttpClientBuilder.SingleAddressInitializer<U, R> initializer) Set a function which can customize options for eachStreamingHttpClient
that is built.- Parameters:
initializer
- Initializes theSingleAddressHttpClientBuilder
used to build newStreamingHttpClient
s. SeeexecutionStrategy(HttpExecutionStrategy)
for discussion of restrictions on the use ofSingleAddressHttpClientBuilder.executionStrategy(HttpExecutionStrategy)
within an initializer.- Returns:
this
-
followRedirects
Configures redirection behavior.- Parameters:
config
-RedirectConfig
to configure redirection behavior. It can be used to tune what requests should follow redirects and which parts of the original request (headers/payload body/trailers) should be redirected to non-relative locations. Usenull
to disable redirects.- Returns:
this
.- See Also:
-
defaultHttpPort
Configures the default port for the HTTP scheme if not explicitly provided as part of theHttpRequestMetaData.requestTarget()
.- Parameters:
port
- the port that should be used if not explicitly provided for HTTP requests.- Returns:
this
.
-
defaultHttpsPort
Configures the default port for the HTTPS scheme if not explicitly provided as part of theHttpRequestMetaData.requestTarget()
.- Parameters:
port
- the port that should be used if not explicitly provided for HTTPS requests.- Returns:
this
.
-
buildStreaming
StreamingHttpClient buildStreaming()Builds a newStreamingHttpClient
.- Returns:
- A new
StreamingHttpClient
- Throws:
IllegalArgumentException
- for incomplete or illegal configurationsIllegalStateException
- for unsupported configuration combinations
-
build
Builds a newHttpClient
.- Returns:
- A new
HttpClient
-
buildBlockingStreaming
Creates a newBlockingStreamingHttpClient
.- Returns:
BlockingStreamingHttpClient
-
buildBlocking
Creates a newBlockingHttpClient
.- Returns:
BlockingHttpClient
-