Alan Foster created CAMEL-7303:
----------------------------------

             Summary: Simple Language - Header access surrounded with quotes
                 Key: CAMEL-7303
                 URL: https://issues.apache.org/jira/browse/CAMEL-7303
             Project: Camel
          Issue Type: Bug
            Reporter: Alan Foster


Quotes within header access are not currently handled in the same way as the 
inbuilt {{headerAs}} function or the body accessor notation - perhaps these 
should be aligned?

For instance with the following route

{code:xml}
    <camelContext trace="false" 
xmlns="http://camel.apache.org/schema/blueprint";>
        <route>
            <from uri="direct:entry"/>

            <setHeader headerName="some key">
                <constant>hello world</constant>
            </setHeader>

            <setBody>
                <simple>${headers['some key']}</simple>
            </setBody>

            <log message="The expression evaluated to :: ${body}" />

        </route>
    </camelContext>
{code}

Outcome :

{code}[                          main] route1                         INFO  The 
expression evaluated to :: {code}

Expected :

{code}[                          main] route1                         INFO  The 
expression evaluated to :: hello world{code}

For reference, the current notation works within other parts of the language 
and are handled as expected

{code}${body['some key']}{code}
{code}${headerAs('some key', java.lang.Boolean}{code}

I think the fix might be to use {{StringHelper.removeQuotes}} on line #269 
within SimpleFunctionExpression.java possibly, such as

{code}remainder = StringHelper.removeQuotes(remainder.substring(1, 
remainder.length() - 1));{code}





--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to