Initialize velocity in the proper way.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1533 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2004-11-26 22:57:59 +00:00
parent 6cc7786aa6
commit 64b8b1ab9f
@@ -3,8 +3,6 @@
package com.samskivert.velocity; package com.samskivert.velocity;
import java.util.Properties;
import org.apache.velocity.VelocityContext; import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine; import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeServices; import org.apache.velocity.runtime.RuntimeServices;
@@ -30,16 +28,14 @@ public class VelocityUtil
throws Exception throws Exception
{ {
// initialize velocity which we'll use for templating // initialize velocity which we'll use for templating
Properties props = new Properties(); VelocityEngine ve = new VelocityEngine();
props.put(VelocityEngine.VM_LIBRARY, ""); ve.setProperty(VelocityEngine.VM_LIBRARY, "");
props.put(VelocityEngine.RESOURCE_LOADER, "classpath"); ve.setProperty(VelocityEngine.RESOURCE_LOADER, "classpath");
props.put("classpath." + VelocityEngine.RESOURCE_LOADER + ".class", ve.setProperty("classpath." + VelocityEngine.RESOURCE_LOADER + ".class",
ClasspathResourceLoader.class.getName()); ClasspathResourceLoader.class.getName());
VelocityEngine velocity = new VelocityEngine(); ve.setProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM, _logger);
velocity.init(props); ve.init();
velocity.setProperty( return ve;
VelocityEngine.RUNTIME_LOG_LOGSYSTEM, _logger);
return velocity;
} }
/** Handles logging for Velocity. */ /** Handles logging for Velocity. */