Interface HttpClientFactory

All Known Implementing Classes:
AbstractHttpClientFactory, DefaultHttpClientFactory
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 HttpClientFactory
Factory class that creates HttpClient instances based on the given Destination.

Caution: Implementations must be thread-safe.

  • Method Details

    • createHttpClient

      @Nonnull default org.apache.http.client.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.http.client.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.