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.

@FunctionalInterface public interface ApacheHttpClient5Factory
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 Type
    Method
    Description
    default org.apache.hc.client5.http.classic.HttpClient
    Creates an HttpClient independent of any destination.
    org.apache.hc.client5.http.classic.HttpClient
    Creates an HttpClient based on the given HttpDestinationProperties.
  • Method Details

    • createHttpClient

      @Nonnull default org.apache.hc.client5.http.classic.HttpClient createHttpClient()
      Creates an HttpClient 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 an HttpClient based on the given HttpDestinationProperties.

      Caution: Implementations must ensure that this method is thread-safe.

      Parameters:
      destination - The destination to create the HttpClient 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.