public class FreemarkerEngine extends Object implements RenderingEngine
Modifier and Type | Field and Description |
---|---|
protected freemarker.template.Configuration |
cfg |
protected ResourceTemplateLoader |
loader |
protected LocaleMessagesMethod |
localeMessages |
protected MessagesMethod |
messages |
static String |
RENDERING_ENGINE_KEY |
protected DocumentObjectWrapper |
wrapper |
Constructor and Description |
---|
FreemarkerEngine() |
FreemarkerEngine(freemarker.template.Configuration cfg,
ResourceLocator locator) |
Modifier and Type | Method and Description |
---|---|
void |
flushCache() |
freemarker.template.Configuration |
getConfiguration() |
ResourceTemplateLoader |
getLoader() |
ResourceBundle |
getMessageBundle() |
DocumentObjectWrapper |
getObjectWrapper() |
ResourceLocator |
getResourceLocator() |
View |
getView(String path) |
View |
getView(String path,
Object object) |
void |
render(String template,
Object input,
Writer writer)
Starts the rendering for the given document context.
|
void |
setMessageBundle(ResourceBundle messages)
set the resource bundle to be used with method message and lmessage.
|
void |
setResourceLocator(ResourceLocator locator) |
void |
setSharedVariable(String key,
Object value) |
public static final String RENDERING_ENGINE_KEY
protected final freemarker.template.Configuration cfg
protected final DocumentObjectWrapper wrapper
protected final MessagesMethod messages
protected final LocaleMessagesMethod localeMessages
protected ResourceTemplateLoader loader
public FreemarkerEngine()
public FreemarkerEngine(freemarker.template.Configuration cfg, ResourceLocator locator)
public void setMessageBundle(ResourceBundle messages)
setMessageBundle
in interface RenderingEngine
public ResourceBundle getMessageBundle()
getMessageBundle
in interface RenderingEngine
public void setResourceLocator(ResourceLocator locator)
setResourceLocator
in interface RenderingEngine
public ResourceLocator getResourceLocator()
getResourceLocator
in interface RenderingEngine
public ResourceTemplateLoader getLoader()
public void setSharedVariable(String key, Object value)
setSharedVariable
in interface RenderingEngine
public DocumentObjectWrapper getObjectWrapper()
public freemarker.template.Configuration getConfiguration()
public View getView(String path)
getView
in interface RenderingEngine
public View getView(String path, Object object)
getView
in interface RenderingEngine
public void render(String template, Object input, Writer writer) throws RenderingException
RenderingEngine
render
in interface RenderingEngine
template
- input
- writer
- baseUrl
- a base URL used for resolving referenced files in extends directive.RenderingException
public void flushCache()
flushCache
in interface RenderingEngine
Copyright © 2016 Nuxeo SA. All rights reserved.