You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Minh Tran <da...@gmail.com> on 2015/08/27 05:16:45 UTC

http4 ignoring CamelHttpPath

Hi

I've come across a strange behaviour with the http4 component on 2.15.2. If I have the following in my route

<setHeader headerName="CamelHttpPath">
	<constant>/my/path</constant>
</setHeader>
<to uri="http4:myhost:80"/>

then it works just fine hitting http://myhost:80/my/path


However I now have a need to set the connect and read timeouts on this so I've done the following

<setHeader headerName="CamelHttpPath">
	<constant>/my/path</constant>
</setHeader>
<to uri="http4:myhost:80?httpclient.connectTimeout=10000&amp;httpclient.socketTimeout=120000"/>


Now it ignores the CamelHttpPath header and hits http://myhost:80. I can verify this by enabling logging in httpclient.

If I then change it to the following where I add the path directly to the uri and skip the setHeader element

<to uri="http4:myhost:80/my/path?httpclient.connectTimeout=10000&amp;httpclient.socketTimeout=120000 "/>

It hits the correct link. So it looks like the CamelHttpPath gets ignored if I add any options to the http4 uri. Is this expected behaviour?

Thanks
Minh

Re: http4 ignoring CamelHttpPath

Posted by Minh Tran <da...@gmail.com>.
Oh I didn't notice the incorrect case. Thanks for looking into this, much appreciated!

On 28/08/2015, at 7:53 AM, Raul Kripalani <ra...@evosent.com> wrote:

> On Thu, Aug 27, 2015 at 4:16 AM, Minh Tran <da...@gmail.com> wrote:
> 
>> <to
>> uri="http4:myhost:80?httpclient.connectTimeout=10000&amp;httpclient.socketTimeout=120000"/>
>> 
> 
> You have a typo related to casing. The option prefixes are httpClient
> (capital C, using lowerCamelCase).
> 
> Nevertheless, we do have a bug because your options are being interpreted
> as query parameters, so Camel should really be invoking this URL:
> 
> http://myhost:80/my/path?httpclient.connectTimeout=10000&httpclient.socketTimeout=120000
> 
> But is instead using this URL:
> 
> http://myhost:80?httpclient.connectTimeout=10000&httpclient.socketTimeout=120000/my/path
> 
> (path and query parameters are concatenated in the wrong order).
> 
> Working on that: CAMEL-9104
> 
> Regards,
> 
> *Raúl Kripalani*
> Apache Camel PMC Member & Committer | Enterprise Architect, Open Source
> Integration specialist
> http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
> http://blog.raulkr.net | twitter: @raulvk


Re: http4 ignoring CamelHttpPath

Posted by Raul Kripalani <ra...@evosent.com>.
On Thu, Aug 27, 2015 at 4:16 AM, Minh Tran <da...@gmail.com> wrote:

> <to
> uri="http4:myhost:80?httpclient.connectTimeout=10000&amp;httpclient.socketTimeout=120000"/>
>

You have a typo related to casing. The option prefixes are httpClient
(capital C, using lowerCamelCase).

Nevertheless, we do have a bug because your options are being interpreted
as query parameters, so Camel should really be invoking this URL:

http://myhost:80/my/path?httpclient.connectTimeout=10000&httpclient.socketTimeout=120000

But is instead using this URL:

http://myhost:80?httpclient.connectTimeout=10000&httpclient.socketTimeout=120000/my/path

(path and query parameters are concatenated in the wrong order).

Working on that: CAMEL-9104

Regards,

*Raúl Kripalani*
Apache Camel PMC Member & Committer | Enterprise Architect, Open Source
Integration specialist
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk

Re: http4 ignoring CamelHttpPath

Posted by Raul Kripalani <ra...@evosent.com>.
I don't think it's expected behaviour. Normally I configure timeouts and
the like in the AsyncHttpClientConfig directly. Doing that, the
CamelHttpPath header works properly.

I will check what you said, but it definitely sounds like a bug.

Raúl.
On 27 Aug 2015 04:17, "Minh Tran" <da...@gmail.com> wrote:

> Hi
>
> I've come across a strange behaviour with the http4 component on 2.15.2.
> If I have the following in my route
>
> <setHeader headerName="CamelHttpPath">
>         <constant>/my/path</constant>
> </setHeader>
> <to uri="http4:myhost:80"/>
>
> then it works just fine hitting http://myhost:80/my/path
>
>
> However I now have a need to set the connect and read timeouts on this so
> I've done the following
>
> <setHeader headerName="CamelHttpPath">
>         <constant>/my/path</constant>
> </setHeader>
> <to
> uri="http4:myhost:80?httpclient.connectTimeout=10000&amp;httpclient.socketTimeout=120000"/>
>
>
> Now it ignores the CamelHttpPath header and hits http://myhost:80. I can
> verify this by enabling logging in httpclient.
>
> If I then change it to the following where I add the path directly to the
> uri and skip the setHeader element
>
> <to
> uri="http4:myhost:80/my/path?httpclient.connectTimeout=10000&amp;httpclient.socketTimeout=120000
> "/>
>
> It hits the correct link. So it looks like the CamelHttpPath gets ignored
> if I add any options to the http4 uri. Is this expected behaviour?
>
> Thanks
> Minh