+1 for adding timeouts
Currently HttpClient does not seem to have a way to set the timeout.
(I'm just a user and I might be wrong)
However it should be easy to implement since the HttpConnection uses
Java.net.Socket inside.
The following snippet should do the trick if added to HttpConnection
/**
* Set my {@link Socket}'s timeout, via
* {@link Socket#setSoTimeout}.
* @throws SocketException - if there is an error in the underlying
* protocol, such as a TCP error.
* @throws IllegalStateException if I am not connected
*/
public void setSoTimeout(int timeout)
throws SocketException, IllegalStateException {
log.debug("HttpConnection.setSoTimeout()");
assertOpen();
_socket.setSoTimeout(int timeout);
}
Please correct me if I'm wrong, or respond with a good argument why this
would be a bad way to do it.
An alternative to changing the public API would be to add a protected
method getSocket() so that extending HttpConnection to support timeouts
would be possible.
/Fredrik Lindgren
[EMAIL PROTECTED] wrote:
> Hello,
>
> I would imagine that this is a very frequently asked question, but I could not find
>any mention of it in the list archives.
>
> Does Commons' httpclient have a way of setting a connection timeout?
> I looked at the API javadocs and could not find a way to do it.
>
> If there is no way to do it does httpclient block when it encounters super slow
>connections?
>
> Thanks,
> Otis
>
> _________________________________________________________________
> iVillage.com: Solutions for Your Life
> Check out the most exciting women's community on the Web
> http://www.ivillage.com
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>