Hi
In my IDEA plugin (generate toString) that uses Velocity for the code
generation I have some velocity properties to control the velocity logging to
log4j in a category i can decide.
prop.addProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM_CLASS,
SimpleLog4JLogSystem.class.getName());
prop.addProperty("runtime.log.logsystem.log4j.category",
"GenerateToString");
Med venlig hilsen
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: misge [mailto:[EMAIL PROTECTED]
Sent: 6. maj 2008 15:04
To: [email protected]
Subject: Re: Velocity templating
Some other sugestions in the VelocityEndoint are:
String tmplName = VM_PATH+"/"+vtlName+".vm";
Template t = Velocity.getTemplate(tmplName);
StringWriter writer = new StringWriter();
Map variableMap = ExchangeHelper.createVariableMap(exchange);
Context velocityContext = new VelocityContext(variableMap);
t.merge(velocityContext, writer);
String result = writer.toString();
instead of:
Reader reader = new InputStreamReader(getResource().getInputStream());
StringWriter buffer = new StringWriter();
String logTag = getClass().getName();
Map variableMap = ExchangeHelper.createVariableMap(exchange);
Context velocityContext = new VelocityContext(variableMap);
VelocityEngine engine = getVelocityEngine();
engine.evaluate(velocityContext, buffer, logTag, reader);
--
View this message in context:
http://www.nabble.com/Velocity-templating-tp17079359s22882p17082360.html
Sent from the Camel - Users mailing list archive at Nabble.com.