@Deprecated public class VelocityToolboxView extends VelocityView
VelocityView subclass which adds support for Velocity Tools toolboxes
and Velocity Tools ViewTool callbacks / Velocity Tools 1.3 init methods.
Specify a "toolboxConfigLocation", for example "/WEB-INF/toolbox.xml", to automatically load a Velocity Tools toolbox definition file and expose all defined tools in the specified scopes. If no config location is specified, no toolbox will be loaded and exposed.
This view will always create a special Velocity context, namely an instance of the ChainedContext class which is part of the view package of Velocity tools. This allows to use tools from the view package of Velocity Tools, like LinkTool, which need to be initialized with a special context that implements the ViewContext interface (i.e. a ChainedContext).
This view also checks tools that are specified as "toolAttributes":
If they implement the ViewTool interface, they will get initialized with
the Velocity context. This allows tools from the view package of Velocity
Tools, such as LinkTool, to be defined as
"toolAttributes" on a VelocityToolboxView,
instead of in a separate toolbox XML file.
This is a separate class mainly to avoid a required dependency on
the view package of Velocity Tools in VelocityView itself.
As of Spring 3.0, this class requires Velocity Tools 1.3 or higher.
setToolboxConfigLocation(java.lang.String),
initTool(java.lang.Object, org.apache.velocity.context.Context),
ViewContext,
ChainedContextSPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTEDEFAULT_CONTENT_TYPEloggerPATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE| Constructor and Description |
|---|
VelocityToolboxView()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
protected org.apache.velocity.context.Context |
createVelocityContext(java.util.Map<java.lang.String,java.lang.Object> model,
HttpServletRequest request,
HttpServletResponse response)
Deprecated.
Overridden to create a ChainedContext, which is part of the view package
of Velocity Tools, as special context.
|
protected java.lang.String |
getToolboxConfigLocation()
Deprecated.
Return the Velocity Toolbox config location, if any.
|
protected void |
initTool(java.lang.Object tool,
org.apache.velocity.context.Context velocityContext)
Deprecated.
Overridden to check for the ViewContext interface which is part of the
view package of Velocity Tools.
|
void |
setToolboxConfigLocation(java.lang.String toolboxConfigLocation)
Deprecated.
Set a Velocity Toolbox config location, for example "/WEB-INF/toolbox.xml",
to automatically load a Velocity Tools toolbox definition file and expose
all defined tools in the specified scopes.
|
autodetectVelocityEngine, checkResource, createVelocityContext, doRender, exposeHelpers, exposeHelpers, exposeHelpers, exposeToolAttributes, getEncoding, getTemplate, getTemplate, getVelocityEngine, initApplicationContext, isCacheTemplate, mergeTemplate, renderMergedTemplateModel, setCacheTemplate, setDateToolAttribute, setEncoding, setNumberToolAttribute, setToolAttributes, setVelocityEngineapplyContentType, renderMergedOutputModel, setAllowRequestOverride, setAllowSessionOverride, setExposeRequestAttributes, setExposeSessionAttributes, setExposeSpringMacroHelpersafterPropertiesSet, getUrl, isUrlRequired, setUrl, toStringaddStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getRequestToExpose, getStaticAttributes, isExposePathVariables, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setRequestContextAttribute, setResponseContentType, writeToResponsegetServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContextgetApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContextpublic void setToolboxConfigLocation(java.lang.String toolboxConfigLocation)
The specified location string needs to refer to a ServletContext resource, as expected by ServletToolboxManager which is part of the view package of Velocity Tools.
ServletToolboxManager.getInstance(javax.servlet.ServletContext, java.lang.String)protected java.lang.String getToolboxConfigLocation()
protected org.apache.velocity.context.Context createVelocityContext(java.util.Map<java.lang.String,java.lang.Object> model,
HttpServletRequest request,
HttpServletResponse response)
throws java.lang.Exception
createVelocityContext in class VelocityViewmodel - the model Map, containing the model attributes to be exposed to the viewrequest - current HTTP requestresponse - current HTTP responsejava.lang.Exception - if there's a fatal error while creating the contextinitTool(java.lang.Object, org.apache.velocity.context.Context)protected void initTool(java.lang.Object tool,
org.apache.velocity.context.Context velocityContext)
throws java.lang.Exception
createVelocityContext(java.util.Map<java.lang.String, java.lang.Object>, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) in this class.initTool in class VelocityViewtool - the tool instance to initializevelocityContext - the Velocity contextjava.lang.Exception - if initializion of the tool failedVelocityView.createVelocityContext(java.util.Map<java.lang.String, java.lang.Object>, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse),
ViewContext,
ChainedContext,
VelocityToolboxView