You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Blair <bl...@gmail.com> on 2011/07/12 00:44:16 UTC

Problems with jetty component and posts with more then one value for a field.

I am wondering if i am doing this wrong, or if there is a work around?

Fields posted (or getted) from a form are placed as headers, which is a
wonderful beautiful thing. 
however...

a url of the form http://localhost:8080/Message?say=hello&to=bob&to=bill 
causes issues. The POST and PUT equivalents are the same.

The "to" header will only have bob, and bill is completely lost. I thought
we would end up with a list there, or something I could split on.

Anyway way around this? 

The reason I want to to this is forms that have a list where you can select
multiple entries are sent this way, and I need to process the result.

--- Blair

--
View this message in context: http://camel.465427.n5.nabble.com/Problems-with-jetty-component-and-posts-with-more-then-one-value-for-a-field-tp4576908p4576908.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Problems with jetty component and posts with more then one value for a field.

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jul 12, 2011 at 7:35 AM, Claus Ibsen <cl...@gmail.com> wrote:
> On Tue, Jul 12, 2011 at 7:33 AM, Taariq Levack <ta...@gmail.com> wrote:
>> Hi
>>
>> I just tried it on 2.7.2 and you will see this kind of log.
>>
>> [                          main] SpringCamelContext             TRACE
>> Getting endpoint with uri:
>> jetty:http://0.0.0.0:8080/Message?say=hello&to=bob&to=bill
>> [                          main] SpringCamelContext             TRACE
>> Getting endpoint with normalized uri:
>> jetty://http://0.0.0.0:8080/Message?say=hello&to=bill
>> [                          main] DefaultComponent               DEBUG
>> Creating endpoint
>> uri=[jetty://http://0.0.0.0:8080/Message?say=hello&to=bill],
>> path=[http://0.0.0.0:8080/Message], parameters=[{say=hello, to=bill}]
>>
>>
>> Now I don't know if it's supposed to behave this way, or if it's
>> supposed to map such headers with an Object of type List or whatever.
>> But if you need a quick workaround, you can pass such a parameter
>> comma delimited and then split on that.
>> Assuming you're in control of the producer.
>>
>
> Can you create a JIRA ticket? The normalize uri logic need to support
> dual parameters with same keys
>

I created a ticket
https://issues.apache.org/jira/browse/CAMEL-4211

I have reproduced the issue and will try to implement a fix asap so it
can be fixed in the upcoming Camel 2.8 release that is due soon.


>> Taariq
>>
>>
>> On Tue, Jul 12, 2011 at 7:13 AM, Claus Ibsen <cl...@gmail.com> wrote:
>>> Hi
>>>
>>> What version of Camel are you using?
>>>
>>>
>>> On Tue, Jul 12, 2011 at 12:44 AM, Blair <bl...@gmail.com> wrote:
>>>> I am wondering if i am doing this wrong, or if there is a work around?
>>>>
>>>> Fields posted (or getted) from a form are placed as headers, which is a
>>>> wonderful beautiful thing.
>>>> however...
>>>>
>>>> a url of the form http://localhost:8080/Message?say=hello&to=bob&to=bill
>>>> causes issues. The POST and PUT equivalents are the same.
>>>>
>>>> The "to" header will only have bob, and bill is completely lost. I thought
>>>> we would end up with a list there, or something I could split on.
>>>>
>>>> Anyway way around this?
>>>>
>>>> The reason I want to to this is forms that have a list where you can select
>>>> multiple entries are sent this way, and I need to process the result.
>>>>
>>>> --- Blair
>>>>
>>>> --
>>>> View this message in context: http://camel.465427.n5.nabble.com/Problems-with-jetty-component-and-posts-with-more-then-one-value-for-a-field-tp4576908p4576908.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>>
>>> --
>>> 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/
>



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

Re: Problems with jetty component and posts with more then one value for a field.

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jul 12, 2011 at 7:33 AM, Taariq Levack <ta...@gmail.com> wrote:
> Hi
>
> I just tried it on 2.7.2 and you will see this kind of log.
>
> [                          main] SpringCamelContext             TRACE
> Getting endpoint with uri:
> jetty:http://0.0.0.0:8080/Message?say=hello&to=bob&to=bill
> [                          main] SpringCamelContext             TRACE
> Getting endpoint with normalized uri:
> jetty://http://0.0.0.0:8080/Message?say=hello&to=bill
> [                          main] DefaultComponent               DEBUG
> Creating endpoint
> uri=[jetty://http://0.0.0.0:8080/Message?say=hello&to=bill],
> path=[http://0.0.0.0:8080/Message], parameters=[{say=hello, to=bill}]
>
>
> Now I don't know if it's supposed to behave this way, or if it's
> supposed to map such headers with an Object of type List or whatever.
> But if you need a quick workaround, you can pass such a parameter
> comma delimited and then split on that.
> Assuming you're in control of the producer.
>

Can you create a JIRA ticket? The normalize uri logic need to support
dual parameters with same keys

> Taariq
>
>
> On Tue, Jul 12, 2011 at 7:13 AM, Claus Ibsen <cl...@gmail.com> wrote:
>> Hi
>>
>> What version of Camel are you using?
>>
>>
>> On Tue, Jul 12, 2011 at 12:44 AM, Blair <bl...@gmail.com> wrote:
>>> I am wondering if i am doing this wrong, or if there is a work around?
>>>
>>> Fields posted (or getted) from a form are placed as headers, which is a
>>> wonderful beautiful thing.
>>> however...
>>>
>>> a url of the form http://localhost:8080/Message?say=hello&to=bob&to=bill
>>> causes issues. The POST and PUT equivalents are the same.
>>>
>>> The "to" header will only have bob, and bill is completely lost. I thought
>>> we would end up with a list there, or something I could split on.
>>>
>>> Anyway way around this?
>>>
>>> The reason I want to to this is forms that have a list where you can select
>>> multiple entries are sent this way, and I need to process the result.
>>>
>>> --- Blair
>>>
>>> --
>>> View this message in context: http://camel.465427.n5.nabble.com/Problems-with-jetty-component-and-posts-with-more-then-one-value-for-a-field-tp4576908p4576908.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>
>>
>>
>> --
>> 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/

Re: Problems with jetty component and posts with more then one value for a field.

Posted by Taariq Levack <ta...@gmail.com>.
Hi

I just tried it on 2.7.2 and you will see this kind of log.

[                          main] SpringCamelContext             TRACE
Getting endpoint with uri:
jetty:http://0.0.0.0:8080/Message?say=hello&to=bob&to=bill
[                          main] SpringCamelContext             TRACE
Getting endpoint with normalized uri:
jetty://http://0.0.0.0:8080/Message?say=hello&to=bill
[                          main] DefaultComponent               DEBUG
Creating endpoint
uri=[jetty://http://0.0.0.0:8080/Message?say=hello&to=bill],
path=[http://0.0.0.0:8080/Message], parameters=[{say=hello, to=bill}]


Now I don't know if it's supposed to behave this way, or if it's
supposed to map such headers with an Object of type List or whatever.
But if you need a quick workaround, you can pass such a parameter
comma delimited and then split on that.
Assuming you're in control of the producer.

Taariq


On Tue, Jul 12, 2011 at 7:13 AM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> What version of Camel are you using?
>
>
> On Tue, Jul 12, 2011 at 12:44 AM, Blair <bl...@gmail.com> wrote:
>> I am wondering if i am doing this wrong, or if there is a work around?
>>
>> Fields posted (or getted) from a form are placed as headers, which is a
>> wonderful beautiful thing.
>> however...
>>
>> a url of the form http://localhost:8080/Message?say=hello&to=bob&to=bill
>> causes issues. The POST and PUT equivalents are the same.
>>
>> The "to" header will only have bob, and bill is completely lost. I thought
>> we would end up with a list there, or something I could split on.
>>
>> Anyway way around this?
>>
>> The reason I want to to this is forms that have a list where you can select
>> multiple entries are sent this way, and I need to process the result.
>>
>> --- Blair
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Problems-with-jetty-component-and-posts-with-more-then-one-value-for-a-field-tp4576908p4576908.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> 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/
>

Re: Problems with jetty component and posts with more then one value for a field.

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

What version of Camel are you using?


On Tue, Jul 12, 2011 at 12:44 AM, Blair <bl...@gmail.com> wrote:
> I am wondering if i am doing this wrong, or if there is a work around?
>
> Fields posted (or getted) from a form are placed as headers, which is a
> wonderful beautiful thing.
> however...
>
> a url of the form http://localhost:8080/Message?say=hello&to=bob&to=bill
> causes issues. The POST and PUT equivalents are the same.
>
> The "to" header will only have bob, and bill is completely lost. I thought
> we would end up with a list there, or something I could split on.
>
> Anyway way around this?
>
> The reason I want to to this is forms that have a list where you can select
> multiple entries are sent this way, and I need to process the result.
>
> --- Blair
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Problems-with-jetty-component-and-posts-with-more-then-one-value-for-a-field-tp4576908p4576908.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



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

Re: Problems with jetty component and posts with more then one value for a field.

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jul 14, 2011 at 12:39 AM, Blair <bl...@gmail.com> wrote:
> Thank you all so very much :)
>
> Claus: Getting the bug report in and seeing the problem right away :) - also
> for you book! You have no idea how useful it has been! We are running so
> VERY many projects with camel routes in them now.
>

Thank for the kind words. Yeah Camel is picking up interrest. This is
great for the community.

> Taariq: For testing it under the latest version! I've been away for a day,
> and couldn't answer the question, thanks for stepping in and doing that!
>

Yeah thanks Taariq.

Camel 2.7.3 and 2.8.0 is cutting about to be released. They are what
is called in a VOTE.
So end users can download and give them a test run. If there is no
problem found after X days.
Then they are official released.


>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Problems-with-jetty-component-and-posts-with-more-then-one-value-for-a-field-tp4576908p4584591.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



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

Re: Problems with jetty component and posts with more then one value for a field.

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Sep 29, 2011 at 4:47 PM, Ujeen <uj...@ujeen.com> wrote:
> Hi the camel masters,
>
> Just wanted to clarify the CAMEL-4211 fix works not only for http related
> URIs?
>
> I created my own endpoint extending the DefaultEndpoint and passed this
> uri="feed:trades?params=param1&amp;params=param2" to it.
> In the endpoint itself I put the
> private Collection<?> params;
>
> and the
>
> public void setParams(Collection<?> params) {
>     this.params = params;
> }
>
> But got this exception:
> Failed to resolve endpoint: feed://trades?params=param2 due to: Could not
> find a suitable setter for property: params as there isn't a setter method
> with same type: java.lang.String nor type conversion possible: No type
> converter available to convert from type: java.lang.String to the required
> type: java.util.Collection with value param2
>
> The Camel version I use is 2.8.1.
> So I have a doubt that the uri multiple params feature works only for the
> http based endpoints, right?
>

Yeah this is not supported as Camel would then be able to "assemble"
multiple values from the same key as a Collection under the covers.
However it could possible be a nice addition.

Feel free to create a JIRA ticket.


> Thank you
> Have a great day/night.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Problems-with-jetty-component-and-posts-with-more-then-one-value-for-a-field-tp4576908p4853382.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



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

Re: Problems with jetty component and posts with more then one value for a field.

Posted by Ujeen <uj...@ujeen.com>.
Hi the camel masters, 

Just wanted to clarify the CAMEL-4211 fix works not only for http related
URIs?

I created my own endpoint extending the DefaultEndpoint and passed this
uri="feed:trades?params=param1&amp;params=param2" to it. 
In the endpoint itself I put the 
private Collection<?> params;

and the 

public void setParams(Collection<?> params) {
     this.params = params;
}
 
But got this exception: 
Failed to resolve endpoint: feed://trades?params=param2 due to: Could not
find a suitable setter for property: params as there isn't a setter method
with same type: java.lang.String nor type conversion possible: No type
converter available to convert from type: java.lang.String to the required
type: java.util.Collection with value param2

The Camel version I use is 2.8.1.
So I have a doubt that the uri multiple params feature works only for the
http based endpoints, right?

Thank you
Have a great day/night.

--
View this message in context: http://camel.465427.n5.nabble.com/Problems-with-jetty-component-and-posts-with-more-then-one-value-for-a-field-tp4576908p4853382.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Problems with jetty component and posts with more then one value for a field.

Posted by Taariq Levack <ta...@gmail.com>.
You're welcome Blair, happy to help.

On 14 Jul 2011, at 12:39 AM, Blair <bl...@gmail.com> wrote:

> Thank you all so very much :)
> 
> Claus: Getting the bug report in and seeing the problem right away :) - also
> for you book! You have no idea how useful it has been! We are running so
> VERY many projects with camel routes in them now. 
> 
> Taariq: For testing it under the latest version! I've been away for a day,
> and couldn't answer the question, thanks for stepping in and doing that!
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Problems-with-jetty-component-and-posts-with-more-then-one-value-for-a-field-tp4576908p4584591.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Problems with jetty component and posts with more then one value for a field.

Posted by Blair <bl...@gmail.com>.
Thank you all so very much :)

Claus: Getting the bug report in and seeing the problem right away :) - also
for you book! You have no idea how useful it has been! We are running so
VERY many projects with camel routes in them now. 

