Interface ClientHttpRequestFactoryBuilder<T extends ClientHttpRequestFactory>
- Type Parameters:
T- theClientHttpRequestFactorytype
- All Known Implementing Classes:
HttpComponentsClientHttpRequestFactoryBuilder,JdkClientHttpRequestFactoryBuilder,JettyClientHttpRequestFactoryBuilder,ReactorClientHttpRequestFactoryBuilder,SimpleClientHttpRequestFactoryBuilder
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public interface ClientHttpRequestFactoryBuilder<T extends ClientHttpRequestFactory>
Interface used to build a fully configured
ClientHttpRequestFactory. Builders
for Apache HTTP Components, Jetty,
Reactor, JDK and simple client can
be obtained using the factory methods on this interface. The of(Class) and
of(Supplier) methods may be used to instantiate other
ClientHttpRequestFactory instances using reflection.- Since:
- 3.4.0
- Author:
- Phillip Webb
-
Method Summary
Modifier and TypeMethodDescriptiondefault Tbuild()Build a default configuredClientHttpRequestFactory.build(ClientHttpRequestFactorySettings settings) Build a fully configuredClientHttpRequestFactory, applying the givensettingsif they are provided.static ClientHttpRequestFactoryBuilder<? extends ClientHttpRequestFactory>detect()Detect the most suitableClientHttpRequestFactoryBuilderbased on the classpath.static ClientHttpRequestFactoryBuilder<? extends ClientHttpRequestFactory>detect(ClassLoader classLoader) Detect the most suitableClientHttpRequestFactoryBuilderbased on the classpath.Return aHttpComponentsClientHttpRequestFactoryBuilderthat can be used to build aHttpComponentsClientHttpRequestFactory.jdk()Return aJdkClientHttpRequestFactoryBuilderthat can be used to build aJdkClientHttpRequestFactory.jetty()Return aJettyClientHttpRequestFactoryBuilderthat can be used to build aJettyClientHttpRequestFactory.static <T extends ClientHttpRequestFactory>
ClientHttpRequestFactoryBuilder<T>Return a newClientHttpRequestFactoryBuilderfor the givenrequestFactoryType.static <T extends ClientHttpRequestFactory>
ClientHttpRequestFactoryBuilder<T>Return a newClientHttpRequestFactoryBuilderfrom the given supplier, using reflection to ultimately apply theClientHttpRequestFactorySettings.reactor()Return aReactorClientHttpRequestFactoryBuilderthat can be used to build aReactorClientHttpRequestFactory.simple()Return aSimpleClientHttpRequestFactoryBuilderthat can be used to build aSimpleClientHttpRequestFactory.default ClientHttpRequestFactoryBuilder<T>withCustomizer(Consumer<T> customizer) Return a newClientHttpRequestFactoryBuilderthat applies the given customizer to theClientHttpRequestFactoryafter it has been built.default ClientHttpRequestFactoryBuilder<T>withCustomizers(Collection<Consumer<T>> customizers) Return a newClientHttpRequestFactoryBuilderthat applies the given customizers to theClientHttpRequestFactoryafter it has been built.
-
Method Details
-
build
Build a default configuredClientHttpRequestFactory.- Returns:
- a default configured
ClientHttpRequestFactory.
-
build
Build a fully configuredClientHttpRequestFactory, applying the givensettingsif they are provided.- Parameters:
settings- the settings to apply ornull- Returns:
- a fully configured
ClientHttpRequestFactory.
-
withCustomizer
Return a newClientHttpRequestFactoryBuilderthat applies the given customizer to theClientHttpRequestFactoryafter it has been built.- Parameters:
customizer- the customizers to apply- Returns:
- a new
ClientHttpRequestFactoryBuilderinstance
-
withCustomizers
Return a newClientHttpRequestFactoryBuilderthat applies the given customizers to theClientHttpRequestFactoryafter it has been built.- Parameters:
customizers- the customizers to apply- Returns:
- a new
ClientHttpRequestFactoryBuilderinstance
-
httpComponents
Return aHttpComponentsClientHttpRequestFactoryBuilderthat can be used to build aHttpComponentsClientHttpRequestFactory.- Returns:
- a new
HttpComponentsClientHttpRequestFactoryBuilder
-
jetty
Return aJettyClientHttpRequestFactoryBuilderthat can be used to build aJettyClientHttpRequestFactory.- Returns:
- a new
JettyClientHttpRequestFactoryBuilder
-
reactor
Return aReactorClientHttpRequestFactoryBuilderthat can be used to build aReactorClientHttpRequestFactory.- Returns:
- a new
ReactorClientHttpRequestFactoryBuilder
-
jdk
Return aJdkClientHttpRequestFactoryBuilderthat can be used to build aJdkClientHttpRequestFactory.- Returns:
- a new
JdkClientHttpRequestFactoryBuilder
-
simple
Return aSimpleClientHttpRequestFactoryBuilderthat can be used to build aSimpleClientHttpRequestFactory.- Returns:
- a new
SimpleClientHttpRequestFactoryBuilder
-
of
static <T extends ClientHttpRequestFactory> ClientHttpRequestFactoryBuilder<T> of(Class<T> requestFactoryType) Return a newClientHttpRequestFactoryBuilderfor the givenrequestFactoryType. The following implementations are supported without the use of reflection:- Type Parameters:
T- theClientHttpRequestFactorytype- Parameters:
requestFactoryType- theClientHttpRequestFactorytype- Returns:
- a new
ClientHttpRequestFactoryBuilder
-
of
static <T extends ClientHttpRequestFactory> ClientHttpRequestFactoryBuilder<T> of(Supplier<T> requestFactorySupplier) Return a newClientHttpRequestFactoryBuilderfrom the given supplier, using reflection to ultimately apply theClientHttpRequestFactorySettings.- Type Parameters:
T- theClientHttpRequestFactorytype- Parameters:
requestFactorySupplier- theClientHttpRequestFactorysupplier- Returns:
- a new
ClientHttpRequestFactoryBuilder
-
detect
Detect the most suitableClientHttpRequestFactoryBuilderbased on the classpath. The method favors builders in the following order:- Returns:
- the most suitable
ClientHttpRequestFactoryBuilderfor the classpath
-
detect
static ClientHttpRequestFactoryBuilder<? extends ClientHttpRequestFactory> detect(ClassLoader classLoader) Detect the most suitableClientHttpRequestFactoryBuilderbased on the classpath. The method favors builders in the following order:- Parameters:
classLoader- the class loader to use for detection- Returns:
- the most suitable
ClientHttpRequestFactoryBuilderfor the classpath - Since:
- 3.5.0
-