Class DelegatingMultiAddressHttpClientBuilder<U,R>
- Type Parameters:
U- the type of address before resolution (unresolved address)R- the type of address after resolution (resolved address)
- All Implemented Interfaces:
MultiAddressHttpClientBuilder<U,R>
MultiAddressHttpClientBuilder that delegates all methods to another MultiAddressHttpClientBuilder.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.servicetalk.http.api.MultiAddressHttpClientBuilder
MultiAddressHttpClientBuilder.SingleAddressInitializer<U,R> -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance. -
Method Summary
Modifier and TypeMethodDescriptionAppends the filter to the chain of filters used to decorate theHttpClientcreated by this builder.appendClientFilter(Predicate<StreamingHttpRequest> predicate, StreamingHttpClientFilterFactory factory) Appends the filter to the chain of filters used to decorate theHttpClientcreated by this builder, for every request that passes the providedPredicate.bufferAllocator(BufferAllocator allocator) build()defaultHttpPort(int port) Configures the default port for the HTTP scheme if not explicitly provided as part of theHttpRequestMetaData.requestTarget().defaultHttpsPort(int port) Configures the default port for the HTTPS scheme if not explicitly provided as part of theHttpRequestMetaData.requestTarget().protected final MultiAddressHttpClientBuilder<U,R> delegate()Returns theMultiAddressHttpClientBuilderdelegate.executionStrategy(HttpExecutionStrategy strategy) Sets theHttpExecutionStrategyto be used for client callbacks when executing client requests for all clients created from this builder.followRedirects(RedirectConfig config) Configures redirection behavior.headersFactory(HttpHeadersFactory headersFactory) Sets theHttpHeadersFactoryto be used for creatingHttpHeadersfor new requests.initializer(MultiAddressHttpClientBuilder.SingleAddressInitializer<U, R> initializer) Set a function which can customize options for eachStreamingHttpClientthat is built.ioExecutor(IoExecutor ioExecutor) toString()
-
Constructor Details
-
DelegatingMultiAddressHttpClientBuilder
Create a new instance.- Parameters:
delegate-MultiAddressHttpClientBuilderto which all methods are delegated.
-
-
Method Details
-
delegate
Returns theMultiAddressHttpClientBuilderdelegate.- Returns:
- Delegate
MultiAddressHttpClientBuilder.
-
toString
-
ioExecutor
- Specified by:
ioExecutorin interfaceMultiAddressHttpClientBuilder<U,R>
-
executor
- Specified by:
executorin interfaceMultiAddressHttpClientBuilder<U,R>
-
executionStrategy
Description copied from interface:MultiAddressHttpClientBuilderSets theHttpExecutionStrategyto 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
SingleAddressHttpClientBuilderused to construct client instances. TheMultiAddressHttpClientBuilder.initializer(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
SingleAddressHttpClientBuilderinstances generated will also have default strategy. HttpExecutionStrategies.offloadNone()(or deprecatedHttpExecutionStrategies.offloadNever())SingleAddressHttpClientBuilderinstances 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. Aninitializermay override to add offloads usingSingleAddressHttpClientBuilder.executionStrategy(HttpExecutionStrategy).- A custom execution strategy (
HttpExecutionStrategies.customStrategyBuilder()) orHttpExecutionStrategies.offloadAll() SingleAddressHttpClientBuilderinstances created by the client will start with the provided strategy and may add additional offloading as required by added filters.
- Specified by:
executionStrategyin interfaceMultiAddressHttpClientBuilder<U,R> - Parameters:
strategy-HttpExecutionStrategyto use. If callbacks to the application code may block then those callbacks must request to be offloaded.- Returns:
this.- See Also:
- Unspecified or
-
bufferAllocator
- Specified by:
bufferAllocatorin interfaceMultiAddressHttpClientBuilder<U,R>
-
headersFactory
Description copied from interface:MultiAddressHttpClientBuilderSets theHttpHeadersFactoryto be used for creatingHttpHeadersfor new requests.- Specified by:
headersFactoryin interfaceMultiAddressHttpClientBuilder<U,R> - Parameters:
headersFactory-HttpHeadersFactoryto be used for creatingHttpHeadersfor new requests- Returns:
this
-
initializer
public MultiAddressHttpClientBuilder<U,R> initializer(MultiAddressHttpClientBuilder.SingleAddressInitializer<U, R> initializer) Description copied from interface:MultiAddressHttpClientBuilderSet a function which can customize options for eachStreamingHttpClientthat is built.- Specified by:
initializerin interfaceMultiAddressHttpClientBuilder<U,R> - Parameters:
initializer- Initializes theSingleAddressHttpClientBuilderused to build newStreamingHttpClients. SeeMultiAddressHttpClientBuilder.executionStrategy(HttpExecutionStrategy)for discussion of restrictions on the use ofSingleAddressHttpClientBuilder.executionStrategy(HttpExecutionStrategy)within an initializer.- Returns:
this
-
followRedirects
Description copied from interface:MultiAddressHttpClientBuilderConfigures redirection behavior.- Specified by:
followRedirectsin interfaceMultiAddressHttpClientBuilder<U,R> - Parameters:
config-RedirectConfigto 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. Usenullto disable redirects.Note that this filters location is last, or as if it had been appended right before building the client. If that is not the desired position you can disable redirects and use
MultiAddressHttpClientBuilder.appendClientFilter(StreamingHttpClientFilterFactory)to place theRedirectingHttpRequesterFilterin the position of your choice.- Returns:
this.- See Also:
-
defaultHttpPort
Description copied from interface:MultiAddressHttpClientBuilderConfigures the default port for the HTTP scheme if not explicitly provided as part of theHttpRequestMetaData.requestTarget().- Specified by:
defaultHttpPortin interfaceMultiAddressHttpClientBuilder<U,R> - Parameters:
port- the port that should be used if not explicitly provided for HTTP requests.- Returns:
this.
-
defaultHttpsPort
Description copied from interface:MultiAddressHttpClientBuilderConfigures the default port for the HTTPS scheme if not explicitly provided as part of theHttpRequestMetaData.requestTarget().- Specified by:
defaultHttpsPortin interfaceMultiAddressHttpClientBuilder<U,R> - Parameters:
port- the port that should be used if not explicitly provided for HTTPS requests.- Returns:
this.
-
build
-
buildStreaming
-
buildBlocking
-
buildBlockingStreaming
-
appendClientFilter
public MultiAddressHttpClientBuilder<U,R> appendClientFilter(StreamingHttpClientFilterFactory factory) Description copied from interface:MultiAddressHttpClientBuilderAppends the filter to the chain of filters used to decorate theHttpClientcreated 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 but will always be before any filters applied to the underlying single address clients. 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- Specified by:
appendClientFilterin interfaceMultiAddressHttpClientBuilder<U,R> - Parameters:
factory-StreamingHttpClientFilterFactoryto decorate aHttpClientfor the purpose of filtering.- Returns:
this- See Also:
-
appendClientFilter
public MultiAddressHttpClientBuilder<U,R> appendClientFilter(Predicate<StreamingHttpRequest> predicate, StreamingHttpClientFilterFactory factory) Description copied from interface:MultiAddressHttpClientBuilderAppends the filter to the chain of filters used to decorate theHttpClientcreated by this builder, for every request that passes the providedPredicate.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 but will always be before any filters applied to the underlying single address clients. 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- Specified by:
appendClientFilterin interfaceMultiAddressHttpClientBuilder<U,R> - Parameters:
predicate- thePredicateto test if the filter must be applied.factory-StreamingHttpClientFilterFactoryto decorate aHttpClientfor the purpose of filtering.- Returns:
this- See Also:
-