Class 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 Detail

      • 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 Detail

      • HttpClientFactory

        public HttpClientFactory()
    • Method Detail

      • 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