hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Timeout
Date Thu, 16 Dec 2004 20:42:38 GMT
My bad. Good catch, Ilya. I'll commit a patch right away

Oleg

On Thu, 2004-12-16 at 20:06 +0200, Ilya Kharmatsky wrote:
> Hi, Oleg!
> 
> First I want to thank you for the help for previous question.
> 
> About timeout. As I can see in executeWithRetry method of HttpMethodDirector
> the flow checks only the parameters, coming from HttpMethodDirector 
> (params field)
> and from connection (conn.getParams). But no reference to parameters of
> the method itself...
> 
> Here is a simple patch in *executeWithRetry *method
> which helped me to resolve the problem:
> 
> Object param =
>       method.getParams().getParameter(HttpMethodParams.SO_TIMEOUT);
> if(param == null)
> {// see if a timeout is given for this method
>     param = this.params.getParameter(HttpMethodParams.SO_TIMEOUT);
>     if (param == null)
>     {
>         // if not, use the default value
>         param =
>         this.conn.getParams().getParameter(HttpConnectionParams.SO_TIMEOUT);
>       }
> }
> 
> Thank you for direction!
> 
> 
> 
> Oleg Kalnichevski wrote:
> 
> >Ilya,
> >
> >I seriously doubt that this is the case. See for yourself
> >
> >http://jakarta.apache.org/commons/httpclient/3.0/xref/org/apache/commons/httpclient/HttpMethodDirector.html#369
> >
> >Oleg
> >
> >On Thu, Dec 16, 2004 at 05:44:05PM +0200, Ilya Kharmatsky wrote:
> >  
> >
> >>I need to set the timeout for read/write for specific method.
> >>If I'm using HttpClientParameters - everything works as expected,
> >>after
> >>
> >>HttpClient client = new HttpClient();
> >>client.getParams().setSoTimeout(1000);
> >>GetMethod method = new GetMethod("http://www....");
> >>client.executeMethod(method);
> >>
> >>....
> >>
> >>In case, the server's response has been "too slow" - the 
> >>SocketTimeoutException
> >>will be thrown.
> >>
> >>But, if I want to set same for single HttpMethod (by using its 
> >>HttpMethodParameter)
> >>the timeout is ignored:
> >>
> >>HttpClient client = new HttpClient();
> >>GetMethod method = new GetMethod("http://www....");
> >>method.getParams().setSoTimeout(1000);
> >>client.executeMethod(method);
> >>
> >>Any ideas?
> >>
> >>Thanks,
> >>Ilya
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> >>
> >>    
> >>
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> >
> >  
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 


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


Mime
View raw message