U - the type of address before resolution (unresolved address)R - the type of address after resolution (resolved address)public class DelegatingSingleAddressHttpClientBuilder<U,R> extends Object implements SingleAddressHttpClientBuilder<U,R>
SingleAddressHttpClientBuilder that delegates all methods to another
SingleAddressHttpClientBuilder.| Constructor and Description |
|---|
DelegatingSingleAddressHttpClientBuilder(SingleAddressHttpClientBuilder<U,R> delegate)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
SingleAddressHttpClientBuilder<U,R> |
allowDropResponseTrailers(boolean allowDrop)
Provide a hint if response trailers are allowed
to be dropped.
|
SingleAddressHttpClientBuilder<U,R> |
appendClientFilter(Predicate<StreamingHttpRequest> predicate,
StreamingHttpClientFilterFactory factory)
Appends the filter to the chain of filters used to decorate the
HttpClient created by this
builder, for every request that passes the provided Predicate. |
SingleAddressHttpClientBuilder<U,R> |
appendClientFilter(StreamingHttpClientFilterFactory factory)
Appends the filter to the chain of filters used to decorate the
HttpClient created by this
builder. |
SingleAddressHttpClientBuilder<U,R> |
appendConnectionFactoryFilter(ConnectionFactoryFilter<R,FilterableStreamingHttpConnection> factory)
Appends the filter to the chain of filters used to decorate the
ConnectionFactory used by this
builder. |
SingleAddressHttpClientBuilder<U,R> |
appendConnectionFilter(Predicate<StreamingHttpRequest> predicate,
StreamingHttpConnectionFilterFactory factory)
Appends the filter to the chain of filters used to decorate the
StreamingHttpConnection created by this
builder, for every request that passes the provided Predicate. |
SingleAddressHttpClientBuilder<U,R> |
appendConnectionFilter(StreamingHttpConnectionFilterFactory factory)
Appends the filter to the chain of filters used to decorate the
StreamingHttpConnection created by this
builder. |
SingleAddressHttpClientBuilder<U,R> |
bufferAllocator(BufferAllocator allocator)
Sets the
BufferAllocator for all clients created from this builder. |
HttpClient |
build()
Builds a new
HttpClient. |
BlockingHttpClient |
buildBlocking()
Creates a new
BlockingHttpClient. |
BlockingStreamingHttpClient |
buildBlockingStreaming()
Creates a new
BlockingStreamingHttpClient. |
StreamingHttpClient |
buildStreaming()
Builds a new
StreamingHttpClient. |
protected SingleAddressHttpClientBuilder<U,R> |
delegate()
Returns the
SingleAddressHttpClientBuilder delegate. |
SingleAddressHttpClientBuilder<U,R> |
enableWireLogging(String loggerName,
LogLevel logLevel,
BooleanSupplier logUserData)
Enables wire-logging for connections created by this builder.
|
SingleAddressHttpClientBuilder<U,R> |
executionStrategy(HttpExecutionStrategy strategy)
Sets the
HttpExecutionStrategy to be used for client callbacks when executing client requests for all
clients created from this builder. |
SingleAddressHttpClientBuilder<U,R> |
executor(Executor executor)
Sets the
Executor for all clients created from this builder. |
SingleAddressHttpClientBuilder<U,R> |
hostHeaderFallback(boolean enable)
Configures automatically setting
Host headers by inferring from the address. |
SingleAddressHttpClientBuilder<U,R> |
inferPeerHost(boolean shouldInfer)
Toggle inference of value to use instead of
ClientSslConfig.peerHost()
from client's address when peer host is not specified. |
SingleAddressHttpClientBuilder<U,R> |
inferPeerPort(boolean shouldInfer)
Toggle inference of value to use instead of
ClientSslConfig.peerPort()
from client's address when peer port is not specified (equals -1). |
SingleAddressHttpClientBuilder<U,R> |
inferSniHostname(boolean shouldInfer)
Toggle SNI
hostname inference from client's address if not explicitly specified
via
SingleAddressHttpClientBuilder.sslConfig(ClientSslConfig). |
SingleAddressHttpClientBuilder<U,R> |
ioExecutor(IoExecutor ioExecutor)
Sets the
IoExecutor for all clients created from this builder. |
SingleAddressHttpClientBuilder<U,R> |
loadBalancerFactory(HttpLoadBalancerFactory<R> loadBalancerFactory)
Sets a
HttpLoadBalancerFactory to create LoadBalancer instances. |
SingleAddressHttpClientBuilder<U,R> |
protocols(HttpProtocolConfig... protocols)
Configurations of various HTTP protocol versions.
|
SingleAddressHttpClientBuilder<U,R> |
proxyAddress(U proxyAddress)
Configure proxy to serve as an intermediary for requests.
|
SingleAddressHttpClientBuilder<U,R> |
retryServiceDiscoveryErrors(BiIntFunction<Throwable,? extends Completable> retryStrategy)
Sets a retry strategy to retry errors emitted by
ServiceDiscoverer. |
SingleAddressHttpClientBuilder<U,R> |
serviceDiscoverer(ServiceDiscoverer<U,R,? extends ServiceDiscovererEvent<R>> serviceDiscoverer)
Sets a
ServiceDiscoverer to resolve addresses of remote servers to connect to. |
<T> SingleAddressHttpClientBuilder<U,R> |
socketOption(SocketOption<T> option,
T value)
Adds a
SocketOption for all connections created by this builder. |
SingleAddressHttpClientBuilder<U,R> |
sslConfig(ClientSslConfig sslConfig)
Set the SSL/TLS configuration.
|
String |
toString() |
SingleAddressHttpClientBuilder<U,R> |
unresolvedAddressToHost(Function<U,CharSequence> unresolvedAddressToHostFunction)
Provides a means to convert
U unresolved address type into a CharSequence. |
public DelegatingSingleAddressHttpClientBuilder(SingleAddressHttpClientBuilder<U,R> delegate)
delegate - SingleAddressHttpClientBuilder to which all methods are delegated.protected final SingleAddressHttpClientBuilder<U,R> delegate()
SingleAddressHttpClientBuilder delegate.SingleAddressHttpClientBuilder.public String toString()
toString in class Objectpublic SingleAddressHttpClientBuilder<U,R> proxyAddress(U proxyAddress)
SingleAddressHttpClientBuilderproxyAddress in interface SingleAddressHttpClientBuilder<U,R>proxyAddress - Unresolved address of the proxy. When used with a builder created for a resolved address,
proxyAddress should also be already resolved – otherwise runtime exceptions may occur.this.public <T> SingleAddressHttpClientBuilder<U,R> socketOption(SocketOption<T> option, T value)
SingleAddressHttpClientBuilderSocketOption for all connections created by this builder.socketOption in interface SingleAddressHttpClientBuilder<U,R>T - the type of the value.option - the option to apply.value - the value.this.StandardSocketOptions,
ServiceTalkSocketOptionspublic SingleAddressHttpClientBuilder<U,R> enableWireLogging(String loggerName, LogLevel logLevel, BooleanSupplier logUserData)
SingleAddressHttpClientBuilderenableWireLogging in interface SingleAddressHttpClientBuilder<U,R>loggerName - The name of the logger to log wire events.logLevel - The level to log at.logUserData - true to include user data (e.g. data, headers, etc.). false to exclude user
data and log only network events. This method is invoked for each data object allowing for dynamic behavior.this.public SingleAddressHttpClientBuilder<U,R> protocols(HttpProtocolConfig... protocols)
SingleAddressHttpClientBuilderNote: the order of specified protocols will reflect on priorities for ALPN in case the connections use TLS.
protocols in interface SingleAddressHttpClientBuilder<U,R>protocols - HttpProtocolConfig for each protocol that should be supported.this.public SingleAddressHttpClientBuilder<U,R> hostHeaderFallback(boolean enable)
SingleAddressHttpClientBuilderHost headers by inferring from the address.
When false is passed, this setting disables the default filter such that no Host header will be
manipulated.
hostHeaderFallback in interface SingleAddressHttpClientBuilder<U,R>enable - Whether a default filter for inferring the Host headers should be added.thisSingleAddressHttpClientBuilder.unresolvedAddressToHost(Function)public SingleAddressHttpClientBuilder<U,R> allowDropResponseTrailers(boolean allowDrop)
SingleAddressHttpClientBuilderallowDropResponseTrailers in interface SingleAddressHttpClientBuilder<U,R>allowDrop - true if response
trailers are allowed to be dropped.thispublic SingleAddressHttpClientBuilder<U,R> appendConnectionFilter(StreamingHttpConnectionFilterFactory factory)
SingleAddressHttpClientBuilderStreamingHttpConnection created by this
builder.
Filtering allows you to wrap a StreamingHttpConnection and modify behavior during request/response
processing
Some potential candidates for filtering include logging, metrics, and decorating responses.
The order of execution of these filters are in order of append. If 3 filters are added as follows:
builder.appendConnectionFilter(filter1).appendConnectionFilter(filter2).appendConnectionFilter(filter3)
making a request to a connection wrapped by this filter chain the order of invocation of these filters will be:
filter1 ⇒ filter2 ⇒ filter3 ⇒ connection
appendConnectionFilter in interface SingleAddressHttpClientBuilder<U,R>factory - StreamingHttpConnectionFilterFactory to decorate a StreamingHttpConnection for the
purpose of filtering.thispublic SingleAddressHttpClientBuilder<U,R> appendConnectionFilter(Predicate<StreamingHttpRequest> predicate, StreamingHttpConnectionFilterFactory factory)
SingleAddressHttpClientBuilderStreamingHttpConnection created by this
builder, for every request that passes the provided Predicate.
Filtering allows you to wrap a StreamingHttpConnection and modify behavior during request/response
processing
Some potential candidates for filtering include logging, metrics, and decorating responses.
The order of execution of these filters are in order of append. If 3 filters are added as follows:
builder.appendConnectionFilter(filter1).appendConnectionFilter(filter2).appendConnectionFilter(filter3)
making a request to a connection wrapped by this filter chain the order of invocation of these filters will be:
filter1 ⇒ filter2 ⇒ filter3 ⇒ connection
When overriding this method, delegate to super as it uses internal utilities to provide a consistent
execution flow.
appendConnectionFilter in interface SingleAddressHttpClientBuilder<U,R>predicate - the Predicate to test if the filter must be applied.factory - StreamingHttpConnectionFilterFactory to decorate a StreamingHttpConnection for the
purpose of filtering.thispublic SingleAddressHttpClientBuilder<U,R> ioExecutor(IoExecutor ioExecutor)
IoExecutor for all clients created from this builder.ioExecutor in interface SingleAddressHttpClientBuilder<U,R>ioExecutor - IoExecutor to use.this.public SingleAddressHttpClientBuilder<U,R> executor(Executor executor)
Executor for all clients created from this builder.executor in interface SingleAddressHttpClientBuilder<U,R>executor - IoExecutor to use.this.public SingleAddressHttpClientBuilder<U,R> executionStrategy(HttpExecutionStrategy strategy)
SingleAddressHttpClientBuilderHttpExecutionStrategy to be used for client callbacks when executing client requests for all
clients created from this builder.
Specifying an execution strategy affects the offloading used during execution of client requests:
HttpExecutionStrategies.defaultStrategy()
SingleAddressHttpClientBuilder.appendClientFilter(StreamingHttpClientFilterFactory),
SingleAddressHttpClientBuilder.appendConnectionFilter(StreamingHttpConnectionFilterFactory), or
SingleAddressHttpClientBuilder.appendConnectionFactoryFilter(ConnectionFactoryFilter), etc. may also require offloading.
The execution strategy for execution of client requests will be computed based on the client API in use and
HttpExecutionStrategyInfluencer.requiredOffloads() of added the filters.
HttpExecutionStrategies.offloadNone()
(or deprecated HttpExecutionStrategies.offloadNever())
HttpExecutionStrategies.customStrategyBuilder()) or
HttpExecutionStrategies.offloadAll()
executionStrategy in interface SingleAddressHttpClientBuilder<U,R>strategy - HttpExecutionStrategy to use. If callbacks to the application code may block then those
callbacks must request to be offloaded.this.HttpExecutionStrategiespublic SingleAddressHttpClientBuilder<U,R> bufferAllocator(BufferAllocator allocator)
BufferAllocator for all clients created from this builder.bufferAllocator in interface SingleAddressHttpClientBuilder<U,R>allocator - BufferAllocator to use.this.public SingleAddressHttpClientBuilder<U,R> appendConnectionFactoryFilter(ConnectionFactoryFilter<R,FilterableStreamingHttpConnection> factory)
SingleAddressHttpClientBuilderConnectionFactory used by this
builder.
Filtering allows you to wrap a ConnectionFactory and modify behavior of
ConnectionFactory.newConnection(Object, ContextMap, TransportObserver).
Some potential candidates for filtering include logging and metrics.
The order of execution of these filters are in order of append. If 3 filters are added as follows:
builder
.appendConnectionFactoryFilter(filter1)
.appendConnectionFactoryFilter(filter2)
.appendConnectionFactoryFilter(filter3)
Calling ConnectionFactory wrapped by this filter chain, the order of invocation of these filters will be:
filter1 ⇒ filter2 ⇒ filter3 ⇒ original connection factory
appendConnectionFactoryFilter in interface SingleAddressHttpClientBuilder<U,R>factory - ConnectionFactoryFilter to use.thispublic SingleAddressHttpClientBuilder<U,R> appendClientFilter(StreamingHttpClientFilterFactory factory)
SingleAddressHttpClientBuilderHttpClient created by this
builder.
Note this method will be used to decorate the result of build() before it is returned to the user.
The order of execution of these filters are in order of append. If 3 filters are added as follows:
builder.appendClientFilter(filter1).appendClientFilter(filter2).appendClientFilter(filter3)
making a request to a client wrapped by this filter chain the order of invocation of these filters will be:
filter1 ⇒ filter2 ⇒ filter3 ⇒ client
appendClientFilter in interface SingleAddressHttpClientBuilder<U,R>factory - StreamingHttpClientFilterFactory to decorate a HttpClient for the purpose of
filtering.thispublic SingleAddressHttpClientBuilder<U,R> appendClientFilter(Predicate<StreamingHttpRequest> predicate, StreamingHttpClientFilterFactory factory)
SingleAddressHttpClientBuilderHttpClient created by this
builder, for every request that passes the provided Predicate.
Note this method will be used to decorate the result of build() before it is
returned to the user.
The order of execution of these filters are in order of append. If 3 filters are added as follows:
builder.appendClientFilter(filter1).appendClientFilter(filter2).appendClientFilter(filter3)
making a request to a client wrapped by this filter chain the order of invocation of these filters will be:
filter1 ⇒ filter2 ⇒ filter3 ⇒ client
appendClientFilter in interface SingleAddressHttpClientBuilder<U,R>predicate - the Predicate to test if the filter must be applied.factory - StreamingHttpClientFilterFactory to decorate a HttpClient for the purpose of
filtering.thispublic SingleAddressHttpClientBuilder<U,R> unresolvedAddressToHost(Function<U,CharSequence> unresolvedAddressToHostFunction)
SingleAddressHttpClientBuilderU unresolved address type into a CharSequence.
An example of where this maybe used is to convert the U to a default host header. It may also
be used in the event of proxying.unresolvedAddressToHost in interface SingleAddressHttpClientBuilder<U,R>unresolvedAddressToHostFunction - invoked to convert the U unresolved address type into a
CharSequence suitable for use in
Host Header format.thispublic SingleAddressHttpClientBuilder<U,R> serviceDiscoverer(ServiceDiscoverer<U,R,? extends ServiceDiscovererEvent<R>> serviceDiscoverer)
SingleAddressHttpClientBuilderServiceDiscoverer to resolve addresses of remote servers to connect to.serviceDiscoverer in interface SingleAddressHttpClientBuilder<U,R>serviceDiscoverer - The ServiceDiscoverer to resolve addresses of remote servers to connect to.
Lifecycle of the provided ServiceDiscoverer is managed externally and it should be
closed after all built StreamingHttpClients will be closed and
this ServiceDiscoverer is no longer needed.this.public SingleAddressHttpClientBuilder<U,R> retryServiceDiscoveryErrors(BiIntFunction<Throwable,? extends Completable> retryStrategy)
SingleAddressHttpClientBuilderServiceDiscoverer.retryServiceDiscoveryErrors in interface SingleAddressHttpClientBuilder<U,R>retryStrategy - a retry strategy to retry errors emitted by ServiceDiscoverer.this.RetryStrategiespublic SingleAddressHttpClientBuilder<U,R> loadBalancerFactory(HttpLoadBalancerFactory<R> loadBalancerFactory)
SingleAddressHttpClientBuilderHttpLoadBalancerFactory to create LoadBalancer instances.loadBalancerFactory in interface SingleAddressHttpClientBuilder<U,R>loadBalancerFactory - HttpLoadBalancerFactory to create LoadBalancer instances.this.public SingleAddressHttpClientBuilder<U,R> sslConfig(ClientSslConfig sslConfig)
SingleAddressHttpClientBuildersslConfig in interface SingleAddressHttpClientBuilder<U,R>sslConfig - The configuration to use.this.ClientSslConfigBuilderpublic SingleAddressHttpClientBuilder<U,R> inferPeerHost(boolean shouldInfer)
SingleAddressHttpClientBuilderClientSslConfig.peerHost()
from client's address when peer host is not specified. By default, inference is enabled.inferPeerHost in interface SingleAddressHttpClientBuilder<U,R>shouldInfer - value indicating whether inference is on (true) or off (false).thispublic SingleAddressHttpClientBuilder<U,R> inferPeerPort(boolean shouldInfer)
SingleAddressHttpClientBuilderClientSslConfig.peerPort()
from client's address when peer port is not specified (equals -1). By default, inference is enabled.inferPeerPort in interface SingleAddressHttpClientBuilder<U,R>shouldInfer - value indicating whether inference is on (true) or off (false).thispublic SingleAddressHttpClientBuilder<U,R> inferSniHostname(boolean shouldInfer)
SingleAddressHttpClientBuilderSingleAddressHttpClientBuilder.sslConfig(ClientSslConfig). By default, inference is enabled.inferSniHostname in interface SingleAddressHttpClientBuilder<U,R>shouldInfer - value indicating whether inference is on (true) or off (false).thispublic HttpClient build()
HttpClient.HttpClientpublic StreamingHttpClient buildStreaming()
StreamingHttpClient.StreamingHttpClientpublic BlockingHttpClient buildBlocking()
BlockingHttpClient.BlockingHttpClientpublic BlockingStreamingHttpClient buildBlockingStreaming()
BlockingStreamingHttpClient.BlockingStreamingHttpClient