You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "G.J. van de Streek" <st...@avisi.nl> on 2009/04/22 14:07:14 UTC

string constants in simple expression language

Is there a way to use string constants in the simple expression language. I
am trying to fix a deprecation warning in:

        from("direct:saveAgentsFile")
                .setHeader(FileComponent.HEADER_FILE_NAME, "agents.xml")
               
.to("file:///Users/streekgj/Desktop/filestore/?append=false")
                ;

I tried to change it to:

                .setHeader(FileComponent.HEADER_FILE_NAME, new
SimpleExpression("agents.xml");)

Of course it is treated as an expression, but is there any way to mark it as
an string literal, or escape the dot? Something like:

                .setHeader(FileComponent.HEADER_FILE_NAME, new
SimpleExpression("'agents.xml'");)
or
                .setHeader(FileComponent.HEADER_FILE_NAME, new
SimpleExpression("agents\\.xml");)

Or do string literals only works with operations?
-- 
View this message in context: http://www.nabble.com/string-constants-in-simple-expression-language-tp23174960p23174960.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: string constants in simple expression language

Posted by "G.J. van de Streek" <st...@avisi.nl>.
The deprecation is in using setHeader with a String as the second argument:
.setHeader(FileComponent.HEADER_FILE_NAME, "agents.xml")
And indeed Willems suggestion fixes the warning:
.setHeader(FileComponent.HEADER_FILE_NAME, constant("agents.xml"))


Claus Ibsen-2 wrote:
> 
> Hi
> 
> What is the @deprecation?
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/string-constants-in-simple-expression-language-tp23174960p23191154.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: string constants in simple expression language

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

What is the @deprecation?


On Wed, Apr 22, 2009 at 2:56 PM, Willem Jiang <wi...@gmail.com> wrote:
> Hi
>
> You could use constant for this, just like this
> from("direct:start").
>    setHeader("foo", constant("ABC")).
>    to("mock:result");
>
> Willem
>
> G.J. van de Streek wrote:
>> Is there a way to use string constants in the simple expression language. I
>> am trying to fix a deprecation warning in:
>>
>>         from("direct:saveAgentsFile")
>>                 .setHeader(FileComponent.HEADER_FILE_NAME, "agents.xml")
>>
>> .to("file:///Users/streekgj/Desktop/filestore/?append=false")
>>                 ;
>>
>> I tried to change it to:
>>
>>                 .setHeader(FileComponent.HEADER_FILE_NAME, new
>> SimpleExpression("agents.xml");)
>>
>> Of course it is treated as an expression, but is there any way to mark it as
>> an string literal, or escape the dot? Something like:
>>
>>                 .setHeader(FileComponent.HEADER_FILE_NAME, new
>> SimpleExpression("'agents.xml'");)
>> or
>>                 .setHeader(FileComponent.HEADER_FILE_NAME, new
>> SimpleExpression("agents\\.xml");)
>>
>> Or do string literals only works with operations?
>
>



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

Re: string constants in simple expression language

Posted by Willem Jiang <wi...@gmail.com>.
Hi

You could use constant for this, just like this
from("direct:start").
    setHeader("foo", constant("ABC")).
    to("mock:result");

Willem

G.J. van de Streek wrote:
> Is there a way to use string constants in the simple expression language. I
> am trying to fix a deprecation warning in:
> 
>         from("direct:saveAgentsFile")
>                 .setHeader(FileComponent.HEADER_FILE_NAME, "agents.xml")
>                
> .to("file:///Users/streekgj/Desktop/filestore/?append=false")
>                 ;
> 
> I tried to change it to:
> 
>                 .setHeader(FileComponent.HEADER_FILE_NAME, new
> SimpleExpression("agents.xml");)
> 
> Of course it is treated as an expression, but is there any way to mark it as
> an string literal, or escape the dot? Something like:
> 
>                 .setHeader(FileComponent.HEADER_FILE_NAME, new
> SimpleExpression("'agents.xml'");)
> or
>                 .setHeader(FileComponent.HEADER_FILE_NAME, new
> SimpleExpression("agents\\.xml");)
> 
> Or do string literals only works with operations?