com.atlassian.bamboo.ww2
Class BambooFreemarkerManager

java.lang.Object
  extended by com.opensymphony.webwork.views.freemarker.FreemarkerManager
      extended by com.atlassian.bamboo.ww2.BambooFreemarkerManager
All Implemented Interfaces:
TemplateRenderer, org.springframework.web.context.ServletContextAware

public class BambooFreemarkerManager
extends com.opensymphony.webwork.views.freemarker.FreemarkerManager
implements TemplateRenderer, org.springframework.web.context.ServletContextAware

FreemarkerManager that automatically detects the alternative syntax


Field Summary
static java.lang.String PARAM_BASE_URL
           
static java.lang.String PARAM_CONTEXT
           
static java.lang.String PARAM_I18N_BEAN
           
static java.lang.String PARAM_JIRA_ISSUE_UTILS
           
static java.lang.String PARAM_STATIC_RESOURCE_PREFIX
           
static java.lang.String PARAM_WEB_RESOURCE_MANAGER
           
 
Fields inherited from class com.opensymphony.webwork.views.freemarker.FreemarkerManager
CONFIG_SERVLET_CONTEXT_KEY, KEY_APPLICATION, KEY_EXCEPTION, KEY_JSP_TAGLIBS, KEY_REQUEST_MODEL, KEY_REQUEST_PARAMETER_MODEL, KEY_SESSION_MODEL
 
Constructor Summary
BambooFreemarkerManager()
           
 
Method Summary
 void clearCaches()
           
protected  freemarker.template.Configuration createConfiguration(javax.servlet.ServletContext servletContext)
           
protected  freemarker.cache.TemplateLoader getTemplateLoader(javax.servlet.ServletContext context)
           
 void populateContext(com.opensymphony.webwork.views.freemarker.ScopesHashModel model, com.opensymphony.xwork.util.OgnlValueStack stack, java.lang.Object action, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 java.lang.String render(java.lang.String templatePath, java.util.Map<java.lang.String,java.lang.Object> contextParams)
           
 void render(java.lang.String templatePath, java.util.Map<java.lang.String,java.lang.Object> contextParams, java.io.Writer writer)
          Render the given template to the given writer
 java.lang.String renderPage(java.lang.String templatePath, java.util.Map<java.lang.String,java.lang.Object> params)
          Render the resource found at the path
 java.lang.String renderText(java.lang.String text, java.util.Map<java.lang.String,java.lang.Object> params)
          Render Freemarker markup.
 java.lang.String renderWithoutActionContext(java.lang.String templatePath, java.util.Map<java.lang.String,java.lang.Object> contextParams)
          Renders the resource found at the path.
 void setHomeLocator(com.atlassian.config.HomeLocator homeLocator)
           
 void setI18nBeanFactory(I18nBeanFactory i18nBeanFactory)
           
 void setPluginAccessor(com.atlassian.plugin.PluginAccessor pluginAccessor)
           
 void setServletContext(javax.servlet.ServletContext servletContext)
           
 
Methods inherited from class com.opensymphony.webwork.views.freemarker.FreemarkerManager
buildScopesHashModel, buildTemplateModel, getConfiguration, getInstance, getObjectWrapper, loadSettings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAM_BASE_URL

public static final java.lang.String PARAM_BASE_URL
See Also:
Constant Field Values

PARAM_CONTEXT

public static final java.lang.String PARAM_CONTEXT
See Also:
Constant Field Values

PARAM_I18N_BEAN

public static final java.lang.String PARAM_I18N_BEAN
See Also:
Constant Field Values

PARAM_JIRA_ISSUE_UTILS

public static final java.lang.String PARAM_JIRA_ISSUE_UTILS
See Also:
Constant Field Values

PARAM_WEB_RESOURCE_MANAGER

public static final java.lang.String PARAM_WEB_RESOURCE_MANAGER
See Also:
Constant Field Values

PARAM_STATIC_RESOURCE_PREFIX

public static final java.lang.String PARAM_STATIC_RESOURCE_PREFIX
See Also:
Constant Field Values
Constructor Detail

BambooFreemarkerManager

public BambooFreemarkerManager()
Method Detail

createConfiguration

protected freemarker.template.Configuration createConfiguration(javax.servlet.ServletContext servletContext)
                                                         throws freemarker.template.TemplateException
Overrides:
createConfiguration in class com.opensymphony.webwork.views.freemarker.FreemarkerManager
Throws:
freemarker.template.TemplateException

getTemplateLoader

protected freemarker.cache.TemplateLoader getTemplateLoader(javax.servlet.ServletContext context)
Overrides:
getTemplateLoader in class com.opensymphony.webwork.views.freemarker.FreemarkerManager

populateContext

public void populateContext(com.opensymphony.webwork.views.freemarker.ScopesHashModel model,
                            com.opensymphony.xwork.util.OgnlValueStack stack,
                            java.lang.Object action,
                            javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
Overrides:
populateContext in class com.opensymphony.webwork.views.freemarker.FreemarkerManager

render

@Nullable
public java.lang.String render(@Nullable
                                        java.lang.String templatePath,
                                        @Nullable
                                        java.util.Map<java.lang.String,java.lang.Object> contextParams)
Specified by:
render in interface TemplateRenderer

renderPage

@NotNull
public java.lang.String renderPage(@NotNull
                                           java.lang.String templatePath,
                                           java.util.Map<java.lang.String,java.lang.Object> params)
Render the resource found at the path

Parameters:
templatePath - must not be null
params - params to pass to the Freemarker context. May be null
Returns:
the rendered result of the page

renderWithoutActionContext

@NotNull
public java.lang.String renderWithoutActionContext(@Nullable
                                                           java.lang.String templatePath,
                                                           @NotNull
                                                           java.util.Map<java.lang.String,java.lang.Object> contextParams)
Renders the resource found at the path. Does not access variables found in webwork action context.

Specified by:
renderWithoutActionContext in interface TemplateRenderer
Parameters:
templatePath - must not be null
contextParams - params to pass to the Freemarker context. May be null
Returns:
the rendered result of the page

render

public void render(java.lang.String templatePath,
                   @Nullable
                   java.util.Map<java.lang.String,java.lang.Object> contextParams,
                   @NotNull
                   java.io.Writer writer)
            throws java.io.IOException
Render the given template to the given writer

Specified by:
render in interface TemplateRenderer
Parameters:
templatePath - The path of the template
contextParams - The template context params
writer - The writer to write to
Throws:
java.io.IOException - If an error occured while writing to the writer

renderText

@NotNull
public java.lang.String renderText(@NotNull
                                           java.lang.String text,
                                           java.util.Map<java.lang.String,java.lang.Object> params)
Render Freemarker markup. In order to correctly handle @ww.action tags which would write to the writer obtained from HttpServletResponse it is required to setup a wrapper to the response object and provide own writer there.

Specified by:
renderText in interface TemplateRenderer
Parameters:
text - String containing Freemarker markup
params -
Returns:
Rendered Freemarker template

clearCaches

public void clearCaches()

setHomeLocator

public void setHomeLocator(@Nullable
                           com.atlassian.config.HomeLocator homeLocator)

setPluginAccessor

public void setPluginAccessor(@Nullable
                              com.atlassian.plugin.PluginAccessor pluginAccessor)

setI18nBeanFactory

public void setI18nBeanFactory(@Nullable
                               I18nBeanFactory i18nBeanFactory)

setServletContext

public void setServletContext(javax.servlet.ServletContext servletContext)
Specified by:
setServletContext in interface org.springframework.web.context.ServletContextAware


Copyright © 2012 Atlassian. All Rights Reserved.