Hi

And you have camel-ognl on the classpath?


/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/



On Wed, Dec 3, 2008 at 1:43 PM, packo <[EMAIL PROTECTED]> wrote:
>
> Thank you for your swift reply.
>
> I have already tried ognl, following the example in the URL you mentioned.
>
> The route i created looked like:
>
>  <route>
>        <from uri="direct:foobar" />
>           <choice>
>                <when>
>                        <ognl>request.headers.foo = 'foo1'</ognl>
>                        <bean ref="fooBean1" />
>                </when>
>                <when>
>                        <ognl>request.headers.foo = 'foo2'</ognl>
>                       <bean ref="fooBean2" />
>                </when>
>          </choice>
> .
> .
> .
> </route>
>
>
> But still the result was that i was always getting true for the result of
> ognl expression. Maybe i am overlooking sth with OGNL?
>
>
> Claus Ibsen-2 wrote:
>>
>> Hi
>>
>> Yeah simple does not understand EQ, GE, LT and other operators.
>>
>> You can use some of the other languages
>> - ognl
>> - el
>> - groovy
>> - bean (for using POJO)
>> - xpath if your payload is xml based
>>
>> See
>> http://activemq.apache.org/camel/scripting-languages.html
>> http://activemq.apache.org/camel/ognl.html
>>
>> Using OGNL it would be
>> <ognl>request.headers.foo = 'foo1'</ognl>
>>
>> But I am wondering if we should improve the simple language so it can
>> be use some simple operators for simple test such as in your use-case.
>> No need to learn OGNL, Groovy or depend on 3rd part .jars. Just plain
>> Java.
>>
>> James, any thoughts on this?
>>
>>
>>
>>
>> /Claus Ibsen
>> Apache Camel Committer
>> Blog: http://davsclaus.blogspot.com/
>>
>>
>>
>> On Wed, Dec 3, 2008 at 1:09 PM, packo <[EMAIL PROTECTED]> wrote:
>>>
>>> It might be a simple question, but i am stuck with it in the past few
>>> days so
>>> any help would be appreciated.
>>>
>>> I have a route that looks like this:
>>>
>>> <route>
>>>        <from uri="direct:foobar" />
>>>           <choice>
>>>                <when>
>>>                        <simple>${in.headers.foo} == 'foo1'</simple>
>>>                        <bean ref="fooBean1" />
>>>                </when>
>>>                <when>
>>>                   <simple>${in.headers.foo} == 'foo2'</simple>
>>>                   <bean ref="fooBean2" />
>>>                </when>
>>>          </choice>
>>>         <choice>
>>>                <when>
>>>                   <simple>${in.headers.bar } == 'bar1'</simple>
>>>                  <to uri="bean:barBean?method=barMethod" />
>>>                </when>
>>>          </choice>
>>> </route>
>>>
>>> foo and bar headers are pre-populated from the Producer i am using.
>>> What happens is that each expression is evaluated to true. A look in the
>>> code showed that <simple> evaluates just the existence of a header.
>>> I also tried ognl, xpath and others but nothing seems to work.
>>>
>>> My exchange is a default exchange with a DTO as payload. Am i missing
>>> something???
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Endpoint-decision-based-on-Header-Value-with-XML-configuration-tp20811772s22882p20811772.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Endpoint-decision-based-on-Header-Value-with-XML-configuration-tp20811772s22882p20812287.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

Reply via email to