Hi Yogesh Thanks for digging into this and reporting back. I have created a ticket about the upgrade https://issues.apache.org/activemq/browse/CAMEL-1567
On Fri, Apr 24, 2009 at 9:41 PM, ychawla <[email protected]> wrote: > > Hi Claus, > Here is an explanation of the API change from Christopher Beck at JUEL: > > Hello Yogesh, > > the API to resolve methods has changed in 2.1.1. Camel's method resolver > is breaks with JUEL 2.1.1. Generally, methods are still resolved via > ELResolver.getValue(context, base, property), but > - in 2.1.0, the method name was passed as a property > - in 2.1.1, an instance of de.odysseus.el.misc.MethodInvocation is passed > as a property > The reason for this is to provide more detailed information about the > method invocation to the resolver (i.e the method name, number of arguments > and whether vararg calls are supported). > > Now, camel-juel uses its BeanAndMethodELResolver to resolve methods. > There, findMethod(context, base, property) only handles a property > parameter of type string. That's why it doesn't work. When migrating to > juel 2.1.1, the BeanAndMethodELResolver class needs to be updated to work > with MethodInvocation objects as properties. > > The JUEL 2.1.1 distribution contains a sample resolver. Taking the sample > code, updating camel's resolver should be pretty straightforward. When > doing so, you may also want to add property "javax.el.varArgs" in > JuelExpression.populateDefaultExpressionProperties(..). That way you would > take real profit by invoking vararg methods from within EL expressions. > > There's also a way to quickly modify your resolver to work with both, JUEL > 2.1.0 and 2.1.1. Just don't ask for "property instanceof String" but use > property.toString() as a candidate method name: the MethodInvocation's > toString() will answer the method name. > > > > ychawla wrote: >> >> Here is the link to the bug tracker on source forge for JUEL: >> >> https://sourceforge.net/tracker/?func=detail&aid=2779833&group_id=165179&atid=834616 >> >> Cheers, >> Yc >> >> >> ychawla wrote: >>> >>> Hello All, >>> I am trying to evaluate a header in Camel 1.6.0 using EL expressions. >>> Here is my expression: >>> >>> <filter> >>> <el>${in.headers['MyHeader'].startsWith('fooBar')}</el> >>> <setHeader >>> headerName="someHeader"><constant>false</constant></setHeader> >>> </filter> >>> >>> When I run this, I get an exception: >>> >>> javax.el.MethodNotFoundException: Cannot resolve method 'startsWith' in >>> 'class java.lang.String' >>> >>> I looked up this forum post by James Strachan: >>> http://www.nabble.com/How-do-I-get-a-Content-Based-Router-configured-in-XML-with-ActiveMQ--td15339501.html#a15707041 >>> >>> James suggested downloading the code and using this test: >>> JuelLanguageTest. In testElPredicates method, I added this assertion: >>> >>> assertPredicate("${in.headers['MyHeader'].startsWith('fooBar')}"); >>> >>> and in ExchangeTestSupport I added this header: >>> >>> in.setHeader("MyHeader", "fooBarber"); >>> >>> Any idea why this would work in Java, but I would get the EL expression >>> in a spring route? >>> >>> Thanks, >>> Yogesh >>> >> >> > > -- > View this message in context: > http://www.nabble.com/Camel-JUEL-expression-weirdness-in-1.6.0-tp23177119p23223469.html > Sent from the Camel - Users (activemq) mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus Apache Camel Reference Card: http://refcardz.dzone.com/refcardz/enterprise-integration
