Package com.avoka.component.http
Class HttpClientFactory
java.lang.Object
com.avoka.component.http.HttpClientFactory
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
Modifier and TypeFieldDescriptionstatic final int
The default connection timeout (10,000 ms).static final int
The default connection timeout (60,000 ms). -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.
-
Field Details
-
DEFAULT_CONNECT_TIMEOUT
public static final int DEFAULT_CONNECT_TIMEOUTThe 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_TIMEOUTThe 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 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
-