camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: camel-http: Multiple Request Paramaters
Date Fri, 29 Jul 2011 06:38:54 GMT
On Fri, Jul 29, 2011 at 8:11 AM, Willem Jiang <willem.jiang@gmail.com> wrote:
> If the Map.toString() supports to generate a right query string, I think you
> don't need to change other part camel code.
>

Thats a bit unusual to have a custom Map implementation to override
the toString to return that in a URL like style.

As we love contributions, fell free to take a stab at implementing
support for a Map in the HTTP_QUERY header.
Mind that we have several HTTP components that all need to be adjusted :)
- camel-ahc
- camel-http
- camel-http4
- camel-jetty (producer, has shared code with camel-http)

And as always please provide an unit test as well.


> On 7/29/11 5:04 AM, daveharris wrote:
>>
>> Hi Claus,
>> Thanks for the reply.
>>
>> For anyone else searching for the solution, I ended up using a processor
>> to
>> use a javax.ws.rs.core.UriBuilder in jdk6.  My main aim was to get a
>> solution where I didn't have to write the ? and&  which is very brittle.
>>
>> .process(new Processor() {
>>   public void process(Exchange exchange) throws Exception {
>>     Message in = exchange.getIn();
>>
>>     javax.ws.rs.core.UriBuilder uriBuilder =
>> javax.ws.rs.core.UriBuilder.fromUri("http://localhost");
>>     uriBuilder.queryParam("app", in.getHeader(APPLICATION, String.class));
>>     uriBuilder.queryParam("from", in.getHeader(FROM, String.class));
>>     uriBuilder.queryParam("to", in.getHeader(TO, String.class));
>>     uriBuilder.queryParam("msg", in.getBody(String.class));
>>
>>     in.setHeader(Exchange.HTTP_QUERY, uriBuilder.build().getRawQuery());
>>   }
>> })
>>
>> This works but it would be really nice to be able to provide a map ie.
>> in.setHeader(Exchange.HTTP_QUERY, Map&lt;String, String&gt;).
>>
>> I would be happy to have a go at implementing this, unless anyone has any
>> objections.
>>
>> Dave
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/camel-http-Multiple-Request-Paramaters-tp4641050p4644228.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
> --
> Willem
> ----------------------------------
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>         http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
> Weibo: willemjiang
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message