public class VelocityTemplateManager extends TemplateManager implements org.springframework.web.context.ServletContextAware
Constructor and Description |
---|
VelocityTemplateManager(org.springframework.web.servlet.view.velocity.VelocityConfigurer engineConfig,
String toolConfigLocation)
Create a new manager
|
Modifier and Type | Method and Description |
---|---|
void |
addApplicationScopeTools(String providerId,
Class<?>... toolClass)
Add the provided velocity tools to the application scope toolbox.
|
protected void |
addCoreTemplates(Map<String,String> templateMapping)
Add the core templates
|
void |
addRequestScopeTools(String providerId,
Class<?>... toolClass)
Add the provided velocity tools to the request scope toolbox.
|
void |
addTemplateBasePath(String basePath)
Add a base directory for searching templates which are registered with a relative path.
|
void |
addTools(String providerId,
Collection<Class<?>> applicationTools,
Collection<Class<?>> requestTools)
Add the provided velocity tools to the application and request scope toolboxes.
|
org.apache.velocity.tools.view.ViewToolManager |
getToolManager() |
void |
removeTools(String providerId)
Remove all tools that were added by the given provider.
|
void |
setServletContext(javax.servlet.ServletContext servletContext) |
getTemplate, getTemplateNames, registerTemplate, unregisterTemplates
public VelocityTemplateManager(org.springframework.web.servlet.view.velocity.VelocityConfigurer engineConfig, String toolConfigLocation)
engineConfig
- the VelocityEngine configuration that provides the enginetoolConfigLocation
- classpath or filesystem location of the toolbox configurationpublic void addApplicationScopeTools(String providerId, Class<?>... toolClass)
providerId
- the ID of the provider of the tools. This is usually the ID of a plugin.toolClass
- the tools to addprotected void addCoreTemplates(Map<String,String> templateMapping)
TemplateManager
addCoreTemplates
in class TemplateManager
templateMapping
- a mapping from template key to template file where the templates should be added
topublic void addRequestScopeTools(String providerId, Class<?>... toolClass)
providerId
- the ID of the provider of the tools. This is usually the ID of a plugin.toolClass
- the tools to addpublic void addTemplateBasePath(String basePath)
basePath
- absolute path to a directory for searching for templatespublic void addTools(String providerId, Collection<Class<?>> applicationTools, Collection<Class<?>> requestTools)
providerId
- the ID of the provider of the tools. This is usually the ID of a plugin.applicationTools
- the application scope tools to addrequestTools
- the request scope tools to addpublic org.apache.velocity.tools.view.ViewToolManager getToolManager()
public void removeTools(String providerId)
providerId
- the ID of the provider whose tools should be removed. This is usually the ID of a
plugin.public void setServletContext(javax.servlet.ServletContext servletContext)
setServletContext
in interface org.springframework.web.context.ServletContextAware
Copyright © 2019 Communote team. All rights reserved.