Interface ApacheHttpClient5Factory
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Factory class that creates
HttpClient
instances based on the given Destination
.
Caution: Implementations must be thread-safe.
A default implementation of this interface can be instantiated by using the ApacheHttpClient5FactoryBuilder
.
- Since:
- 4.20.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault org.apache.hc.client5.http.classic.HttpClient
Creates anHttpClient
independent of any destination.org.apache.hc.client5.http.classic.HttpClient
createHttpClient
(HttpDestinationProperties destination) Creates anHttpClient
based on the givenHttpDestinationProperties
.
-
Method Details
-
createHttpClient
@Nonnull default org.apache.hc.client5.http.classic.HttpClient createHttpClient()Creates anHttpClient
independent of any destination.Caution: Implementations must ensure that this method is thread-safe.
- Returns:
- An
HttpClient
, independent of any destination. - Throws:
HttpClientInstantiationException
- if there occurred an error during the creation of the client.
-
createHttpClient
@Nonnull org.apache.hc.client5.http.classic.HttpClient createHttpClient(@Nullable HttpDestinationProperties destination) throws DestinationAccessException, HttpClientInstantiationException Creates anHttpClient
based on the givenHttpDestinationProperties
.Caution: Implementations must ensure that this method is thread-safe.
- Parameters:
destination
- The destination to create theHttpClient
for.- Returns:
- An
HttpClient
based on the given Destination. - Throws:
DestinationAccessException
- if the type of the destination is not HTTP.HttpClientInstantiationException
- if there occurred an error during the creation of the client.
-