Hi,
I confirm that the SO_TIMEOUT is the right property to set for timeout
connection. The code below works with http client API :
---------
HttpClient client = new HttpClient();
PostMethod method = new PostMethod("http://localhost:8080/MyResource";);
client.getParams().setParameter(HttpMethodParams.SO_TIMEOUT, 100);
try {
      StringRequestEntity entity= new StringRequestEntity("this
timeout works!", "text/xml; charset=UTF-8", "UTF-8");
method.setRequestEntity(entity);
// Execute the method.
int statusCode = client.executeMethod(method);

} catch (Exception e) {
e.printStackTrace();
} finally {
// Release the connection.
method.releaseConnection();
}
----------

The same variable "soTimeout" in the Camel URI is not taken into
account within camel http component.

Can you help

Thanks
LeRoy



On 6/4/09, Claus Ibsen <claus.ib...@gmail.com> wrote:
> Hi
>
> Try getting the timeout to work directly using HTTP client API. Then
> you know which settings work.
>
> Then setting the same option with the Camel URI should do the same.
> But maybe there is a gremlin in the code.
>
>
>
> On Thu, Jun 4, 2009 at 10:11 AM, LeRoy Michel <leroy...@googlemail.com>
> wrote:
>> Hi,
>>
>> I've tested http request with the following URI :
>>
>> "
>> http://localhost:8080/myResource?httpClient.soTimeout=10&httpClient.connectionManagerTimeout=20
>> "
>>
>> Even if I change the value of httpClient.soTimeout and
>> httpClient.connectionManagerTimeout parameters, the response time of
>> server
>> doesn't change.
>>
>> Is there any other way to set the timeout of an HTTP connection?
>>
>> Thanks for help.
>> LeRoy
>>
>>
>> On Thu, Jun 4, 2009 at 4:57 AM, Willem Jiang <willem.ji...@gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> The last one which sets the httpClient's parameter in the URI should
>>> work.
>>> I checked the HttpClientParams java doc, there is no properties of
>>> connectionTimeout, I think you need to try to use
>>> connectionManagerTimeout instead of connectionTimeout.
>>>
>>> BTW, In Camel 2.0, we have the parameter validation, you will get the
>>> ResolveEndpointFailedException if the parameter name is wrong.
>>>
>>> Willem
>>>
>>> LeRoy Michel wrote:
>>> > Hi,
>>> >
>>> > I would like to set the timeout of an http connection using camel http
>>> > component.
>>> > I read the the Camel http guide (http://camel.apache.org/http.html) and
>>> I've
>>> > tried  the following but it  doesn't work:
>>> >
>>> > public void process(Exchange exchange) throws Exception {
>>> >
>>> >             Map<String, Object> headers =
>>> > exchange.getIn().getHeaders();
>>> >             headers.put(HttpProducer.QUERY,
>>> > "httpClient.soTimeout=150&httpClient.connectionTimeout=150");
>>> >             template.sendBodyAndHeaders("http://myserver:8080";,
>>> exchange,
>>> > headers);
>>> > }
>>> >
>>> > I've also tried the following :
>>> >
>>> > public void process(Exchange exchange) throws Exception {
>>> >             template.send("
>>> >
>>> http://myserver:8080?httpClient.soTimeout=150&httpClient.connectionTimeout=150
>>> ",
>>> > exchange)
>>> > }
>>> >
>>> > Can you show me how I set the timeout of the HTTP connection in Camel
>>> > 1.x
>>> >
>>> > Thanks
>>> > Leroy
>>> >
>>>
>>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>

Reply via email to