com.opensymphony.webwork.views.freemarker
Class FreemarkerManager

java.lang.Object
  extended bycom.opensymphony.webwork.views.freemarker.FreemarkerManager

public class FreemarkerManager
extends Object

Static Configuration Manager for the FreemarkerResult's configuration

Author:
CameronBraid

Field Summary
static String CONFIG_SERVLET_CONTEXT_KEY
           
static String KEY_ACTION
           
static String KEY_APPLICATION
           
static String KEY_EXCEPTION
           
static String KEY_JSP_TAGLIBS
           
static String KEY_OGNL
           
static String KEY_REQUEST
           
static String KEY_REQUEST_MODEL
           
static String KEY_RESPONSE
           
static String KEY_SESSION_MODEL
           
static String KEY_STACK
           
static String KEY_UTIL
           
static String KEY_WEBWORK
           
 
Constructor Summary
FreemarkerManager()
           
 
Method Summary
 ScopesHashModel buildScopesHashModel(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, freemarker.template.ObjectWrapper wrapper)
           
protected  freemarker.template.Configuration createConfiguration(ServletContext servletContext)
          Create the instance of the freemarker Configuration object.
 freemarker.template.Configuration getConfigruation(ServletContext servletContext)
           
static FreemarkerManager getInstance()
          To allow for custom configuration of freemarker, sublcass this class "ConfigManager" and set the webwork configuration property webwork.freemarker.configmanager.classname to the fully qualified classname.
protected  freemarker.ext.beans.BeansWrapper getObjectWrapper()
           
protected  freemarker.cache.TemplateLoader getTemplateLoader(ServletContext servletContext)
          The default template loader is a MultiTemplateLoader which includes a ClassTemplateLoader and a WebappTemplateLoader (and a FileTemplateLoader depending on the init-parameter 'TemplatePath').
protected  void loadSettings(ServletContext servletContext, freemarker.template.Configuration configuration)
          Load the settings from the /freemarker.properties file on the classpath
 void populateContext(ScopesHashModel model, com.opensymphony.xwork.util.OgnlValueStack stack, com.opensymphony.xwork.Action action, HttpServletRequest request, HttpServletResponse response)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_SERVLET_CONTEXT_KEY

public static final String CONFIG_SERVLET_CONTEXT_KEY
See Also:
Constant Field Values

KEY_REQUEST

public static final String KEY_REQUEST
See Also:
Constant Field Values

KEY_RESPONSE

public static final String KEY_RESPONSE
See Also:
Constant Field Values

KEY_STACK

public static final String KEY_STACK
See Also:
Constant Field Values

KEY_OGNL

public static final String KEY_OGNL
See Also:
Constant Field Values

KEY_UTIL

public static final String KEY_UTIL
See Also:
Constant Field Values

KEY_WEBWORK

public static final String KEY_WEBWORK
See Also:
Constant Field Values

KEY_EXCEPTION

public static final String KEY_EXCEPTION
See Also:
Constant Field Values

KEY_ACTION

public static final String KEY_ACTION
See Also:
Constant Field Values

KEY_APPLICATION

public static final String KEY_APPLICATION
See Also:
Constant Field Values

KEY_REQUEST_MODEL

public static final String KEY_REQUEST_MODEL
See Also:
Constant Field Values

KEY_SESSION_MODEL

public static final String KEY_SESSION_MODEL
See Also:
Constant Field Values

KEY_JSP_TAGLIBS

public static final String KEY_JSP_TAGLIBS
See Also:
Constant Field Values
Constructor Detail

FreemarkerManager

public FreemarkerManager()
Method Detail

getInstance

public static final FreemarkerManager getInstance()
To allow for custom configuration of freemarker, sublcass this class "ConfigManager" and set the webwork configuration property webwork.freemarker.configmanager.classname to the fully qualified classname.

This allows you to override the protected methods in the ConfigMangaer to programatically create your own Configuration instance


getConfigruation

public final freemarker.template.Configuration getConfigruation(ServletContext servletContext)
                                                         throws freemarker.template.TemplateException
Throws:
freemarker.template.TemplateException

buildScopesHashModel

public ScopesHashModel buildScopesHashModel(ServletContext servletContext,
                                            HttpServletRequest request,
                                            HttpServletResponse response,
                                            freemarker.template.ObjectWrapper wrapper)

populateContext

public void populateContext(ScopesHashModel model,
                            com.opensymphony.xwork.util.OgnlValueStack stack,
                            com.opensymphony.xwork.Action action,
                            HttpServletRequest request,
                            HttpServletResponse response)

getObjectWrapper

protected freemarker.ext.beans.BeansWrapper getObjectWrapper()
Returns:

getTemplateLoader

protected freemarker.cache.TemplateLoader getTemplateLoader(ServletContext servletContext)
The default template loader is a MultiTemplateLoader which includes a ClassTemplateLoader and a WebappTemplateLoader (and a FileTemplateLoader depending on the init-parameter 'TemplatePath').

The ClassTemplateLoader will resolve fully qualified template includes that begin with a slash. for example /com/company/template/common.ftl

The WebappTemplateLoader attempts to resolve templates relative to the web root folder


createConfiguration

protected freemarker.template.Configuration createConfiguration(ServletContext servletContext)
                                                         throws freemarker.template.TemplateException
Create the instance of the freemarker Configuration object.

this implementation

Parameters:
servletContext -
Returns:
Throws:
freemarker.template.TemplateException

loadSettings

protected void loadSettings(ServletContext servletContext,
                            freemarker.template.Configuration configuration)
Load the settings from the /freemarker.properties file on the classpath

See Also:
for the definition of valid settings

WebWork Project Page