You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ramesri <ra...@ihg.com> on 2012/02/22 18:06:28 UTC

How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Hi All
I am a new user and would like to say "Hello" to all .

I am trying to use the $esc.xml in a velocity template. The velocity
component is invoked part of a camel route deployed in ServiceMix.  

I am using $esc.xml for only one tag as
<addressLine1>$esc.xml($headers.addrLine1))</addressLine1>, where the
addrLine1 is a value set in the Message header.  But the content is neither
escaped, nor the $esc.xml is recognized as a tool.  
The output comes as
<addressLine1>$esc.xml($headers.addrLine1)</addressLine1> where as other
tags values are populated correctly.

Please let me know how to use the escape tool with camel-velocity.

Thanks
Ramesh

--
View this message in context: http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5505668.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by Christian Müller <ch...@gmail.com>.
No, I don't think so. I'm not aware of any related JIRA. Feel free to raise
one.

Best,
Christian
Am 13.10.2013 15:27 schrieb "abdelghani.tag" <ab...@gmail.com>:

> Hi Christian
>   Im having same problem with with camel 2.12.1, Is bellow issue fixed?
> Regards
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5741475.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by "abdelghani.tag" <ab...@gmail.com>.
Hi Christian
  Im having same problem with with camel 2.12.1, Is bellow issue fixed?
Regards



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5741475.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by ramesri <ra...@ihg.com>.
This is the came version I use. I use it with fuse esb

<camel.version>2.8.0-fuse-01-13</camel.version>



On Mon, Feb 27, 2012 at 1:56 AM, Claus Ibsen-2 [via Camel] <
ml-node+s465427n5518097h33@n5.nabble.com> wrote:

> On Mon, Feb 27, 2012 at 2:44 AM, ramesri <[hidden email]<http://user/SendEmail.jtp?type=node&node=5518097&i=0>>
> wrote:
> > Hi Christian
> >
> > I get error when I try to set a ref as stated below.  Because the
> > <setHeader></setHeader> doesnot allow <ref> as a valid content.  Valid
> > contents are only <constant>, <simple>, <method>
> >
>
> You need Camel 2.8 or better. What version of Camel are you using?
> http://camel.apache.org/ref-language.html
>
> > On Sat, Feb 25, 2012 at 8:32 AM, Christian Mueller [via Camel] <
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5518097&i=1>>
> wrote:
> >
> >> As Claus suggested, use
> >>
> >> <bean id="myBean" class="..." />
> >>
> >> <setHeader headerName="myHeader">
> >>     <ref id="myBean" />
> >> </setHeader>
> >>
> >> Best,
> >> Christian
> >>
> >> On Fri, Feb 24, 2012 at 6:07 PM, ramesri <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=5515124&i=0>>
> >> wrote:
> >>
> >> > Thank you all for the inputs.  Its just that I am new to Camel and
> >> having
> >> > trouble to implement in Spring DSL what is suggested by Christian.
>  Can
> >> you
> >> > pls show me how to do this in Spring DSL.  Assuming that I define the
> >> > EscapeTool as <bean id="escTool"
> >> > class="org.apache.velocity.tools.generic.EscapeTool"/>, how do I
> <ref>
> >> it
> >> > in the <setHeader headerName="esc"> ?
> >> >
> >> > Regards
> >> > Ramesh
> >> >
> >> > On Fri, Feb 24, 2012 at 4:01 AM, Christian Mueller [via Camel] <
> >> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5515124&i=1>>
>
> >> wrote:
> >> >
> >> > > It's not only the velocity-tools provided classes what the user can
> >> use
> >> > > here. We have a custom class with some transformations (e.g.
> transform
> >> > the
> >> > > ISO two letter country code - e.g. "DE" - to the full name - e.g.
> >> > > "Deutschland").
> >> > > May be adding some words how to use this functionality inside Camel
> on
> >> > our
> >> > > WIKI page is sufficient? I didn't like the idea to change the code
> >> "only"
> >> > > to autodetect the velocity-tools provided utillity classes - my
> 0,02
> >> $...
> >> > >
> >> > > Best,
> >> > > Christian
> >> > >
> >> > > On Fri, Feb 24, 2012 at 8:44 AM, Claus Ibsen <[hidden email]<
> >> > http://user/SendEmail.jtp?type=node&node=5512103&i=0>>
> >> > > wrote:
> >> > >
> >> > > > On Thu, Feb 23, 2012 at 8:59 PM, Reuben Garrett <[hidden email]<
> >> > http://user/SendEmail.jtp?type=node&node=5512103&i=1>>
> >> > >
> >> > > > wrote:
> >> > > > > Ramesh,
> >> > > > >
> >> > > > > I'm not as knowledgeable as the committers, but it looks like
> >> you're
> >> > > > trying
> >> > > > > to attach an instance of the EscapeTool class to a header in
> your
> >> > > > Exchange
> >> > > > > and then invoke it later on inside the Velocity template.  But
> >> when
> >> > > you
> >> > > > use
> >> > > > > a <constant/> expression in the Spring DSL, it just returns the
> >> text
> >> > > > within
> >> > > > > the <constant/> tags as a String.
> >> > > > >
> >> > > > > Christian's example in the Java DSL seems closer because it's
> >> > actually
> >> > > > > attaching a Class object (rather than the name of the class).
> >>  Maybe
> >> > > if
> >> > > > you
> >> > > > > somehow instantiate an instance of EscapeTool and attach it to
> the
> >> > > > > exchange, you'll then be able to invoke it.   The Java DSL
> might
> >> be
> >> > > more
> >> > > > > direct for this, but I'll bet there's an easy way to do it in
> the
> >> > > Spring
> >> > > > > DSL, too.
> >> > > > >
> >> > > > > That being said, I don't know much about Velocity.  However the
> >> > > > <constant/>
> >> > > > > expression doesn't seem to be what you want.
> >> > > > >
> >> > > >
> >> > > > Yeah in XML DSLs you can use <ref> to refer to a bean to lookup
> and
> >> > use.
> >> > > > http://camel.apache.org/ref-language.html
> >> > > >
> >> > > > However maybe we can auto detect the velocity tools and provide
> it
> >> out
> >> > > > of the box?
> >> > > >
> >> > > >
> >> > > > > Claus, Christian - am I on the right track?
> >> > > > >
> >> > > > > ~ RNPG
> >> > > > >
> >> > > > > On Thu, Feb 23, 2012 at 11:15, ramesri <[hidden email]<
> >> > http://user/SendEmail.jtp?type=node&node=5512103&i=2>>
> >> > > wrote:
> >> > > > >
> >> > > > >> Sorry, I set the header as and no luck.
> >> > > > >>
> >> > > > >> <setHeader headerName="esc">
> >> > > > >>
> >> > > > >>
> >> > > > >>
> >> > >
> >> <constant>org.apache.velocity.tools.generic.EscapeTool.class</constant>
> >> > > > >>
> >> > > > >> </setHeader>
> >> > > > >>
> >> > > > >>
> >> > > > >> Thanks
> >> > > > >> Ramesh
> >> > > > >>
> >> > > >
> >> > > >
> >> > > >
> >> > > > --
> >> > > > Claus Ibsen
> >> > > > -----------------
> >> > > > FuseSource
> >> > > > Email: [hidden email]<
> >> > http://user/SendEmail.jtp?type=node&node=5512103&i=3>
> >> > > > Web: http://fusesource.com
> >> > > > Twitter: davsclaus, fusenews
> >> > > > Blog: http://davsclaus.blogspot.com/
> >> > > > Author of Camel in Action: http://www.manning.com/ibsen/
> >> > > >
> >> > >
> >> > >
> >> > > ------------------------------
> >> > >  If you reply to this email, your message will be added to the
> >> discussion
> >> > > below:
> >> > >
> >> > >
> >> >
> >>
> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5512103.html
> >> > >  To start a new topic under Camel - Users, email
> >> > > [hidden email] <
> http://user/SendEmail.jtp?type=node&node=5515124&i=2>
> >> > > To unsubscribe from Camel - Users, click here<
> >> >
> >> >
> >> > > .
> >> > > NAML<
> >> >
> >>
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >>
> >> > >
> >> > >
> >> >
> >> >
> >> > --
> >> > View this message in context:
> >> >
> >>
> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5513385.html
> >>
> >> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >> >
> >>
> >>
> >> ------------------------------
> >>  If you reply to this email, your message will be added to the
> discussion
> >> below:
> >>
> >>
> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5515124.html
> >>  To start a new topic under Camel - Users, email
> >> [hidden email] <http://user/SendEmail.jtp?type=node&node=5518097&i=2>
> >> To unsubscribe from Camel - Users, click here<
>
> >> .
> >> NAML<
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
> >>
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5517811.html
>
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5518097&i=3>
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5518097.html
>  To start a new topic under Camel - Users, email
> ml-node+s465427n465428h94@n5.nabble.com
> To unsubscribe from Camel - Users, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=cmFtZXNoLnNyaWRoYXJhbkBpaGcuY29tfDQ2NTQyOHwxMjE3MTM3MDYz>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


