You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by "Shih-liang, Chang" <at...@icloud.com> on 2014/09/21 13:04:56 UTC

Custom httpclient configuration

Hi

I'm using the HttpClient 4.4. 
I am creating HttpClient instance using custom settings. Is the following configuration the same effect? or whats the different between them? I can’t find it in javadoc.
A.
SocketConfig socketConfig = SocketConfig.custom()
    .setSoTimeout(DEFAULT_SOCKET_TIMEOUT)
    .build();
CloseableHttpClient httpClient = HttpClients.custom()
     .setDefaultSocketConfig(socketConfig)
     .build();


B.


RequestConfig requestConfig = RequestConfig.custom()
    .setSocketTimeout(DEFAULT_SOCKET_TIMEOUT)
    .build();
CloseableHttpClient httpClient = HttpClients.custom()
     .setDefaultRequestConfig(requestConfig)
     .build();


Thanks in advance.
BR,
Atkins

Re: Custom httpclient configuration

Posted by Jaikit Savla <ja...@yahoo.com.INVALID>.
RequestConfig represents request level parameters. Socket and connect
timeout values, if non-zero, override those used by default.


Thread below was specific to HttpAsync client but for Sync client also it should stand true. 
http://mail-archives.apache.org/mod_mbox/hc-httpclient-users/201310.mbox/%3C1382089744.18812.32.camel@ubuntu%3E

Thanks,
Jaikit


On Sunday, September 21, 2014 4:05 AM, "Shih-liang, Chang" <at...@icloud.com> wrote:



Hi

I'm using the HttpClient 4.4. 
I am creating HttpClient instance using custom settings. Is the following configuration the same effect? or whats the different between them? I can’t find it in javadoc.
A.
SocketConfig socketConfig = SocketConfig.custom()
    .setSoTimeout(DEFAULT_SOCKET_TIMEOUT)
    .build();
CloseableHttpClient httpClient = HttpClients.custom()
     .setDefaultSocketConfig(socketConfig)
     .build();


B.


RequestConfig requestConfig = RequestConfig.custom()
    .setSocketTimeout(DEFAULT_SOCKET_TIMEOUT)
    .build();
CloseableHttpClient httpClient = HttpClients.custom()
     .setDefaultRequestConfig(requestConfig)
     .build();


Thanks in advance.
BR,
Atkins

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org