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.HttpClientCreates anHttpClientindependent of any destination.org.apache.hc.client5.http.classic.HttpClientcreateHttpClient(HttpDestinationProperties destination) Creates anHttpClientbased on the givenHttpDestinationProperties.
-
Method Details
-
createHttpClient
@Nonnull default org.apache.hc.client5.http.classic.HttpClient createHttpClient()Creates anHttpClientindependent 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 anHttpClientbased on the givenHttpDestinationProperties.Caution: Implementations must ensure that this method is thread-safe.
- Parameters:
destination- The destination to create theHttpClientfor.- Returns:
- An
HttpClientbased 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.
-