You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Liliana.Neagul" <li...@gmail.com> on 2015/03/26 07:27:42 UTC

Apache Camel decodes HTTP query params and httpclient fails with Invalid query exception

Hi, 

I'm trying to send from a camel route an HTTP request using an encoded query
parameter (for symbol euro 
€), and it seems that camel decode the parameter and sent it to httpclient
decoded. Httpclient fails then with 'Invalid query' exception. 

My route is: 
from("jetty:http://localhost:5443/getCurrency") 
     .setHeader(Exchange.HTTP_METHOD, constant("GET")) 
     .setHeader(Exchange.HTTP_URI, simple(Constants.PATH+
"/code=EUR&symbol=%E2%82%AC&places=2")) 
     .to("http://host"); 

When Camel constructs the URI object, from Exchange, the  query parameter
'symbol' is decoded in '€'. 

Did someone succeed to pass encoded params? should I set some new headers to
camel route? 

Thanks for your help, 
Liliana



--
View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-decodes-HTTP-query-params-and-httpclient-fails-with-Invalid-query-exception-tp5764794.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Apache Camel decodes HTTP query params and httpclient fails with Invalid query exception

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I logged a ticket
https://issues.apache.org/jira/browse/CAMEL-8578

On Mon, Mar 30, 2015 at 10:58 AM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> Yeah sounds like a little bug. You are welcome to log a JIRA.
> http://camel.apache.org/contributing.html
>
> On Thu, Mar 26, 2015 at 3:56 PM, Liliana.Neagul
> <li...@gmail.com> wrote:
>> @Willem: Yes I tried to the parameter in Exchange.HTTP_QUERY header name. It
>> has the same behavior.
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-decodes-HTTP-query-params-and-httpclient-fails-with-Invalid-query-exception-tp5764794p5764843.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Apache Camel decodes HTTP query params and httpclient fails with Invalid query exception

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah sounds like a little bug. You are welcome to log a JIRA.
http://camel.apache.org/contributing.html

On Thu, Mar 26, 2015 at 3:56 PM, Liliana.Neagul
<li...@gmail.com> wrote:
> @Willem: Yes I tried to the parameter in Exchange.HTTP_QUERY header name. It
> has the same behavior.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-decodes-HTTP-query-params-and-httpclient-fails-with-Invalid-query-exception-tp5764794p5764843.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Apache Camel decodes HTTP query params and httpclient fails with Invalid query exception

Posted by "Liliana.Neagul" <li...@gmail.com>.
@Willem: Yes I tried to the parameter in Exchange.HTTP_QUERY header name. It
has the same behavior.



--
View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-decodes-HTTP-query-params-and-httpclient-fails-with-Invalid-query-exception-tp5764794p5764843.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Apache Camel decodes HTTP query params and httpclient fails with Invalid query exception

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

Did you try to setup the query parameter with the header name of Exchange.HTTP_QUERY?

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On March 26, 2015 at 2:28:41 PM, Liliana.Neagul (liliana.iovanovici@gmail.com) wrote:
> Hi,
>  
> I'm trying to send from a camel route an HTTP request using an encoded query
> parameter (for symbol euro
> €), and it seems that camel decode the parameter and sent it to httpclient
> decoded. Httpclient fails then with 'Invalid query' exception.
>  
> My route is:
> from("jetty:http://localhost:5443/getCurrency")
> .setHeader(Exchange.HTTP_METHOD, constant("GET"))
> .setHeader(Exchange.HTTP_URI, simple(Constants.PATH+
> "/code=EUR&symbol=%E2%82%AC&places=2"))
> .to("http://host");
>  
> When Camel constructs the URI object, from Exchange, the query parameter
> 'symbol' is decoded in '€'.
>  
> Did someone succeed to pass encoded params? should I set some new headers to
> camel route?
>  
> Thanks for your help,
> Liliana
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-decodes-HTTP-query-params-and-httpclient-fails-with-Invalid-query-exception-tp5764794.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  


Re: Apache Camel decodes HTTP query params and httpclient fails with Invalid query exception

Posted by "Liliana.Neagul" <li...@gmail.com>.
I'm using apache-camel version 2.14.1 





--
View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-decodes-HTTP-query-params-and-httpclient-fails-with-Invalid-query-exception-tp5764794p5764842.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Apache Camel decodes HTTP query params and httpclient fails with Invalid query exception

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

What version of Camel do you use?


On Thu, Mar 26, 2015 at 7:27 AM, Liliana.Neagul
<li...@gmail.com> wrote:
> Hi,
>
> I'm trying to send from a camel route an HTTP request using an encoded query
> parameter (for symbol euro
> €), and it seems that camel decode the parameter and sent it to httpclient
> decoded. Httpclient fails then with 'Invalid query' exception.
>
> My route is:
> from("jetty:http://localhost:5443/getCurrency")
>      .setHeader(Exchange.HTTP_METHOD, constant("GET"))
>      .setHeader(Exchange.HTTP_URI, simple(Constants.PATH+
> "/code=EUR&symbol=%E2%82%AC&places=2"))
>      .to("http://host");
>
> When Camel constructs the URI object, from Exchange, the  query parameter
> 'symbol' is decoded in '€'.
>
> Did someone succeed to pass encoded params? should I set some new headers to
> camel route?
>
> Thanks for your help,
> Liliana
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-decodes-HTTP-query-params-and-httpclient-fails-with-Invalid-query-exception-tp5764794.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/