--
View this message in context: http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5519184.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by Christian Müller <ch...@gmail.com>.
I also did a few tests and didn't got it working (with Camel 2.9.0). It
looks like the <ref> element is useless at the moment inside the
<setHeader> element. Do you consider to raise a JIRA at [1] so we can fix
it?

[1] https://issues.apache.org/jira/browse/CAMEL

Best,
Christian

On Mon, Feb 27, 2012 at 10:20 PM, ramesri <ra...@ihg.com> wrote:

> Thanks Eric for your input.
> Finally, I was able to resolve the problem by doing the following:
>
> <bean id="veloctiyToolsHandler"
> class="com.ihg.sfdc.mdm.util.VelocityToolsHandler"/>
>
> and in the route:
>
> <setHeader headerName="esc">
>            <method ref="veloctiyToolsHandler"
> method="getVelocityEscapeTool"/>
>        </setHeader>
>
> where getVelocityEscapeTool() returns an instance of EscapeTool.
>
> cheers
> ramesh
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5520087.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by ramesri <ra...@ihg.com>.
Thanks Eric for your input.
Finally, I was able to resolve the problem by doing the following:

<bean id="veloctiyToolsHandler"
class="com.ihg.sfdc.mdm.util.VelocityToolsHandler"/>

and in the route:

<setHeader headerName="esc">
            <method ref="veloctiyToolsHandler"
method="getVelocityEscapeTool"/>
        </setHeader>

where getVelocityEscapeTool() returns an instance of EscapeTool.

cheers
ramesh


--
View this message in context: http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5520087.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by ramesri <ra...@ihg.com>.
Trial1 - ending up at deployment time error in Fuse ESB :

<bean id="escTool" class="org.apache.velocity.tools.generic.EscapeTool"/>

<!-- in a route -->
        <to uri="acctBatchProcessor" />
           <log message="Processor received the record" />
           <setHeader headerName="esc">
            <ref id="escTool" />
        </setHeader>
        <to uri="velocity://velocity/upsertAccount.vm"/>

