From 8cd5ea5f0dec8d3197c1a5a81a4fff69d2ce26a7 Mon Sep 17 00:00:00 2001 From: mdb Date: Wed, 8 Dec 2004 01:46:54 +0000 Subject: [PATCH] Allow an application to get in on the Velocity configuration process. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1539 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../src/java/com/samskivert/velocity/Application.java | 10 ++++++++++ .../com/samskivert/velocity/DispatcherServlet.java | 3 +++ 2 files changed, 13 insertions(+) diff --git a/projects/samskivert/src/java/com/samskivert/velocity/Application.java b/projects/samskivert/src/java/com/samskivert/velocity/Application.java index 02f043c5..1713f271 100644 --- a/projects/samskivert/src/java/com/samskivert/velocity/Application.java +++ b/projects/samskivert/src/java/com/samskivert/velocity/Application.java @@ -20,6 +20,8 @@ package com.samskivert.velocity; +import java.util.Properties; + import javax.servlet.ServletConfig; import javax.servlet.ServletContext; @@ -125,6 +127,14 @@ public class Application didInit(config); } + /** + * Called prior to initializing Velocity to allow the application to + * specify custom configuration properties. + */ + protected void configureVelocity (ServletConfig config, Properties props) + { + } + /** * Looks up an initialization parameter for this application. The * default implementation retrieves the value from the servlet config, diff --git a/projects/samskivert/src/java/com/samskivert/velocity/DispatcherServlet.java b/projects/samskivert/src/java/com/samskivert/velocity/DispatcherServlet.java index 151c6edd..5bd4af9c 100644 --- a/projects/samskivert/src/java/com/samskivert/velocity/DispatcherServlet.java +++ b/projects/samskivert/src/java/com/samskivert/velocity/DispatcherServlet.java @@ -243,6 +243,9 @@ public class DispatcherServlet extends VelocityServlet props.setProperty(RuntimeSingleton.RUNTIME_LOG_LOGSYSTEM_CLASS, ServletContextLogger.class.getName()); + // let the application set up other properties + _app.configureVelocity(config, props); + // now return our augmented properties return props; }