camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: [DISCUSS] - Supporting multiple parameter values in http components
Date Tue, 12 Jul 2011 13:06:38 GMT
Okay I have attached a work in progress patch to the ticket.

Would be nice if the community could take a look.
I had for a brief moment considered creating a MultiValueList in
camel-core to hold the multi values.
But I opted for just adding a method to HttpHelper.

I added some unit tests which does a multi header request, and
receives a multi header response as well.
The tests is in camel-jetty, and they test using camel-http and
camel-jetty producers.



On Tue, Jul 12, 2011 at 1:52 PM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
> Hi
>
> I have created ticket
> https://issues.apache.org/jira/browse/CAMEL-4212
>
> The problem we have is that the http related components in Camel does
> not support mapping to/from Camel Message Headers if there is HTTP
> parameters that have multiple values.
>
> For example if a HTTP GET is send with:
> http://someserver.com/foo=123&foo=456&bar=yes
>
> Then in the Camel Message, we have 2 headers as expected
> bar -> yes
> foo -> 456
>
> But foo header only contains the last value. It should be
> foo -> [123, 456]
>
> I am working on a patch but the various 3rd party http frameworks we use:
> - Apache Http Client 3.1
> - Apache Http Client 4.x
> - Jetty (both server and client)
> - Async Http Client
>
> Handles this a bit differently in their API. So there is needed a bit
> fiddle to get it mapped correctly.
>
> For example if you traverse the HTTP parameter names then those
> libraries often will traverse the same name multiple times if it has
> multiple values.
> In those case you need yourself to keep track on what to extract. So
> in the given example above, the libraries will traverse
>
> bar -> yes
> foo -> [123, 456]
> foo -> [123, 456]
>
> What we would like to do with Camel Messsage Headers is to map the above to
>
> bar -> yes
> foo -> java.util.List { 123, 456 }
>
>
> I will attach a patch on the JIRA ticket, then you can take a look and
> it may be easier to discuss how we should
> go about fixing/implementing this.
>
>
>
>
> --
> 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/
>



-- 
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