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+s465427n5515124...@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+s465427n465428...@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.