HttpClient.setConnectionTimeout disappeared in Release 4.0

View: New views
4 Messages — Rating Filter:   Alert me  

HttpClient.setConnectionTimeout disappeared in Release 4.0

by Maximilian Eberl-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
For additional commands, e-mail: httpclient-users-help@...


Re: HttpClient.setConnectionTimeout disappeared in Release 4.0

by Ken Krugler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
> For additional commands, e-mail: httpclient-users-help@...
>

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


Re: HttpClient.setConnectionTimeout disappeared in Release 4.0

by Maximilian Eberl-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks a lot.
This should be mentioned in the 4.0 tutorial.

Max




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


Re: HttpClient.setConnectionTimeout disappeared in Release 4.0

by olegk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Maximilian Eberl wrote:
> Thanks a lot.
> This should be mentioned in the 4.0 tutorial.
>
> Max
>
>

Max,

You are very welcome to contribute more content for the tutorial.

Oleg

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