Class HttpClientFactory

java.lang.Object
com.avoka.component.http.HttpClientFactory

public class HttpClientFactory extends Object
Provides factory methods for creating Apache HttpClient objects with system property configurations.

HttpClient object will use the JVM System Property proxy configurations if defined and the connection and socket timeouts if defined.

Since:
4.2.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The default connection timeout (10,000 ms).
    static final int
    The default connection timeout (60,000 ms).
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.http.impl.client.CloseableHttpClient
    Create an HttpClient object with the system property configurations.
    static org.apache.http.impl.client.CloseableHttpClient
    createSystemClient(int connectTimeout, int socketTimeout)
    Create an HttpClient object with the given connection and socket timeouts.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_CONNECT_TIMEOUT

      public static final int DEFAULT_CONNECT_TIMEOUT
      The default connection timeout (10,000 ms). Configurable with the JVM system property: com.avoka.component.httclient.connectTimeout
    • DEFAULT_SOCKET_TIMEOUT

      public static final int DEFAULT_SOCKET_TIMEOUT
      The default connection timeout (60,000 ms). Configurable with the JVM system property: com.avoka.component.httclient.socketTimeout
  • Constructor Details

    • HttpClientFactory

      public HttpClientFactory()
  • Method Details

    • createSystemClient

      public static org.apache.http.impl.client.CloseableHttpClient createSystemClient(int connectTimeout, int socketTimeout)
      Create an HttpClient object with the given connection and socket timeouts.
      Parameters:
      connectTimeout - the connection timeout in milliseconds
      socketTimeout - the socket timeout in milliseconds
      Returns:
      a new HttpClient object with the given connection and socket timeouts
    • createSystemClient

      public static org.apache.http.impl.client.CloseableHttpClient createSystemClient()
      Create an HttpClient object with the system property configurations.
      Returns:
      a new HttpClient object with the system property configurations