@Singleton public class FreemarkerHelper extends Object
Constructor and Description |
---|
FreemarkerHelper(FreemarkerConfig freemarkerConfig)
Deprecated.
since 5.4.4. Use
FreemarkerHelper(FreemarkerConfig, TranslationService, MagnoliaConfigurationProperties) instead. |
FreemarkerHelper(FreemarkerConfig freemarkerConfig,
TranslationService transactionService)
Deprecated.
since 5.4.8. Please use
FreemarkerHelper(FreemarkerConfig, TranslationService, MagnoliaConfigurationProperties) instead. |
FreemarkerHelper(FreemarkerConfig freemarkerConfig,
TranslationService translationService,
MagnoliaConfigurationProperties properties) |
Modifier and Type | Method and Description |
---|---|
protected void |
addDefaultData(Map<String,Object> data,
Locale locale,
String i18nBasename) |
protected void |
addTaglibSupportData(Map<String,Object> data,
WebContext webCtx) |
protected Locale |
checkLocale(Locale locale)
Returns the passed Locale if non-null, otherwise attempts to get the Locale from the current context.
|
protected freemarker.ext.servlet.ServletContextHashModel |
checkServletContextModel(javax.servlet.ServletContext servletContext) |
protected freemarker.ext.jsp.TaglibFactory |
checkTaglibFactory(javax.servlet.ServletContext servletContext) |
protected freemarker.template.Configuration |
getConfiguration() |
static FreemarkerHelper |
getInstance()
Deprecated.
since 4.5, use IoC !
|
boolean |
isEscapeHtml() |
protected void |
prepareRendering(Locale checkedLocale,
String i18nBasename,
Object root)
Call checkLocale() before calling this method, to ensure it is not null.
|
protected void |
render(Reader template,
Locale locale,
String i18nBasename,
Object root,
Writer out) |
void |
render(Reader template,
Object root,
Writer out)
Renders the template read by the given Reader instance.
|
void |
render(String templatePath,
Locale locale,
String i18nBasename,
Object root,
Writer out)
Renders the given template, using the given root object (can be a map, or any other type of object
handled by MagnoliaContentWrapper) to the given Writer.
|
void |
render(String templatePath,
Object root,
Writer out) |
void |
setEscapeHtml(boolean escapeHtml) |
@Inject public FreemarkerHelper(FreemarkerConfig freemarkerConfig, TranslationService translationService, MagnoliaConfigurationProperties properties)
@Deprecated public FreemarkerHelper(FreemarkerConfig freemarkerConfig, TranslationService transactionService)
FreemarkerHelper(FreemarkerConfig, TranslationService, MagnoliaConfigurationProperties)
instead.@Deprecated public FreemarkerHelper(FreemarkerConfig freemarkerConfig)
FreemarkerHelper(FreemarkerConfig, TranslationService, MagnoliaConfigurationProperties)
instead.@Deprecated public static FreemarkerHelper getInstance()
public void render(String templatePath, Object root, Writer out) throws freemarker.template.TemplateException, IOException
freemarker.template.TemplateException
IOException
render(String, Locale, String, Object, java.io.Writer)
public void render(String templatePath, Locale locale, String i18nBasename, Object root, Writer out) throws freemarker.template.TemplateException, IOException
freemarker.template.TemplateException
IOException
ServerConfiguration.getDefaultBaseUrl()
public void render(Reader template, Object root, Writer out) throws freemarker.template.TemplateException, IOException
freemarker.template.TemplateException
IOException
render(Reader, Locale, String, Object, Writer)
protected void render(Reader template, Locale locale, String i18nBasename, Object root, Writer out) throws freemarker.template.TemplateException, IOException
freemarker.template.TemplateException
IOException
protected Locale checkLocale(Locale locale)
protected void prepareRendering(Locale checkedLocale, String i18nBasename, Object root)
protected void addDefaultData(Map<String,Object> data, Locale locale, String i18nBasename)
protected void addTaglibSupportData(Map<String,Object> data, WebContext webCtx)
protected freemarker.ext.jsp.TaglibFactory checkTaglibFactory(javax.servlet.ServletContext servletContext)
protected freemarker.ext.servlet.ServletContextHashModel checkServletContextModel(javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException
javax.servlet.ServletException
protected freemarker.template.Configuration getConfiguration()
public void setEscapeHtml(boolean escapeHtml)
public boolean isEscapeHtml()
Copyright © 2003–2018 Magnolia International Ltd.. All rights reserved.