Error at deployment time:
11:58:11,252 | ERROR | ExtenderThread-5 | ContextLoaderListener
| ?                                   ? | 84
- org.springframework.osgi.extender - 1.2.1 | Application context refresh
failed (OsgiBundleXmlApplicationContext(bundle
=mdm-batch-route, config=osgibundle:/META-INF/spring/*.xml))
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line
102 in XML document from URL [bundle://492.0
:0/META-INF/spring/camel-context.xml] is invalid; nested exception is
org.xml.sax.SAXParseException: cvc-id.2: There are
 multiple occurrences of ID value 'escTool'.
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.j
ava:396)[73:org.springframework.beans:3.0.5.RELEASE]

Trial2 - ending up at run time error:

<bean id="escTool" class="org.apache.velocity.tools.generic.EscapeTool"/>

<!-- in a route -->
        <to uri="acctBatchProcessor" />
           <log message="Processor received the record" />
           <setHeader headerName="esc">
            <ref>escTool</ref>
        </setHeader>
        <to uri="velocity://velocity/upsertAccount.vm"/>

Run time error:
java.lang.IllegalArgumentException: Cannot find expression in registry with
ref: escTool
        at
org.apache.camel.language.ref.RefLanguage$1.evaluate(RefLanguage.java:50)[89:org.apache.camel.camel-core:2.8.
0.fuse-01-13]

On Mon, Feb 27, 2012 at 10:05 AM, Ramesh Sridharan <ramesh.sridharan@ihg.com
> wrote:

> This is the came version I use. I use it with fuse esb
>
> <camel.version>2.8.0-fuse-01-13</camel.version>
>
>
>
>
> On Mon, Feb 27, 2012 at 1:56 AM, Claus Ibsen-2 [via Camel] <
> ml-node+s465427n5518097h33@n5.nabble.com> wrote:
>
>> On Mon, Feb 27, 2012 at 2:44 AM, ramesri <[hidden email]<http://user/SendEmail.jtp?type=node&node=5518097&i=0>>
>> wrote:
>> > Hi Christian
>> >
>> > I get error when I try to set a ref as stated below.  Because the
>> > <setHeader></setHeader> doesnot allow <ref> as a valid content.  Valid
>> > contents are only <constant>, <simple>, <method>
>> >
>>
>> You need Camel 2.8 or better. What version of Camel are you using?
>> http://camel.apache.org/ref-language.html
>>
>> > On Sat, Feb 25, 2012 at 8:32 AM, Christian Mueller [via Camel] <
>> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5518097&i=1>>
>> wrote:
>> >
>> >> As Claus suggested, use
>> >>
>> >> <bean id="myBean" class="..." />
>> >>
>> >> <setHeader headerName="myHeader">
>> >>     <ref id="myBean" />
>> >> </setHeader>
>> >>
>> >> Best,
>> >> Christian
>> >>
>> >> On Fri, Feb 24, 2012 at 6:07 PM, ramesri <[hidden email]<
>> http://user/SendEmail.jtp?type=node&node=5515124&i=0>>
>> >> wrote:
>> >>
>> >> > Thank you all for the inputs.  Its just that I am new to Camel and
>> >> having
>> >> > trouble to implement in Spring DSL what is suggested by Christian.
>>  Can
>> >> you
>> >> > pls show me how to do this in Spring DSL.  Assuming that I define
>> the
>> >> > EscapeTool as <bean id="escTool"
>> >> > class="org.apache.velocity.tools.generic.EscapeTool"/>, how do I
>> <ref>
>> >> it
>> >> > in the <setHeader headerName="esc"> ?
>> >> >
>> >> > Regards
>> >> > Ramesh
>> >> >
>> >> > On Fri, Feb 24, 2012 at 4:01 AM, Christian Mueller [via Camel] <
>> >> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5515124&i=1>>
>>
>> >> wrote:
>> >> >
>> >> > > It's not only the velocity-tools provided classes what the user
>> can
>> >> use
>> >> > > here. We have a custom class with some transformations (e.g.
>> transform
>> >> > the
>> >> > > ISO two letter country code - e.g. "DE" - to the full name - e.g.
>> >> > > "Deutschland").
>> >> > > May be adding some words how to use this functionality inside
>> Camel on
>> >> > our
>> >> > > WIKI page is sufficient? I didn't like the idea to change the code
>> >> "only"
>> >> > > to autodetect the velocity-tools provided utillity classes - my
>> 0,02
>> >> $...
>> >> > >
>> >> > > Best,
>> >> > > Christian
>> >> > >
>> >> > > On Fri, Feb 24, 2012 at 8:44 AM, Claus Ibsen <[hidden email]<
>> >> > http://user/SendEmail.jtp?type=node&node=5512103&i=0>>
>> >> > > wrote:
>> >> > >
>> >> > > > On Thu, Feb 23, 2012 at 8:59 PM, Reuben Garrett <[hidden email]<
>> >> > http://user/SendEmail.jtp?type=node&node=5512103&i=1>>
>> >> > >
>> >> > > > wrote:
>> >> > > > > Ramesh,
>> >> > > > >
>> >> > > > > I'm not as knowledgeable as the committers, but it looks like
>> >> you're
>> >> > > > trying
>> >> > > > > to attach an instance of the EscapeTool class to a header in
>> your
>> >> > > > Exchange
>> >> > > > > and then invoke it later on inside the Velocity template.  But
>> >> when
>> >> > > you
>> >> > > > use
>> >> > > > > a <constant/> expression in the Spring DSL, it just returns
>> the
>> >> text
>> >> > > > within
>> >> > > > > the <constant/> tags as a String.
>> >> > > > >
>> >> > > > > Christian's example in the Java DSL seems closer because it's
>> >> > actually
>> >> > > > > attaching a Class object (rather than the name of the class).
>> >>  Maybe
>> >> > > if
>> >> > > > you
>> >> > > > > somehow instantiate an instance of EscapeTool and attach it to
>> the
>> >> > > > > exchange, you'll then be able to invoke it.   The Java DSL
>> might
>> >> be
>> >> > > more
>> >> > > > > direct for this, but I'll bet there's an easy way to do it in
>> the
>> >> > > Spring
>> >> > > > > DSL, too.
>> >> > > > >
>> >> > > > > That being said, I don't know much about Velocity.  However
>> the
>> >> > > > <constant/>
>> >> > > > > expression doesn't seem to be what you want.
>> >> > > > >
>> >> > > >
>> >> > > > Yeah in XML DSLs you can use <ref> to refer to a bean to lookup
>> and
>> >> > use.
>> >> > > > http://camel.apache.org/ref-language.html
>> >> > > >
>> >> > > > However maybe we can auto detect the velocity tools and provide
>> it
>> >> out
>> >> > > > of the box?
>> >> > > >
>> >> > > >
>> >> > > > > Claus, Christian - am I on the right track?
>> >> > > > >
>> >> > > > > ~ RNPG
>> >> > > > >
>> >> > > > > On Thu, Feb 23, 2012 at 11:15, ramesri <[hidden email]<
>> >> > http://user/SendEmail.jtp?type=node&node=5512103&i=2>>
>> >> > > wrote:
>> >> > > > >
>> >> > > > >> Sorry, I set the header as and no luck.
>> >> > > > >>
>> >> > > > >> <setHeader headerName="esc">
>> >> > > > >>
>> >> > > > >>
>> >> > > > >>
>> >> > >
>> >>
>> <constant>org.apache.velocity.tools.generic.EscapeTool.class</constant>
>> >> > > > >>
>> >> > > > >> </setHeader>
>> >> > > > >>
>> >> > > > >>
>> >> > > > >> Thanks
>> >> > > > >> Ramesh
>> >> > > > >>
>> >> > > >
>> >> > > >
>> >> > > >
>> >> > > > --
>> >> > > > Claus Ibsen
>> >> > > > -----------------
>> >> > > > FuseSource
>> >> > > > Email: [hidden email]<
>> >> > http://user/SendEmail.jtp?type=node&node=5512103&i=3>
>> >> > > > Web: http://fusesource.com
>> >> > > > Twitter: davsclaus, fusenews
>> >> > > > Blog: http://davsclaus.blogspot.com/
>> >> > > > Author of Camel in Action: http://www.manning.com/ibsen/
>> >> > > >
>> >> > >
>> >> > >
>> >> > > ------------------------------
>> >> > >  If you reply to this email, your message will be added to the
>> >> discussion
>> >> > > below:
>> >> > >
>> >> > >
>> >> >
>> >>
>> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5512103.html
>> >> > >  To start a new topic under Camel - Users, email
>> >> > > [hidden email] <
>> http://user/SendEmail.jtp?type=node&node=5515124&i=2>
>> >> > > To unsubscribe from Camel - Users, click here<
>> >> >
>> >> >
>> >> > > .
>> >> > > NAML<
>> >> >
>> >>
>> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
>> >>
>> >> > >
>> >> > >
>> >> >
>> >> >
>> >> > --
>> >> > View this message in context:
>> >> >
>> >>
>> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5513385.html
>> >>
>> >> > Sent from the Camel - Users mailing list archive at Nabble.com.
>> >> >
>> >>
>> >>
>> >> ------------------------------
>> >>  If you reply to this email, your message will be added to the
>> discussion
>> >> below:
>> >>
>> >>
>> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5515124.html
>> >>  To start a new topic under Camel - Users, email
>> >> [hidden email] <http://user/SendEmail.jtp?type=node&node=5518097&i=2>
>> >> To unsubscribe from Camel - Users, click here<
>>
>> >> .
>> >> NAML<
>> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>> >>
>> >
>> >
>> > --
>> > View this message in context:
>> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5517811.html
>>
>> > Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5518097&i=3>
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5518097.html
>>  To start a new topic under Camel - Users, email
>> ml-node+s465427n465428h94@n5.nabble.com
>> To unsubscribe from Camel - Users, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=cmFtZXNoLnNyaWRoYXJhbkBpaGcuY29tfDQ2NTQyOHwxMjE3MTM3MDYz>
>> .
>> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>


--
View this message in context: http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5519563.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Feb 27, 2012 at 2:44 AM, ramesri <ra...@ihg.com> wrote:
> Hi Christian
>
> I get error when I try to set a ref as stated below.  Because the
> <setHeader></setHeader> doesnot allow <ref> as a valid content.  Valid
> contents are only <constant>, <simple>, <method>
>

You need Camel 2.8 or better. What version of Camel are you using?
http://camel.apache.org/ref-language.html

> On Sat, Feb 25, 2012 at 8:32 AM, Christian Mueller [via Camel] <
> ml-node+s465427n5515124h70@n5.nabble.com> wrote:
>
>> As Claus suggested, use
>>
>> <bean id="myBean" class="..." />
>>
>> <setHeader headerName="myHeader">
>>     <ref id="myBean" />
>> </setHeader>
>>
>> Best,
>> Christian
>>
>> On Fri, Feb 24, 2012 at 6:07 PM, ramesri <[hidden email]<http://user/SendEmail.jtp?type=node&node=5515124&i=0>>
>> wrote:
>>
>> > Thank you all for the inputs.  Its just that I am new to Camel and
>> having
>> > trouble to implement in Spring DSL what is suggested by Christian.  Can
>> you
>> > pls show me how to do this in Spring DSL.  Assuming that I define the
>> > EscapeTool as <bean id="escTool"
>> > class="org.apache.velocity.tools.generic.EscapeTool"/>, how do I <ref>
>> it
>> > in the <setHeader headerName="esc"> ?
>> >
>> > Regards
>> > Ramesh
>> >
>> > On Fri, Feb 24, 2012 at 4:01 AM, Christian Mueller [via Camel] <
>> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5515124&i=1>>
>> wrote:
>> >
>> > > It's not only the velocity-tools provided classes what the user can
>> use
>> > > here. We have a custom class with some transformations (e.g. transform
>> > the
>> > > ISO two letter country code - e.g. "DE" - to the full name - e.g.
>> > > "Deutschland").
>> > > May be adding some words how to use this functionality inside Camel on
>> > our
>> > > WIKI page is sufficient? I didn't like the idea to change the code
>> "only"
>> > > to autodetect the velocity-tools provided utillity classes - my 0,02
>> $...
>> > >
>> > > Best,
>> > > Christian
>> > >
>> > > On Fri, Feb 24, 2012 at 8:44 AM, Claus Ibsen <[hidden email]<
>> > http://user/SendEmail.jtp?type=node&node=5512103&i=0>>
>> > > wrote:
>> > >
>> > > > On Thu, Feb 23, 2012 at 8:59 PM, Reuben Garrett <[hidden email]<
>> > http://user/SendEmail.jtp?type=node&node=5512103&i=1>>
>> > >
>> > > > wrote:
>> > > > > Ramesh,
>> > > > >
>> > > > > I'm not as knowledgeable as the committers, but it looks like
>> you're
>> > > > trying
>> > > > > to attach an instance of the EscapeTool class to a header in your
>> > > > Exchange
>> > > > > and then invoke it later on inside the Velocity template.  But
>> when
>> > > you
>> > > > use
>> > > > > a <constant/> expression in the Spring DSL, it just returns the
>> text
>> > > > within
>> > > > > the <constant/> tags as a String.
>> > > > >
>> > > > > Christian's example in the Java DSL seems closer because it's
>> > actually
>> > > > > attaching a Class object (rather than the name of the class).
>>  Maybe
>> > > if
>> > > > you
>> > > > > somehow instantiate an instance of EscapeTool and attach it to the
>> > > > > exchange, you'll then be able to invoke it.   The Java DSL might
>> be
>> > > more
>> > > > > direct for this, but I'll bet there's an easy way to do it in the
>> > > Spring
>> > > > > DSL, too.
>> > > > >
>> > > > > That being said, I don't know much about Velocity.  However the
>> > > > <constant/>
>> > > > > expression doesn't seem to be what you want.
>> > > > >
>> > > >
>> > > > Yeah in XML DSLs you can use <ref> to refer to a bean to lookup and
>> > use.
>> > > > http://camel.apache.org/ref-language.html
>> > > >
>> > > > However maybe we can auto detect the velocity tools and provide it
>> out
>> > > > of the box?
>> > > >
>> > > >
>> > > > > Claus, Christian - am I on the right track?
>> > > > >
>> > > > > ~ RNPG
>> > > > >
>> > > > > On Thu, Feb 23, 2012 at 11:15, ramesri <[hidden email]<
>> > http://user/SendEmail.jtp?type=node&node=5512103&i=2>>
>> > > wrote:
>> > > > >
>> > > > >> Sorry, I set the header as and no luck.
>> > > > >>
>> > > > >> <setHeader headerName="esc">
>> > > > >>
>> > > > >>
>> > > > >>
>> > >
>> <constant>org.apache.velocity.tools.generic.EscapeTool.class</constant>
>> > > > >>
>> > > > >> </setHeader>
>> > > > >>
>> > > > >>
>> > > > >> Thanks
>> > > > >> Ramesh
>> > > > >>
>> > > >
>> > > >
>> > > >
>> > > > --
>> > > > Claus Ibsen
>> > > > -----------------
>> > > > FuseSource
>> > > > Email: [hidden email]<
>> > http://user/SendEmail.jtp?type=node&node=5512103&i=3>
>> > > > Web: http://fusesource.com
>> > > > Twitter: davsclaus, fusenews
>> > > > Blog: http://davsclaus.blogspot.com/
>> > > > Author of Camel in Action: http://www.manning.com/ibsen/
>> > > >
>> > >
>> > >
>> > > ------------------------------
>> > >  If you reply to this email, your message will be added to the
>> discussion
>> > > below:
>> > >
>> > >
>> >
>> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5512103.html
>> > >  To start a new topic under Camel - Users, email
>> > > [hidden email] <http://user/SendEmail.jtp?type=node&node=5515124&i=2>
>> > > To unsubscribe from Camel - Users, click here<
>> >
>> >
>> > > .
>> > > NAML<
>> >
>> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
>>
>> > >
>> > >
>> >
>> >
>> > --
>> > View this message in context:
>> >
>> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5513385.html
>>
>> > Sent from the Camel - Users mailing list archive at Nabble.com.
>> >
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5515124.html
>>  To start a new topic under Camel - Users, email
>> ml-node+s465427n465428h94@n5.nabble.com
>> To unsubscribe from Camel - Users, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=cmFtZXNoLnNyaWRoYXJhbkBpaGcuY29tfDQ2NTQyOHwxMjE3MTM3MDYz>
>> .
>> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5517811.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: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by ramesri <ra...@ihg.com>.
Hi Christian

I get error when I try to set a ref as stated below.  Because the
<setHeader></setHeader> doesnot allow <ref> as a valid content.  Valid
contents are only <constant>, <simple>, <method>

On Sat, Feb 25, 2012 at 8:32 AM, Christian Mueller [via Camel] <
ml-node+s465427n5515124h70@n5.nabble.com> wrote:

> As Claus suggested, use
>
> <bean id="myBean" class="..." />
>
> <setHeader headerName="myHeader">
>     <ref id="myBean" />
> </setHeader>
>
> Best,
> Christian
>
> On Fri, Feb 24, 2012 at 6:07 PM, ramesri <[hidden email]<http://user/SendEmail.jtp?type=node&node=5515124&i=0>>
> wrote:
>
> > Thank you all for the inputs.  Its just that I am new to Camel and
> having
> > trouble to implement in Spring DSL what is suggested by Christian.  Can
> you
> > pls show me how to do this in Spring DSL.  Assuming that I define the
> > EscapeTool as <bean id="escTool"
> > class="org.apache.velocity.tools.generic.EscapeTool"/>, how do I <ref>
> it
> > in the <setHeader headerName="esc"> ?
> >
> > Regards
> > Ramesh
> >
> > On Fri, Feb 24, 2012 at 4:01 AM, Christian Mueller [via Camel] <
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5515124&i=1>>
> wrote:
> >
> > > It's not only the velocity-tools provided classes what the user can
> use
> > > here. We have a custom class with some transformations (e.g. transform
> > the
> > > ISO two letter country code - e.g. "DE" - to the full name - e.g.
> > > "Deutschland").
> > > May be adding some words how to use this functionality inside Camel on
> > our
> > > WIKI page is sufficient? I didn't like the idea to change the code
> "only"
> > > to autodetect the velocity-tools provided utillity classes - my 0,02
> $...
> > >
> > > Best,
> > > Christian
> > >
> > > On Fri, Feb 24, 2012 at 8:44 AM, Claus Ibsen <[hidden email]<
> > http://user/SendEmail.jtp?type=node&node=5512103&i=0>>
> > > wrote:
> > >
> > > > On Thu, Feb 23, 2012 at 8:59 PM, Reuben Garrett <[hidden email]<
> > http://user/SendEmail.jtp?type=node&node=5512103&i=1>>
> > >
> > > > wrote:
> > > > > Ramesh,
> > > > >
> > > > > I'm not as knowledgeable as the committers, but it looks like
> you're
> > > > trying
> > > > > to attach an instance of the EscapeTool class to a header in your
> > > > Exchange
> > > > > and then invoke it later on inside the Velocity template.  But
> when
> > > you
> > > > use
> > > > > a <constant/> expression in the Spring DSL, it just returns the
> text
> > > > within
> > > > > the <constant/> tags as a String.
> > > > >
> > > > > Christian's example in the Java DSL seems closer because it's
> > actually
> > > > > attaching a Class object (rather than the name of the class).
>  Maybe
> > > if
> > > > you
> > > > > somehow instantiate an instance of EscapeTool and attach it to the
> > > > > exchange, you'll then be able to invoke it.   The Java DSL might
> be
> > > more
> > > > > direct for this, but I'll bet there's an easy way to do it in the
> > > Spring
> > > > > DSL, too.
> > > > >
> > > > > That being said, I don't know much about Velocity.  However the
> > > > <constant/>
> > > > > expression doesn't seem to be what you want.
> > > > >
> > > >
> > > > Yeah in XML DSLs you can use <ref> to refer to a bean to lookup and
> > use.
> > > > http://camel.apache.org/ref-language.html
> > > >
> > > > However maybe we can auto detect the velocity tools and provide it
> out
> > > > of the box?
> > > >
> > > >
> > > > > Claus, Christian - am I on the right track?
> > > > >
> > > > > ~ RNPG
> > > > >
> > > > > On Thu, Feb 23, 2012 at 11:15, ramesri <[hidden email]<
> > http://user/SendEmail.jtp?type=node&node=5512103&i=2>>
> > > wrote:
> > > > >
> > > > >> Sorry, I set the header as and no luck.
> > > > >>
> > > > >> <setHeader headerName="esc">
> > > > >>
> > > > >>
> > > > >>
> > >
> <constant>org.apache.velocity.tools.generic.EscapeTool.class</constant>
> > > > >>
> > > > >> </setHeader>
> > > > >>
> > > > >>
> > > > >> Thanks
> > > > >> Ramesh
> > > > >>
> > > >
> > > >
> > > >
> > > > --
> > > > Claus Ibsen
> > > > -----------------
> > > > FuseSource
> > > > Email: [hidden email]<
> > http://user/SendEmail.jtp?type=node&node=5512103&i=3>
> > > > Web: http://fusesource.com
> > > > Twitter: davsclaus, fusenews
> > > > Blog: http://davsclaus.blogspot.com/
> > > > Author of Camel in Action: http://www.manning.com/ibsen/
> > > >
> > >
> > >
> > > ------------------------------
> > >  If you reply to this email, your message will be added to the
> discussion
> > > below:
> > >
> > >
> >
> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5512103.html
> > >  To start a new topic under Camel - Users, email
> > > [hidden email] <http://user/SendEmail.jtp?type=node&node=5515124&i=2>
> > > To unsubscribe from Camel - Users, click here<
> >
> >
> > > .
> > > NAML<
> >
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
>
> > >
> > >
> >
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5513385.html
>
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5515124.html
>  To start a new topic under Camel - Users, email
> ml-node+s465427n465428h94@n5.nabble.com
> To unsubscribe from Camel - Users, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=cmFtZXNoLnNyaWRoYXJhbkBpaGcuY29tfDQ2NTQyOHwxMjE3MTM3MDYz>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


--
View this message in context: http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5517811.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by Christian Müller <ch...@gmail.com>.
As Claus suggested, use

<bean id="myBean" class="..." />

<setHeader headerName="myHeader">
    <ref id="myBean" />
</setHeader>

Best,
Christian

On Fri, Feb 24, 2012 at 6:07 PM, ramesri <ra...@ihg.com> wrote:

> Thank you all for the inputs.  Its just that I am new to Camel and having
> trouble to implement in Spring DSL what is suggested by Christian.  Can you
> pls show me how to do this in Spring DSL.  Assuming that I define the
> EscapeTool as <bean id="escTool"
> class="org.apache.velocity.tools.generic.EscapeTool"/>, how do I <ref> it
> in the <setHeader headerName="esc"> ?
>
> Regards
> Ramesh
>
> On Fri, Feb 24, 2012 at 4:01 AM, Christian Mueller [via Camel] <
> ml-node+s465427n5512103h19@n5.nabble.com> wrote:
>
> > It's not only the velocity-tools provided classes what the user can use
> > here. We have a custom class with some transformations (e.g. transform
> the
> > ISO two letter country code - e.g. "DE" - to the full name - e.g.
> > "Deutschland").
> > May be adding some words how to use this functionality inside Camel on
> our
> > WIKI page is sufficient? I didn't like the idea to change the code "only"
> > to autodetect the velocity-tools provided utillity classes - my 0,02 $...
> >
> > Best,
> > Christian
> >
> > On Fri, Feb 24, 2012 at 8:44 AM, Claus Ibsen <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=5512103&i=0>>
> > wrote:
> >
> > > On Thu, Feb 23, 2012 at 8:59 PM, Reuben Garrett <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=5512103&i=1>>
> >
> > > wrote:
> > > > Ramesh,
> > > >
> > > > I'm not as knowledgeable as the committers, but it looks like you're
> > > trying
> > > > to attach an instance of the EscapeTool class to a header in your
> > > Exchange
> > > > and then invoke it later on inside the Velocity template.  But when
> > you
> > > use
> > > > a <constant/> expression in the Spring DSL, it just returns the text
> > > within
> > > > the <constant/> tags as a String.
> > > >
> > > > Christian's example in the Java DSL seems closer because it's
> actually
> > > > attaching a Class object (rather than the name of the class).  Maybe
> > if
> > > you
> > > > somehow instantiate an instance of EscapeTool and attach it to the
> > > > exchange, you'll then be able to invoke it.   The Java DSL might be
> > more
> > > > direct for this, but I'll bet there's an easy way to do it in the
> > Spring
> > > > DSL, too.
> > > >
> > > > That being said, I don't know much about Velocity.  However the
> > > <constant/>
> > > > expression doesn't seem to be what you want.
> > > >
> > >
> > > Yeah in XML DSLs you can use <ref> to refer to a bean to lookup and
> use.
> > > http://camel.apache.org/ref-language.html
> > >
> > > However maybe we can auto detect the velocity tools and provide it out
> > > of the box?
> > >
> > >
> > > > Claus, Christian - am I on the right track?
> > > >
> > > > ~ RNPG
> > > >
> > > > On Thu, Feb 23, 2012 at 11:15, ramesri <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=5512103&i=2>>
> > wrote:
> > > >
> > > >> Sorry, I set the header as and no luck.
> > > >>
> > > >> <setHeader headerName="esc">
> > > >>
> > > >>
> > > >>
> > <constant>org.apache.velocity.tools.generic.EscapeTool.class</constant>
> > > >>
> > > >> </setHeader>
> > > >>
> > > >>
> > > >> Thanks
> > > >> Ramesh
> > > >>
> > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -----------------
> > > FuseSource
> > > Email: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=5512103&i=3>
> > > Web: http://fusesource.com
> > > Twitter: davsclaus, fusenews
> > > Blog: http://davsclaus.blogspot.com/
> > > Author of Camel in Action: http://www.manning.com/ibsen/
> > >
> >
> >
> > ------------------------------
> >  If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5512103.html
> >  To start a new topic under Camel - Users, email
> > ml-node+s465427n465428h94@n5.nabble.com
> > To unsubscribe from Camel - Users, click here<
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=cmFtZXNoLnNyaWRoYXJhbkBpaGcuY29tfDQ2NTQyOHwxMjE3MTM3MDYz
> >
> > .
> > NAML<
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5513385.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by ramesri <ra...@ihg.com>.
Thank you all for the inputs.  Its just that I am new to Camel and having
trouble to implement in Spring DSL what is suggested by Christian.  Can you
pls show me how to do this in Spring DSL.  Assuming that I define the
EscapeTool as <bean id="escTool"
class="org.apache.velocity.tools.generic.EscapeTool"/>, how do I <ref> it
in the <setHeader headerName="esc"> ?

Regards
Ramesh

On Fri, Feb 24, 2012 at 4:01 AM, Christian Mueller [via Camel] <
ml-node+s465427n5512103h19@n5.nabble.com> wrote:

> It's not only the velocity-tools provided classes what the user can use
> here. We have a custom class with some transformations (e.g. transform the
> ISO two letter country code - e.g. "DE" - to the full name - e.g.
> "Deutschland").
> May be adding some words how to use this functionality inside Camel on our
> WIKI page is sufficient? I didn't like the idea to change the code "only"
> to autodetect the velocity-tools provided utillity classes - my 0,02 $...
>
> Best,
> Christian
>
> On Fri, Feb 24, 2012 at 8:44 AM, Claus Ibsen <[hidden email]<http://user/SendEmail.jtp?type=node&node=5512103&i=0>>
> wrote:
>
> > On Thu, Feb 23, 2012 at 8:59 PM, Reuben Garrett <[hidden email]<http://user/SendEmail.jtp?type=node&node=5512103&i=1>>
>
> > wrote:
> > > Ramesh,
> > >
> > > I'm not as knowledgeable as the committers, but it looks like you're
> > trying
> > > to attach an instance of the EscapeTool class to a header in your
> > Exchange
> > > and then invoke it later on inside the Velocity template.  But when
> you
> > use
> > > a <constant/> expression in the Spring DSL, it just returns the text
> > within
> > > the <constant/> tags as a String.
> > >
> > > Christian's example in the Java DSL seems closer because it's actually
> > > attaching a Class object (rather than the name of the class).  Maybe
> if
> > you
> > > somehow instantiate an instance of EscapeTool and attach it to the
> > > exchange, you'll then be able to invoke it.   The Java DSL might be
> more
> > > direct for this, but I'll bet there's an easy way to do it in the
> Spring
> > > DSL, too.
> > >
> > > That being said, I don't know much about Velocity.  However the
> > <constant/>
> > > expression doesn't seem to be what you want.
> > >
> >
> > Yeah in XML DSLs you can use <ref> to refer to a bean to lookup and use.
> > http://camel.apache.org/ref-language.html
> >
> > However maybe we can auto detect the velocity tools and provide it out
> > of the box?
> >
> >
> > > Claus, Christian - am I on the right track?
> > >
> > > ~ RNPG
> > >
> > > On Thu, Feb 23, 2012 at 11:15, ramesri <[hidden email]<http://user/SendEmail.jtp?type=node&node=5512103&i=2>>
> wrote:
> > >
> > >> Sorry, I set the header as and no luck.
> > >>
> > >> <setHeader headerName="esc">
> > >>
> > >>
> > >>
> <constant>org.apache.velocity.tools.generic.EscapeTool.class</constant>
> > >>
> > >> </setHeader>
> > >>
> > >>
> > >> Thanks
> > >> Ramesh
> > >>
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > FuseSource
> > Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5512103&i=3>
> > Web: http://fusesource.com
> > Twitter: davsclaus, fusenews
> > Blog: http://davsclaus.blogspot.com/
> > Author of Camel in Action: http://www.manning.com/ibsen/
> >
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5512103.html
>  To start a new topic under Camel - Users, email
> ml-node+s465427n465428h94@n5.nabble.com
> To unsubscribe from Camel - Users, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=cmFtZXNoLnNyaWRoYXJhbkBpaGcuY29tfDQ2NTQyOHwxMjE3MTM3MDYz>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


--
View this message in context: http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5513385.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by Christian Müller <ch...@gmail.com>.
It's not only the velocity-tools provided classes what the user can use
here. We have a custom class with some transformations (e.g. transform the
ISO two letter country code - e.g. "DE" - to the full name - e.g.
"Deutschland").
May be adding some words how to use this functionality inside Camel on our
WIKI page is sufficient? I didn't like the idea to change the code "only"
to autodetect the velocity-tools provided utillity classes - my 0,02 $...

Best,
Christian

On Fri, Feb 24, 2012 at 8:44 AM, Claus Ibsen <cl...@gmail.com> wrote:

> On Thu, Feb 23, 2012 at 8:59 PM, Reuben Garrett <re...@gmail.com>
> wrote:
> > Ramesh,
> >
> > I'm not as knowledgeable as the committers, but it looks like you're
> trying
> > to attach an instance of the EscapeTool class to a header in your
> Exchange
> > and then invoke it later on inside the Velocity template.  But when you
> use
> > a <constant/> expression in the Spring DSL, it just returns the text
> within
> > the <constant/> tags as a String.
> >
> > Christian's example in the Java DSL seems closer because it's actually
> > attaching a Class object (rather than the name of the class).  Maybe if
> you
> > somehow instantiate an instance of EscapeTool and attach it to the
> > exchange, you'll then be able to invoke it.   The Java DSL might be more
> > direct for this, but I'll bet there's an easy way to do it in the Spring
> > DSL, too.
> >
> > That being said, I don't know much about Velocity.  However the
> <constant/>
> > expression doesn't seem to be what you want.
> >
>
> Yeah in XML DSLs you can use <ref> to refer to a bean to lookup and use.
> http://camel.apache.org/ref-language.html
>
> However maybe we can auto detect the velocity tools and provide it out
> of the box?
>
>
> > Claus, Christian - am I on the right track?
> >
> > ~ RNPG
> >
> > On Thu, Feb 23, 2012 at 11:15, ramesri <ra...@ihg.com> wrote:
> >
> >> Sorry, I set the header as and no luck.
> >>
> >> <setHeader headerName="esc">
> >>
> >>
> >> <constant>org.apache.velocity.tools.generic.EscapeTool.class</constant>
> >>
> >> </setHeader>
> >>
> >>
> >> Thanks
> >> Ramesh
> >>
>
>
>
> --
> 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: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Feb 23, 2012 at 8:59 PM, Reuben Garrett <re...@gmail.com> wrote:
> Ramesh,
>
> I'm not as knowledgeable as the committers, but it looks like you're trying
> to attach an instance of the EscapeTool class to a header in your Exchange
> and then invoke it later on inside the Velocity template.  But when you use
> a <constant/> expression in the Spring DSL, it just returns the text within
> the <constant/> tags as a String.
>
> Christian's example in the Java DSL seems closer because it's actually
> attaching a Class object (rather than the name of the class).  Maybe if you
> somehow instantiate an instance of EscapeTool and attach it to the
> exchange, you'll then be able to invoke it.   The Java DSL might be more
> direct for this, but I'll bet there's an easy way to do it in the Spring
> DSL, too.
>
> That being said, I don't know much about Velocity.  However the <constant/>
> expression doesn't seem to be what you want.
>

Yeah in XML DSLs you can use <ref> to refer to a bean to lookup and use.
http://camel.apache.org/ref-language.html

However maybe we can auto detect the velocity tools and provide it out
of the box?


> Claus, Christian - am I on the right track?
>
> ~ RNPG
>
> On Thu, Feb 23, 2012 at 11:15, ramesri <ra...@ihg.com> wrote:
>
>> Sorry, I set the header as and no luck.
>>
>> <setHeader headerName="esc">
>>
>>
>> <constant>org.apache.velocity.tools.generic.EscapeTool.class</constant>
>>
>> </setHeader>
>>
>>
>> Thanks
>> Ramesh
>>



-- 
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: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by Christian Müller <ch...@gmail.com>.
I added the test [1].

                from("direct:a")
                    .setHeader("esc", constant(new EscapeTool()))

.to("velocity:org/apache/camel/component/velocity/escape.vm");

and the template expression:
$headers.esc.xml(${body})

Hope this will solve your problem...

[1]
https://svn.apache.org/repos/asf/camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityMethodInvokationTest.java

Best,
Christian

On Thu, Feb 23, 2012 at 11:58 PM, Christian Müller <
christian.mueller@gmail.com> wrote:

> Will add a unit test and update this thread later...
>
> Best,
> Christian
>
>
> On Thu, Feb 23, 2012 at 8:59 PM, Reuben Garrett <re...@gmail.com>wrote:
>
>> Ramesh,
>>
>> I'm not as knowledgeable as the committers, but it looks like you're
>> trying
>> to attach an instance of the EscapeTool class to a header in your Exchange
>> and then invoke it later on inside the Velocity template.  But when you
>> use
>> a <constant/> expression in the Spring DSL, it just returns the text
>> within
>> the <constant/> tags as a String.
>>
>> Christian's example in the Java DSL seems closer because it's actually
>> attaching a Class object (rather than the name of the class).  Maybe if
>> you
>> somehow instantiate an instance of EscapeTool and attach it to the
>> exchange, you'll then be able to invoke it.   The Java DSL might be more
>> direct for this, but I'll bet there's an easy way to do it in the Spring
>> DSL, too.
>>
>> That being said, I don't know much about Velocity.  However the
>> <constant/>
>> expression doesn't seem to be what you want.
>>
>> Claus, Christian - am I on the right track?
>>
>> ~ RNPG
>>
>> On Thu, Feb 23, 2012 at 11:15, ramesri <ra...@ihg.com> wrote:
>>
>> > Sorry, I set the header as and no luck.
>> >
>> > <setHeader headerName="esc">
>> >
>> >
>> > <constant>org.apache.velocity.tools.generic.EscapeTool.class</constant>
>> >
>> > </setHeader>
>> >
>> >
>> > Thanks
>> > Ramesh
>> >
>>
>
>

Re: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by Christian Müller <ch...@gmail.com>.
Will add a unit test and update this thread later...

Best,
Christian

On Thu, Feb 23, 2012 at 8:59 PM, Reuben Garrett <re...@gmail.com>wrote:

> Ramesh,
>
> I'm not as knowledgeable as the committers, but it looks like you're trying
> to attach an instance of the EscapeTool class to a header in your Exchange
> and then invoke it later on inside the Velocity template.  But when you use
> a <constant/> expression in the Spring DSL, it just returns the text within
> the <constant/> tags as a String.
>
> Christian's example in the Java DSL seems closer because it's actually
> attaching a Class object (rather than the name of the class).  Maybe if you
> somehow instantiate an instance of EscapeTool and attach it to the
> exchange, you'll then be able to invoke it.   The Java DSL might be more
> direct for this, but I'll bet there's an easy way to do it in the Spring
> DSL, too.
>
> That being said, I don't know much about Velocity.  However the <constant/>
> expression doesn't seem to be what you want.
>
> Claus, Christian - am I on the right track?
>
> ~ RNPG
>
> On Thu, Feb 23, 2012 at 11:15, ramesri <ra...@ihg.com> wrote:
>
> > Sorry, I set the header as and no luck.
> >
> > <setHeader headerName="esc">
> >
> >
> > <constant>org.apache.velocity.tools.generic.EscapeTool.class</constant>
> >
> > </setHeader>
> >
> >
> > Thanks
> > Ramesh
> >
>

Re: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by Reuben Garrett <re...@gmail.com>.
Ramesh,

I'm not as knowledgeable as the committers, but it looks like you're trying
to attach an instance of the EscapeTool class to a header in your Exchange
and then invoke it later on inside the Velocity template.  But when you use
a <constant/> expression in the Spring DSL, it just returns the text within
the <constant/> tags as a String.

Christian's example in the Java DSL seems closer because it's actually
attaching a Class object (rather than the name of the class).  Maybe if you
somehow instantiate an instance of EscapeTool and attach it to the
exchange, you'll then be able to invoke it.   The Java DSL might be more
direct for this, but I'll bet there's an easy way to do it in the Spring
DSL, too.

That being said, I don't know much about Velocity.  However the <constant/>
expression doesn't seem to be what you want.

Claus, Christian - am I on the right track?

~ RNPG

On Thu, Feb 23, 2012 at 11:15, ramesri <ra...@ihg.com> wrote:

> Sorry, I set the header as and no luck.
>
> <setHeader headerName="esc">
>
>
> <constant>org.apache.velocity.tools.generic.EscapeTool.class</constant>
>
> </setHeader>
>
>
> Thanks
> Ramesh
>

Re: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by ramesri <ra...@ihg.com>.
Sorry, I set the header as and no luck.

<setHeader headerName="esc">

<constant>org.apache.velocity.tools.generic.EscapeTool.class</constant>

>         </setHeader>


Thanks
Ramesh


On Thu, Feb 23, 2012 at 12:01 PM, Ramesh Sridharan <ramesh.sridharan@ihg.com
> wrote:

> Hi Christian
>
> I tried setting the header in the SpringDSL like this
>
> <setHeader headerName="SOAPAction">
>
> <constant>org.apache.velocity.tools.generic.EscapeTool.class</constant>
>         </setHeader>
>
> and in the template , I used it as
>
> $headers.esc.xml($headers.addrLine1)
>
> It did not work.
>
> Claus, I have created a bundle for velocity tools and deployed it first
> before deploying the route bundle.
> Also I am importing the package org.apache.velocity.tools.* in the route
> bundle pom.xml
>
> Any other way to get this to work.
>
> Thanks
> Ramesh
>
>
>
>
>
>
> On Thu, Feb 23, 2012 at 11:08 AM, Claus Ibsen-2 [via Camel] <
> ml-node+s465427n5508489h85@n5.nabble.com> wrote:
>
>> On Thu, Feb 23, 2012 at 4:33 PM, Christian Müller
>> <[hidden email] <http://user/SendEmail.jtp?type=node&node=5508489&i=0>>
>> wrote:
>> > Did you something like
>> > exchange.getIn().setHeader("esc",
>> > org.apache.velocity.tools.generic.EscapeTool.class);
>> >
>> > Than you have to use:
>> > $headers.esc.xml($headers.addrLine1)
>> >
>> > Works for us with a custom formatter tool...
>> >
>>
>> How would setting a header with a key "esc" with a value of a .class,
>> allow Velocity to know to instantiate and use the EscapeTool ?
>>
>> Also does this require velocity-tools JAR on the classpath?
>>
>> If not maybe we can added it by default to camel-velocity?
>>
>> > Best,
>> > Christian
>> >
>> > On Thu, Feb 23, 2012 at 3:49 PM, ramesri <[hidden email]<http://user/SendEmail.jtp?type=node&node=5508489&i=1>>
>> wrote:
>> >
>> >> Hi Claus
>> >>
>> >> Please help me out.  I am stuck with this and couldnot proceed.
>> >>
>> >> Thanks
>> >> Ramesh
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5508249.html
>> >> Sent from the Camel - Users mailing list archive at Nabble.com.
>> >>
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5508489&i=2>
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5508489.html
>>  To start a new topic under Camel - Users, email
>> ml-node+s465427n465428h94@n5.nabble.com
>> To unsubscribe from Camel - Users, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=cmFtZXNoLnNyaWRoYXJhbkBpaGcuY29tfDQ2NTQyOHwxMjE3MTM3MDYz>
>> .
>> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>


--
View this message in context: http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5508700.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by ramesri <ra...@ihg.com>.
Hi Christian

I tried setting the header in the SpringDSL like this

<setHeader headerName="SOAPAction">

<constant>org.apache.velocity.tools.generic.EscapeTool.class</constant>
        </setHeader>

and in the template , I used it as

$headers.esc.xml($headers.addrLine1)

It did not work.

Claus, I have created a bundle for velocity tools and deployed it first
before deploying the route bundle.
Also I am importing the package org.apache.velocity.tools.* in the route
bundle pom.xml

Any other way to get this to work.

Thanks
Ramesh






On Thu, Feb 23, 2012 at 11:08 AM, Claus Ibsen-2 [via Camel] <
ml-node+s465427n5508489h85@n5.nabble.com> wrote:

> On Thu, Feb 23, 2012 at 4:33 PM, Christian Müller
> <[hidden email] <http://user/SendEmail.jtp?type=node&node=5508489&i=0>>
> wrote:
> > Did you something like
> > exchange.getIn().setHeader("esc",
> > org.apache.velocity.tools.generic.EscapeTool.class);
> >
> > Than you have to use:
> > $headers.esc.xml($headers.addrLine1)
> >
> > Works for us with a custom formatter tool...
> >
>
> How would setting a header with a key "esc" with a value of a .class,
> allow Velocity to know to instantiate and use the EscapeTool ?
>
> Also does this require velocity-tools JAR on the classpath?
>
> If not maybe we can added it by default to camel-velocity?
>
> > Best,
> > Christian
> >
> > On Thu, Feb 23, 2012 at 3:49 PM, ramesri <[hidden email]<http://user/SendEmail.jtp?type=node&node=5508489&i=1>>
> wrote:
> >
> >> Hi Claus
> >>
> >> Please help me out.  I am stuck with this and couldnot proceed.
> >>
> >> Thanks
> >> Ramesh
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5508249.html
> >> Sent from the Camel - Users mailing list archive at Nabble.com.
> >>
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5508489&i=2>
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5508489.html
>  To start a new topic under Camel - Users, email
> ml-node+s465427n465428h94@n5.nabble.com
> To unsubscribe from Camel - Users, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=cmFtZXNoLnNyaWRoYXJhbkBpaGcuY29tfDQ2NTQyOHwxMjE3MTM3MDYz>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


--
View this message in context: http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5508645.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Feb 23, 2012 at 4:33 PM, Christian Müller
<ch...@gmail.com> wrote:
> Did you something like
> exchange.getIn().setHeader("esc",
> org.apache.velocity.tools.generic.EscapeTool.class);
>
> Than you have to use:
> $headers.esc.xml($headers.addrLine1)
>
> Works for us with a custom formatter tool...
>

How would setting a header with a key "esc" with a value of a .class,
allow Velocity to know to instantiate and use the EscapeTool ?

Also does this require velocity-tools JAR on the classpath?

If not maybe we can added it by default to camel-velocity?

> Best,
> Christian
>
> On Thu, Feb 23, 2012 at 3:49 PM, ramesri <ra...@ihg.com> wrote:
>
>> Hi Claus
>>
>> Please help me out.  I am stuck with this and couldnot proceed.
>>
>> Thanks
>> Ramesh
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5508249.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: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by Christian Müller <ch...@gmail.com>.
Did you something like
exchange.getIn().setHeader("esc",
org.apache.velocity.tools.generic.EscapeTool.class);

Than you have to use:
$headers.esc.xml($headers.addrLine1)

Works for us with a custom formatter tool...

Best,
Christian

On Thu, Feb 23, 2012 at 3:49 PM, ramesri <ra...@ihg.com> wrote:

> Hi Claus
>
> Please help me out.  I am stuck with this and couldnot proceed.
>
> Thanks
> Ramesh
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5508249.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template

Posted by ramesri <ra...@ihg.com>.
Hi Claus 

Please help me out.  I am stuck with this and couldnot proceed.

Thanks
Ramesh


--
View this message in context: http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5508249.html
Sent from the Camel - Users mailing list archive at Nabble.com.