Taariq: For testing it under the latest version! I've been away for a day,
and couldn't answer the question, thanks for stepping in and doing that!



--
View this message in context: http://camel.465427.n5.nabble.com/Problems-with-jetty-component-and-posts-with-more-then-one-value-for-a-field-tp4576908p4584591.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Problems with jetty component and posts with more then one value for a field.

Posted by Claus Ibsen <cl...@gmail.com>.
The multiple value thing is fixed on the producer side, eg if you use
http/http4/jetty/ahc or any other Camel endpoint.

On the consumer side, eg jetty/servlet the problem is that Camel
doesnt yet support mapping to headers using multiple values. I have
created a ticket to track this also
https://issues.apache.org/jira/browse/CAMEL-4212

>From jetty/servlet you can access the HttpServletRequest and get the
parameters with multiple values.
See this unit test
http://svn.apache.org/viewvc?rev=1145506&view=rev


On Tue, Jul 12, 2011 at 12:44 AM, Blair <bl...@gmail.com> wrote:
> I am wondering if i am doing this wrong, or if there is a work around?
>
> Fields posted (or getted) from a form are placed as headers, which is a
> wonderful beautiful thing.
> however...
>
> a url of the form http://localhost:8080/Message?say=hello&to=bob&to=bill
> causes issues. The POST and PUT equivalents are the same.
>
> The "to" header will only have bob, and bill is completely lost. I thought
> we would end up with a list there, or something I could split on.
>
> Anyway way around this?
>
> The reason I want to to this is forms that have a list where you can select
> multiple entries are sent this way, and I need to process the result.
>
> --- Blair
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Problems-with-jetty-component-and-posts-with-more-then-one-value-for-a-field-tp4576908p4576908.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



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