commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom van den Berge" <tom.vandenbe...@bibit.com>
Subject Re: [HttpClient] getting the http connection or setting the params
Date Fri, 08 Oct 2004 10:41:21 GMT
Hi,
HttpClient definitely has timeout settings. You can set a "connection"
timeout, which times out if the ip connection can't be set up quickly
enough, and you can set a "read" timeout, which will effectively abort
your request if the remote server does not respond quickly enough.

Both timeouts can be set in the HttpClient (setConnectionTimeout and
setTimeout, resp.)

If I understand you correctly, you're looking for the setTimeout method.
This will abort your (GET?) method when you execute it through the http
client.

I'm a bit confused with your remarks about method.getParams() and the
HttpMethod.abort(). They're not in my httpclient api! Are you talking
about httpclient 2.0.1?

Cheers,
Tom

> Hi Gustavo,
>
> Not sure what you mean by "setting the connection parameters".  All
> timeout params available on the connection are configurable via some
> HttpClient param.  Which timeout do you want to set?
>
> Though it is possible to get access to the actual connection it is
> highly discouraged.
>
> It sounds like you may want a method to abort a request after some
> time.  HttpClient does not have a built-in "request timeout" param, but
> it can be simulated.  You would need a thread separate from the one
> executing the method that keeps track of the method execution time.  If
> it went over a timeout value you could call HttpMethod.abort().
>
> Mike
>
> On Oct 7, 2004, at 6:17 PM, Gustavo Hexsel wrote:
>
>>   I'm using HttpClient to read a variable number of pages in sequence.
>>  I
>> have a "time frame" by which the page accesses (method execution and
>> all the
>> input stream reads) have to be done.  I tried calling
>>
>> method.getParams().setSoTimeout(remainingTime)
>>
>>   but it only sets the timeout once, just before opening the
>> connection.  Is
>> there a way of getting the http connection behind an executing http
>> method?
>> Or setting the connection parameters?
>>
>>   Thank you!
>>
>>     []s Gustavo
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message