Interface ClientHttpRequestFactoryBuilder<T extends ClientHttpRequestFactory>
- Type Parameters:
T
- theClientHttpRequestFactory
type
- 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 T
build()
Build a default configuredClientHttpRequestFactory
.build
(ClientHttpRequestFactorySettings settings) Build a fully configuredClientHttpRequestFactory
, applying the givensettings
if they are provided.static ClientHttpRequestFactoryBuilder<? extends ClientHttpRequestFactory>
detect()
Detect the most suitableClientHttpRequestFactoryBuilder
based on the classpath.Return aHttpComponentsClientHttpRequestFactoryBuilder
that can be used to build aHttpComponentsClientHttpRequestFactory
.jdk()
Return aJdkClientHttpRequestFactoryBuilder
that can be used to build aJdkClientHttpRequestFactory
.jetty()
Return aJettyClientHttpRequestFactoryBuilder
that can be used to build aJettyClientHttpRequestFactory
.static <T extends ClientHttpRequestFactory>
ClientHttpRequestFactoryBuilder<T>Return a newClientHttpRequestFactoryBuilder
for the givenrequestFactoryType
.static <T extends ClientHttpRequestFactory>
ClientHttpRequestFactoryBuilder<T>Return a newClientHttpRequestFactoryBuilder
from the given supplier, using reflection to ultimately apply theClientHttpRequestFactorySettings
.reactor()
Return aReactorClientHttpRequestFactoryBuilder
that can be used to build aReactorClientHttpRequestFactory
.simple()
Return aSimpleClientHttpRequestFactoryBuilder
that can be used to build aSimpleClientHttpRequestFactory
.default ClientHttpRequestFactoryBuilder<T>
withCustomizer
(Consumer<T> customizer) Return a newClientHttpRequestFactoryBuilder
that applies the given customizer to theClientHttpRequestFactory
after it has been built.default ClientHttpRequestFactoryBuilder<T>
withCustomizers
(Collection<Consumer<T>> customizers) Return a newClientHttpRequestFactoryBuilder
that applies the given customizers to theClientHttpRequestFactory
after it has been built.
-
Method Details
-
build
Build a default configuredClientHttpRequestFactory
.- Returns:
- a default configured
ClientHttpRequestFactory
.
-
build
Build a fully configuredClientHttpRequestFactory
, applying the givensettings
if they are provided.- Parameters:
settings
- the settings to apply ornull
- Returns:
- a fully configured
ClientHttpRequestFactory
.
-
withCustomizer
Return a newClientHttpRequestFactoryBuilder
that applies the given customizer to theClientHttpRequestFactory
after it has been built.- Parameters:
customizer
- the customizers to apply- Returns:
- a new
ClientHttpRequestFactoryBuilder
instance
-
withCustomizers
Return a newClientHttpRequestFactoryBuilder
that applies the given customizers to theClientHttpRequestFactory
after it has been built.- Parameters:
customizers
- the customizers to apply- Returns:
- a new
ClientHttpRequestFactoryBuilder
instance
-
httpComponents
Return aHttpComponentsClientHttpRequestFactoryBuilder
that can be used to build aHttpComponentsClientHttpRequestFactory
.- Returns:
- a new
HttpComponentsClientHttpRequestFactoryBuilder
-
jetty
Return aJettyClientHttpRequestFactoryBuilder
that can be used to build aJettyClientHttpRequestFactory
.- Returns:
- a new
JettyClientHttpRequestFactoryBuilder
-
reactor
Return aReactorClientHttpRequestFactoryBuilder
that can be used to build aReactorClientHttpRequestFactory
.- Returns:
- a new
ReactorClientHttpRequestFactoryBuilder
-
jdk
Return aJdkClientHttpRequestFactoryBuilder
that can be used to build aJdkClientHttpRequestFactory
.- Returns:
- a new
JdkClientHttpRequestFactoryBuilder
-
simple
Return aSimpleClientHttpRequestFactoryBuilder
that can be used to build aSimpleClientHttpRequestFactory
.- Returns:
- a new
SimpleClientHttpRequestFactoryBuilder
-
of
static <T extends ClientHttpRequestFactory> ClientHttpRequestFactoryBuilder<T> of(Class<T> requestFactoryType) Return a newClientHttpRequestFactoryBuilder
for the givenrequestFactoryType
. The following implementations are supported without the use of reflection:- Type Parameters:
T
- theClientHttpRequestFactory
type- Parameters:
requestFactoryType
- theClientHttpRequestFactory
type- Returns:
- a new
ClientHttpRequestFactoryBuilder
-
of
static <T extends ClientHttpRequestFactory> ClientHttpRequestFactoryBuilder<T> of(Supplier<T> requestFactorySupplier) Return a newClientHttpRequestFactoryBuilder
from the given supplier, using reflection to ultimately apply theClientHttpRequestFactorySettings
.- Type Parameters:
T
- theClientHttpRequestFactory
type- Parameters:
requestFactorySupplier
- theClientHttpRequestFactory
supplier- Returns:
- a new
ClientHttpRequestFactoryBuilder
-
detect
Detect the most suitableClientHttpRequestFactoryBuilder
based on the classpath. The methods favors builders in the following order:- Returns:
- the most suitable
ClientHttpRequestFactoryBuilder
for the classpath
-