velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhild <>
Subject Re: tools 1.4=>2.0 upgrade, configuration question
Date Wed, 25 Feb 2009 17:01:20 GMT

Here is the code:

package atr.servlet;
import org.apache.log4j.Logger;

import atr.utils.SystemProperties;

public class ConfigurableVelocityView extends VelocityView {
	static Logger logger =

	public ConfigurableVelocityView(JeeConfig config) {

	protected void configure(JeeConfig config, VelocityEngine engine) {
		super.configure(config, engine);"Using ConfigurableVelocityView");
		String[] props = { "webapp.resource.loader.cache",
				"velocimacro.library.autoreload" };
		for (String prop : props) {
			String value = SystemProperties.INSTANCE.getProperty("prop");
			if (value != null && value.length() > 0) {
				engine.setProperty(prop, value);"setting custom Velocity property: name=" + prop + ",
value=" + value);


here is the relevant piece of web.xml:


atr.servlet.VelocityServlet extends VelocityViewServlet.  I still use a file.  I just want to selectively override some
properties based on  the environment I'm in.  For instance, I want to leave
the properties file as it would be for a production environment, with
template caching on and macro autoreloading off, etc.  But in a dev
environment I'd override those.

When I try the code as shown I get no exceptions thrown or additional log
mesages from Velocity.  There is no indication that my code above runs as
the log messages don't appear and the behavior of velocity does not change,
i.e. templates are still cached.

View this message in context:
Sent from the Velocity - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message