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.muel...@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 > <reubengarr...@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 <ramesh.sridha...@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 >> > >> > >