hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken Krugler <kkrugler_li...@transpac.com>
Subject Re: HttpClient.setConnectionTimeout disappeared in Release 4.0
Date Wed, 14 Oct 2009 20:19:46 GMT
Hi Maximilian,

The list of connection parameters can be found here:

http://hc.apache.org/httpcomponents-client/tutorial/html/connmgmt.html#d4e391

To use one of these settings, you need something like:

             HttpParams params = new BasicHttpParams();
             HttpConnectionParams.setConnectionTimeout(params,  
_connectionTimeout);
             ClientConnectionManager cm = new  
ThreadSafeClientConnManager(params, schemeRegistry);
             _httpClient = new DefaultHttpClient(cm, params);

See the init() method in the SimpleHttpFetcher.java class of the Bixo  
project:

http://github.com/emi/bixo/blob/master/src/main/java/bixo/fetcher/http/SimpleHttpFetcher.java

-- Ken

On Oct 14, 2009, at 11:52am, Maximilian Eberl wrote:

> Hi all!
>
> The method httpclient.setConnectionTimeout() in 3.x
> does no longer exist in 4.0
>
> Where do I set the timeout now?
> I googled a lot, searched the list archive
> and walked through the tutorial but could
> not find it.
>
> Do I have to rewrite my code to nio-based
> NHttpClient just to have the chance to set
> a connection timeout??
> (The default timeout is much too long.)
>
> Thank You in advance!
>
> Maximilian
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>

--------------------------
Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-210-6378


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message