velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <nbu...@gmail.com>
Subject Re: tools 1.4=>2.0 upgrade, configuration question
Date Wed, 25 Feb 2009 17:17:54 GMT
Odd. Which VelocityViewServlet does your VelocityServlet extend?  It
should be extending
org.apache.velocity.tools.view.VelocityViewServlet.

Also, which version of VelocityTools 2 are you using?

On Wed, Feb 25, 2009 at 9:01 AM, rhild <rhild@yahoo.com> wrote:
>
> Here is the code:
>
> package atr.servlet;
> import org.apache.log4j.Logger;
> import org.apache.velocity.tools.view.VelocityView;
> import org.apache.velocity.tools.view.JeeConfig;
> import org.apache.velocity.app.VelocityEngine;
>
> import atr.utils.SystemProperties;
>
> public class ConfigurableVelocityView extends VelocityView {
>        static Logger logger =
> Logger.getLogger(ConfigurableVelocityView.class.getName());
>
>        public ConfigurableVelocityView(JeeConfig config) {
>                super(config);
>        }
>
>        protected void configure(JeeConfig config, VelocityEngine engine) {
>                super.configure(config, engine);
>                logger.info("Using ConfigurableVelocityView");
>                String[] props = { "webapp.resource.loader.cache",
> "webapp.resource.loader.modificationCheckInterval",
>                                "velocimacro.library.autoreload" };
>                for (String prop : props) {
>                        String value = SystemProperties.INSTANCE.getProperty("prop");
>                        if (value != null && value.length() > 0)
{
>                                engine.setProperty(prop, value);
>                                logger.info("setting custom Velocity property:
name=" + prop + ",
> value=" + value);
>                        }
>                }
>
>        }
> }
>
> here is the relevant piece of web.xml:
>
>        <servlet>
>                <servlet-name>velocity</servlet-name>
>                <servlet-class>atr.servlet.VelocityServlet</servlet-class>
>                <init-param>
>                        <param-name>org.apache.velocity.tools.view.class</param-name>
>                        <param-value>atr.servlet.ConfigurableVelocityView</param-value>
>                </init-param>
>        </servlet>
>
> atr.servlet.VelocityServlet extends VelocityViewServlet.  I still use a
> velocity.properties 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: http://www.nabble.com/tools-1.4%3D%3E2.0-upgrade%2C-configuration-question-tp22167805p22207069.html
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message