You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Alex <al...@optonline.net> on 2006/03/20 01:19:20 UTC

common-httpclient socket timeout

I need to set a timeout parameter for a URL. To see if the site is timing
out, (if possible how long it takes to load the site), or just throw an
exception if website is not loaded within given time. 
 
I know I am doing something wrong in the code below, does someone know

HttpClient client = new HttpClient();

HttpClientParams clientParams = new HttpClientParams();
clientParams.setConnectionManagerTimeout(10000);

client.setParams(clientParams);

Thanks
Alex


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


[HTTPClient] URL Encoding

Posted by Kedar Panse <ke...@bancbridge.com>.
Greetings!

1. Are there any utility classes from which I can detect if a URL is 
encoded or not.  In case of redirects which I am handling manually, 
Sometimes url is encoded but some servers/sites provide it not encoded. 
Is there any smarter way of handling this?

2. I have seen some sites need + for a space and don't accept %20 (may 
be some one using manual parsing...).  But is there any way I can for 
URI class to use + and not %20 ?


Thanks!

Kedar

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


RE: common-httpclient socket timeout

Posted by Alex <al...@optonline.net>.
Am I using the code below correctly to check that it doesn't take URL over
10 seconds to load?

SimpleHttpConnectionManager mr = new SimpleHttpConnectionManager();
mr.getParams().setConnectionTimeout(10000);
HttpClient client = new HttpClient(mr);  


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


RE: common-httpclient socket timeout

Posted by Tahir Akhtar <ta...@spectrum-tech.com>.
As far as I know connection timeout property means this:

Abort the connection attempt if connection is not successfully *made* within
specified time limit.

This property is provided so that you can tell the API that I don’t want my
call to connect block for more than specified time. If you don't provide
this parameter than default TCP time-out of underlying implementation will
come into play.

This property has no effect once the connection is successfully made. It
does not dictate how much time connection can remain open.

You will have take a different approach if you want to check how much time
the site took to load, perhaps by taking system time before and after the
operation and subtracting them to find the duration.

Regards,
Tahir Akhtar
-----Original Message-----
From: Alex [mailto:alexny20@optonline.net] 
Sent: Monday, March 20, 2006 5:19 AM
To: 'Jakarta Commons Users List'
Subject: common-httpclient socket timeout

I need to set a timeout parameter for a URL. To see if the site is timing
out, (if possible how long it takes to load the site), or just throw an
exception if website is not loaded within given time. 
 
I know I am doing something wrong in the code below, does someone know

HttpClient client = new HttpClient();

HttpClientParams clientParams = new HttpClientParams();
clientParams.setConnectionManagerTimeout(10000);

client.setParams(clientParams);

Thanks
Alex


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

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.2.5/284 - Release Date: 3/17/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.2.5/284 - Release Date: 3/17/2006
 


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