public class VelocityManager extends Object implements VelocityManagerInterface
Modifier and Type | Field and Description |
---|---|
static String |
KEY_VELOCITY_STRUTS_CONTEXT |
protected org.apache.velocity.tools.ToolManager |
toolboxManager
A reference to the toolbox manager.
|
Constructor and Description |
---|
VelocityManager() |
Modifier and Type | Method and Description |
---|---|
protected org.apache.velocity.context.Context |
buildContext(ValueStack stack,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res) |
protected org.apache.velocity.context.Context |
buildToolContext() |
org.apache.velocity.context.Context |
createContext(ValueStack stack,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
This method is responsible for creating the standard VelocityContext used by all Struts Velocity views.
|
org.apache.velocity.tools.ToolManager |
getToolboxManager() |
org.apache.velocity.app.VelocityEngine |
getVelocityEngine() |
Properties |
getVelocityProperties() |
void |
init(javax.servlet.ServletContext context)
initializes the VelocityManager.
|
protected void |
initToolbox(javax.servlet.ServletContext servletContext)
Initializes the ServletToolboxManager for this servlet's
toolbox (if any).
|
Properties |
loadConfiguration(javax.servlet.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(javax.servlet.ServletContext context)
Instantiates a new VelocityEngine.
|
protected List<org.apache.velocity.VelocityContext> |
prepareChainedContexts(javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse,
Map<String,Object> extraContext)
constructs contexts for chaining on this request.
|
void |
setChainedContexts(String contexts)
allow users to specify via the struts.properties file a set of additional VelocityContexts to chain to the
the StrutsVelocityContext.
|
void |
setContainer(Container container) |
void |
setCustomConfigFile(String val) |
void |
setObjectFactory(ObjectFactory fac) |
void |
setToolBoxLocation(String toolboxLocation) |
void |
setVelocityProperties(Properties velocityProperties) |
public static final String KEY_VELOCITY_STRUTS_CONTEXT
protected org.apache.velocity.tools.ToolManager toolboxManager
public void setObjectFactory(ObjectFactory fac)
public void setContainer(Container container)
public org.apache.velocity.app.VelocityEngine getVelocityEngine()
getVelocityEngine
in interface VelocityManagerInterface
public org.apache.velocity.context.Context createContext(ValueStack stack, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
createContext
in interface VelocityManagerInterface
stack
- the current ValueStack
req
- the current HttpServletRequestres
- the current HttpServletResponseprotected org.apache.velocity.context.Context buildContext(ValueStack stack, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
protected org.apache.velocity.context.Context buildToolContext()
protected List<org.apache.velocity.VelocityContext> prepareChainedContexts(javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse, Map<String,Object> extraContext)
servletRequest
- the servlet request objectservletResponse
- the servlet response objectextraContext
- map with extra contextpublic void init(javax.servlet.ServletContext context)
init
in interface VelocityManagerInterface
context
- the current servlet contextpublic Properties loadConfiguration(javax.servlet.ServletContext context)
context
- the current ServletContext. may not be nullpublic void setCustomConfigFile(String val)
public void setToolBoxLocation(String toolboxLocation)
public org.apache.velocity.tools.ToolManager getToolboxManager()
public void setChainedContexts(String contexts)
contexts
- comma separated velocity context'sprotected void initToolbox(javax.servlet.ServletContext servletContext)
protected org.apache.velocity.app.VelocityEngine newVelocityEngine(javax.servlet.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 = org.apache.struts2.views.velocity.StrutsResourceLoader
this default configuration can be overridden by specifying a struts.velocity.configfile property in the struts.properties file. the specified config file will be searched for in the following order:
context
- the current ServletContext. may not be nullpublic Properties getVelocityProperties()
public void setVelocityProperties(Properties velocityProperties)
velocityProperties
- the velocityProperties to setCopyright © 2000–2024 Apache Software Foundation. All rights reserved.