com.interface21.web.servlet.view.velocity
Class VelocityConfigurer

java.lang.Object
  |
  +--com.interface21.context.support.ApplicationObjectSupport
        |
        +--com.interface21.web.servlet.view.velocity.VelocityConfigurer
All Implemented Interfaces:
ApplicationContextAware

public class VelocityConfigurer
extends ApplicationObjectSupport

JavaBean to configure Velocity, by setting the location of the Velocity properties file. This bean must be included in the application context of any application using Velocity with the Interface21 framework.
The optional location property sets the location within the WAR of the Velocity properties file. By default it will be sought in the /WEB-INF directory, with the name velocity.properties.
This bean exists purely to configure Velocity. It exposes no methods other than initialization methods, and is not meant to be referenced by application components.

Author:
Rod Johnson

Field Summary
static java.lang.String DEFAULT_VELOCITY_PROPERTIES
           
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
VelocityConfigurer()
           
 
Method Summary
protected  void initApplicationContext()
          Initializes the Velocity runtime, first calling loadConfiguration(ServletConfig) to get a java.util.Properties of configuration information and then calling Velocity.init().
 void setLocation(java.lang.String location)
          Optionally override the location of the Velocity config file.
 
Methods inherited from class com.interface21.context.support.ApplicationObjectSupport
getApplicationContext, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger

DEFAULT_VELOCITY_PROPERTIES

public static final java.lang.String DEFAULT_VELOCITY_PROPERTIES
Constructor Detail

VelocityConfigurer

public VelocityConfigurer()
Method Detail

setLocation

public void setLocation(java.lang.String location)
Optionally override the location of the Velocity config file. Default is "/WEB-INF/velocity.properties".

initApplicationContext

protected void initApplicationContext()
                               throws ApplicationContextException
Initializes the Velocity runtime, first calling loadConfiguration(ServletConfig) to get a java.util.Properties of configuration information and then calling Velocity.init(). Override this to do anything to the environment before the initialization of the singelton takes place, or to initialize the singleton in other ways.
Overrides:
initApplicationContext in class ApplicationObjectSupport


Rod Johnson and Spring contributors 2001-2003.