camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Müller <christian.muel...@gmail.com>
Subject Re: How to use escape tool ($esc.xml($somestrwithspclchars)) in camel velocity template
Date Fri, 24 Feb 2012 09:00:44 GMT
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 <claus.ibsen@gmail.com> wrote:

> On Thu, Feb 23, 2012 at 8:59 PM, Reuben Garrett <reubengarrett@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 <ramesh.sridharan@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/
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message