Package com.avoka.component.http
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 int
DEFAULT_CONNECT_TIMEOUT
The default connection timeout (10,000 ms).static int
DEFAULT_SOCKET_TIMEOUT
The default connection timeout (60,000 ms).
-
Constructor Summary
Constructors Constructor Description HttpClientFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.http.impl.client.CloseableHttpClient
createSystemClient()
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.
-
-
-
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
-
-
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 millisecondssocketTimeout
- 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
-
-