| org.springframework.web.servlet.view.velocity.VelocityView org.springframework.web.servlet.view.velocity.VelocityToolboxView
All known Subclasses: org.springframework.web.servlet.view.velocity.VelocityLayoutView,
VelocityToolboxView | public class VelocityToolboxView extends VelocityView (Code) | | 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
VelocityToolboxView.setToolAttributes "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 2.0, this class requires Velocity Tools 1.2 or higher.
author: Juergen Hoeller since: 1.1.3 See Also: VelocityToolboxView.setToolboxConfigLocation See Also: VelocityToolboxView.initTool See Also: org.apache.velocity.tools.view.context.ViewContext See Also: org.apache.velocity.tools.view.context.ChainedContext See Also: org.apache.velocity.tools.view.tools.ViewTool See Also: org.apache.velocity.tools.view.tools.LinkTool |
Method Summary | |
protected Context | createVelocityContext(Map model, HttpServletRequest request, HttpServletResponse response) Overridden to create a ChainedContext, which is part of the view package
of Velocity Tools, as special context. | protected String | getToolboxConfigLocation() Return the Velocity Toolbox config location, if any. | protected void | initTool(Object tool, Context velocityContext) Overridden to check for the ViewContext interface which is part of the
view package of Velocity Tools. | public void | setToolboxConfigLocation(String toolboxConfigLocation) 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. |
getToolboxConfigLocation | protected String getToolboxConfigLocation()(Code) | | Return the Velocity Toolbox config location, if any.
|
initTool | protected void initTool(Object tool, Context velocityContext) throws Exception(Code) | | Overridden to check for the ViewContext interface which is part of the
view package of Velocity Tools. This requires a special Velocity context,
like ChainedContext as set up by
VelocityToolboxView.createVelocityContext in this class.
See Also: org.apache.velocity.tools.view.tools.ViewTool.init(Object) See Also: org.apache.velocity.tools.view.tools.LinkTool.init(Object) |
setToolboxConfigLocation | public void setToolboxConfigLocation(String toolboxConfigLocation)(Code) | | 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. If no config location is
specified, no toolbox will be loaded and exposed.
The specfied location string needs to refer to a ServletContext
resource, as expected by ServletToolboxManager which is part of
the view package of Velocity Tools.
See Also: org.apache.velocity.tools.view.servlet.ServletToolboxManager.getInstance |
Methods inherited from org.springframework.web.servlet.view.velocity.VelocityView | protected VelocityEngine autodetectVelocityEngine() throws BeansException(Code)(Java Doc) protected void checkTemplate() throws ApplicationContextException(Code)(Java Doc) protected Context createVelocityContext(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)(Java Doc) protected Context createVelocityContext(Map model) throws Exception(Code)(Java Doc) protected void doRender(Context context, HttpServletResponse response) throws Exception(Code)(Java Doc) protected void exposeHelpers(Map model, HttpServletRequest request) throws Exception(Code)(Java Doc) protected void exposeHelpers(Context velocityContext, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)(Java Doc) protected void exposeHelpers(Context velocityContext, HttpServletRequest request) throws Exception(Code)(Java Doc) protected void exposeToolAttributes(Context velocityContext, HttpServletRequest request) throws Exception(Code)(Java Doc) protected String getEncoding()(Code)(Java Doc) protected Template getTemplate() throws Exception(Code)(Java Doc) protected Template getTemplate(String name) throws Exception(Code)(Java Doc) protected VelocityEngine getVelocityEngine()(Code)(Java Doc) protected void initApplicationContext() throws BeansException(Code)(Java Doc) protected void initTool(Object tool, Context velocityContext) throws Exception(Code)(Java Doc) protected boolean isCacheTemplate()(Code)(Java Doc) protected void mergeTemplate(Template template, Context context, HttpServletResponse response) throws Exception(Code)(Java Doc) protected void renderMergedTemplateModel(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception(Code)(Java Doc) public void setCacheTemplate(boolean cacheTemplate)(Code)(Java Doc) public void setDateToolAttribute(String dateToolAttribute)(Code)(Java Doc) public void setEncoding(String encoding)(Code)(Java Doc) public void setNumberToolAttribute(String numberToolAttribute)(Code)(Java Doc) public void setToolAttributes(Properties toolAttributes)(Code)(Java Doc) public void setVelocityEngine(VelocityEngine velocityEngine)(Code)(Java Doc) public void setVelocityFormatterAttribute(String velocityFormatterAttribute)(Code)(Java Doc)
|
|
|