Package com.atlassian.bamboo.ww2
Class BambooFreemarkerManager
java.lang.Object
org.apache.struts2.views.freemarker.FreemarkerManager
com.atlassian.bamboo.ww2.BambooFreemarkerManager
- All Implemented Interfaces:
TemplateRenderer
,org.springframework.beans.factory.Aware
,org.springframework.web.context.ServletContextAware
@Internal
public class BambooFreemarkerManager
extends org.apache.struts2.views.freemarker.FreemarkerManager
implements TemplateRenderer, org.springframework.web.context.ServletContextAware
FreemarkerManager
that automatically detects the alternative syntax-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from class org.apache.struts2.views.freemarker.FreemarkerManager
altMapWrapper, ATTR_TEMPLATE_MODEL, cacheBeanWrapper, config, CONFIG_SERVLET_CONTEXT_KEY, contentType, debug, DEFAULT_CONTENT_TYPE, encoding, EXPIRATION_DATE, INITPARAM_CONTENT_TYPE, INITPARAM_DEBUG, INITPARAM_NOCACHE, INITPARAM_TEMPLATE_PATH, KEY_APPLICATION, KEY_APPLICATION_PRIVATE, KEY_EXCEPTION, KEY_HASHMODEL_PRIVATE, KEY_INCLUDE, KEY_JSP_TAGLIBS, KEY_REQUEST, KEY_REQUEST_PARAMETERS, KEY_REQUEST_PARAMETERS_STRUTS, KEY_REQUEST_PRIVATE, KEY_SESSION, mruMaxStrongSize, nocache, noCharsetInContentType, tagLibraries, templatePath, templateUpdateDelay, wrapper
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.struts2.views.freemarker.ScopesHashModel
buildTemplateModel
(com.opensymphony.xwork2.util.ValueStack stack, @Nullable Object action, javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, freemarker.template.ObjectWrapper wrapper) void
protected freemarker.template.Configuration
createConfiguration
(javax.servlet.ServletContext servletContext) protected freemarker.cache.TemplateLoader
createTemplateLoader
(javax.servlet.ServletContext servletContext, String ignore) void
init
(javax.servlet.ServletContext servletContext) void
populateContext
(org.apache.struts2.views.freemarker.ScopesHashModel model, com.opensymphony.xwork2.util.ValueStack stack, Object action, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) @Nullable String
void
Render the given template to the given writer@NotNull String
renderPage
(@NotNull String templatePath, Map<String, Object> params) Render the resource found at the path@NotNull String
renderText
(@NotNull String text, Map<String, Object> params) Render Freemarker markup.@NotNull String
renderWithoutActionContext
(@Nullable String templatePath, @NotNull Map<String, Object> contextParams) Renders the resource found at the path.void
setEncoding
(String encoding) void
setHomeLocator
(@Nullable BambooHomeLocator homeLocator) void
setI18nBeanFactory
(@Nullable I18nBeanFactory i18nBeanFactory) void
setOsgiServiceProxyFactory
(OsgiServiceProxyFactory osgiServiceProxyFactory) void
setPluginAccessor
(@Nullable com.atlassian.plugin.PluginAccessor pluginAccessor) void
setServletContext
(javax.servlet.ServletContext servletContext) Methods inherited from class org.apache.struts2.views.freemarker.FreemarkerManager
addSetting, buildScopesHashModel, configureTemplateLoader, createObjectWrapper, getConfig, getConfiguration, getContentType, getDebug, getFreemarkerVersion, getNocache, getNoCharsetInContentType, getTemplatePath, getWrapper, loadSettings, setCacheBeanWrapper, setContainer, setFileManagerFactory, setMruMaxStrongSize, setTemplateUpdateDelay, setThemeTemplateLoader, setWrapperAltMap
-
Field Details
-
PARAM_BASE_URL
- See Also:
-
PARAM_CONTEXT
- See Also:
-
PARAM_I18N_BEAN
- See Also:
-
PARAM_JIRA_ISSUE_UTILS
- See Also:
-
PARAM_WEB_RESOURCE_MANAGER
- See Also:
-
PARAM_STATIC_RESOURCE_PREFIX
- See Also:
-
PARAM_BAMBOO_PERMISSION_MANAGER
- See Also:
-
PARAM_BUILD_UTILS
- See Also:
-
-
Constructor Details
-
BambooFreemarkerManager
public BambooFreemarkerManager()
-
-
Method Details
-
init
public void init(javax.servlet.ServletContext servletContext) throws freemarker.template.TemplateException - Overrides:
init
in classorg.apache.struts2.views.freemarker.FreemarkerManager
- Throws:
freemarker.template.TemplateException
-
setEncoding
- Overrides:
setEncoding
in classorg.apache.struts2.views.freemarker.FreemarkerManager
-
createConfiguration
protected freemarker.template.Configuration createConfiguration(javax.servlet.ServletContext servletContext) throws freemarker.template.TemplateException - Overrides:
createConfiguration
in classorg.apache.struts2.views.freemarker.FreemarkerManager
- Throws:
freemarker.template.TemplateException
-
createTemplateLoader
protected freemarker.cache.TemplateLoader createTemplateLoader(javax.servlet.ServletContext servletContext, String ignore) - Overrides:
createTemplateLoader
in classorg.apache.struts2.views.freemarker.FreemarkerManager
-
populateContext
public void populateContext(org.apache.struts2.views.freemarker.ScopesHashModel model, com.opensymphony.xwork2.util.ValueStack stack, Object action, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) - Overrides:
populateContext
in classorg.apache.struts2.views.freemarker.FreemarkerManager
-
render
@Nullable public @Nullable String render(@Nullable @Nullable String templatePath, @Nullable @Nullable Map<String, Object> contextParams) - Specified by:
render
in interfaceTemplateRenderer
-
renderPage
@NotNull public @NotNull String renderPage(@NotNull @NotNull String templatePath, Map<String, Object> params) Render the resource found at the path- Parameters:
templatePath
- must not be nullparams
- params to pass to the Freemarker context. May be null- Returns:
- the rendered result of the page
-
renderWithoutActionContext
@NotNull public @NotNull String renderWithoutActionContext(@Nullable @Nullable String templatePath, @NotNull @NotNull Map<String, Object> contextParams) Renders the resource found at the path. Does not access variables found in webwork action context.- Specified by:
renderWithoutActionContext
in interfaceTemplateRenderer
- Parameters:
templatePath
- must not be nullcontextParams
- params to pass to the Freemarker context. May be null- Returns:
- the rendered result of the page
-
render
public void render(String templatePath, @Nullable @Nullable Map<String, Object> contextParams, @NotNull @NotNull Writer writer) throws IOExceptionRender the given template to the given writer- Specified by:
render
in interfaceTemplateRenderer
- Parameters:
templatePath
- The path of the templatecontextParams
- The template context paramswriter
- The writer to write to- Throws:
IOException
- If an error occurred while writing to the writer
-
renderText
@NotNull public @NotNull String renderText(@NotNull @NotNull String text, Map<String, 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 interfaceTemplateRenderer
- Parameters:
text
- String containing Freemarker markupparams
-- Returns:
- Rendered Freemarker template
-
clearCaches
public void clearCaches() -
setHomeLocator
-
setPluginAccessor
public void setPluginAccessor(@Nullable @Nullable com.atlassian.plugin.PluginAccessor pluginAccessor) -
setI18nBeanFactory
-
setServletContext
public void setServletContext(javax.servlet.ServletContext servletContext) - Specified by:
setServletContext
in interfaceorg.springframework.web.context.ServletContextAware
-
setOsgiServiceProxyFactory
-
buildTemplateModel
public org.apache.struts2.views.freemarker.ScopesHashModel buildTemplateModel(com.opensymphony.xwork2.util.ValueStack stack, @Nullable @Nullable Object action, javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, freemarker.template.ObjectWrapper wrapper) - Overrides:
buildTemplateModel
in classorg.apache.struts2.views.freemarker.FreemarkerManager
-