You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by vkarkhanis <vk...@gmail.com> on 2014/05/15 17:40:45 UTC

Passing more than one URL parameter using stream:url

Hello,
Here is our requirement:

from("timer://foo?repeatCount=1").
     
to("stream:url?'url=http://servername/tmp/test.cgi?param1=10&param2=qa'?").
      ("file:U://sampleFile?fileName=hello.txt");
      
   
When i try the above with an intent of obtaining a http request with two
query params,
and reading the response, camel gives me an error env=qa is not a valid
option
This works with    

   to("stream:url?'url=http://servername/tmp/test.cgi?param1=10'?")
 
 Ami i doing it right ? or is there a different syntax to pass multiple
query params



Thank you,
Regards

Vaibhav A. Karkhanis










--
View this message in context: http://camel.465427.n5.nabble.com/Passing-more-than-one-URL-parameter-using-stream-url-tp5751164.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Passing more than one URL parameter using stream:url

Posted by Antoine DESSAIGNE <an...@gmail.com>.
Hi,

You need to tell camel to take the url parameter without performing any
changes by using the RAW(...) notation. Here's an example

String url = "
http://api.openweathermap.org/data/2.5/weather?q=London&mode=xml";
from(String.format("stream:url?url=RAW(%s)", url))
        .to("file:D://camel-test?fileName=test.txt&fileExist=Append");

Also note that since stream creates one message per line, I'm concatenating
the content by using fileExist=Append on the file url.

Hope this helps,

Antoine.



2014-05-15 17:40 GMT+02:00 vkarkhanis <vk...@gmail.com>:

> Hello,
> Here is our requirement:
>
> from("timer://foo?repeatCount=1").
>
> to("stream:url?'url=http://servername/tmp/test.cgi?param1=10&param2=qa'
> ?").
>       ("file:U://sampleFile?fileName=hello.txt");
>
>
> When i try the above with an intent of obtaining a http request with two
> query params,
> and reading the response, camel gives me an error env=qa is not a valid
> option
> This works with
>
>    to("stream:url?'url=http://servername/tmp/test.cgi?param1=10'?")
>
>  Ami i doing it right ? or is there a different syntax to pass multiple
> query params
>
>
>
> Thank you,
> Regards
>
> Vaibhav A. Karkhanis
>
>
>
>
>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Passing-more-than-one-URL-parameter-using-stream-url-tp5751164.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>