com.opensymphony.webwork.views.velocity
Class VelocityManager

java.lang.Object
  extended bycom.opensymphony.webwork.views.velocity.VelocityManager

public class VelocityManager
extends Object

Author:
Matt Ho

Field Summary
static String ACTION
           
static String OGNL
           
static String PARENT
          the parent JSP tag
static String REQUEST
           
static String RESPONSE
           
static String STACK
           
static String TAG
          the current JSP tag
static String WEBWORK
           
 
Constructor Summary
protected VelocityManager()
           
 
Method Summary
 org.apache.velocity.context.Context createContext(com.opensymphony.xwork.util.OgnlValueStack stack, HttpServletRequest servletRequest, HttpServletResponse servletResponse)
          This method is responsible for creating the standard VelocityContext used by all WW2 velocity views.
static VelocityManager getInstance()
          retrieve an instance to the current VelocityManager
 org.apache.velocity.app.VelocityEngine getVelocityEngine()
           
protected  void init()
          performs one-time initializations
 void init(ServletContext context)
          initializes the VelocityManager.
 Properties loadConfiguration(ServletContext context)
          load optional velocity properties using the following loading strategy relative to the servlet context path relative to the WEB-INF directory on the classpath
protected  org.apache.velocity.app.VelocityEngine newVelocityEngine(ServletContext context)
          

Instantiates a new VelocityEngine.

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REQUEST

public static final String REQUEST
See Also:
Constant Field Values

RESPONSE

public static final String RESPONSE
See Also:
Constant Field Values

STACK

public static final String STACK
See Also:
Constant Field Values

OGNL

public static final String OGNL
See Also:
Constant Field Values

WEBWORK

public static final String WEBWORK
See Also:
Constant Field Values

ACTION

public static final String ACTION
See Also:
Constant Field Values

PARENT

public static final String PARENT
the parent JSP tag

See Also:
Constant Field Values

TAG

public static final String TAG
the current JSP tag

See Also:
Constant Field Values
Constructor Detail

VelocityManager

protected VelocityManager()
Method Detail

getInstance

public static VelocityManager getInstance()
retrieve an instance to the current VelocityManager


getVelocityEngine

public org.apache.velocity.app.VelocityEngine getVelocityEngine()
Returns:
a reference to the VelocityEngine used by all webwork velocity thingies with the exception of directly accessed *.vm pages

createContext

public org.apache.velocity.context.Context createContext(com.opensymphony.xwork.util.OgnlValueStack stack,
                                                         HttpServletRequest servletRequest,
                                                         HttpServletResponse servletResponse)
This method is responsible for creating the standard VelocityContext used by all WW2 velocity views. The following context parameters are defined:

Returns:
a new WebWorkVelocityContext

init

public void init(ServletContext context)
initializes the VelocityManager. this should be called during the initialization process, say by ServletDispatcher. this may be called multiple times safely although calls beyond the first won't do anything

Parameters:
context - the current servlet context

loadConfiguration

public Properties loadConfiguration(ServletContext context)
load optional velocity properties using the following loading strategy

Parameters:
context - the current ServletContext. may not be null
Returns:
the optional properties if webwork.velocity.configfile was specified, an empty Properties file otherwise

init

protected void init()
performs one-time initializations


newVelocityEngine

protected org.apache.velocity.app.VelocityEngine newVelocityEngine(ServletContext context)

Instantiates a new VelocityEngine.

The following is the default Velocity configuration

  resource.loader = file, class
  file.resource.loader.path = real path of webapp
  class.resource.loader.description = Velocity Classpath Resource Loader
  class.resource.loader.class = com.opensymphony.webwork.views.velocity.WebWorkResourceLoader
 

this default configuration can be overridden by specifying a webwork.velocity.configfile property in the webwork.properties file. the specified config file will be searched for in the following order:

Parameters:
context - the current ServletContext. may not be null

WebWork Project Page