Class FreemarkerEngine
- java.lang.Object
-
- org.nuxeo.ecm.platform.rendering.fm.FreemarkerEngine
-
- All Implemented Interfaces:
RenderingEngine
- Direct Known Subclasses:
FreemarkerRender
public class FreemarkerEngine extends Object implements RenderingEngine
- Author:
- Bogdan Stefanescu
-
-
Field Summary
Fields Modifier and Type Field Description protected freemarker.template.Configuration
cfg
protected ResourceTemplateLoader
loader
protected LocaleMessagesMethod
localeMessages
protected MessagesMethod
messages
static String
RENDERING_ENGINE_KEY
protected DocumentObjectWrapper
wrapper
-
Constructor Summary
Constructors Constructor Description FreemarkerEngine()
FreemarkerEngine(freemarker.template.Configuration cfg, ResourceLocator locator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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)
-
-
-
Field Detail
-
RENDERING_ENGINE_KEY
public static final String RENDERING_ENGINE_KEY
- See Also:
- Constant Field Values
-
cfg
protected final freemarker.template.Configuration cfg
-
wrapper
protected final DocumentObjectWrapper wrapper
-
messages
protected final MessagesMethod messages
-
localeMessages
protected final LocaleMessagesMethod localeMessages
-
loader
protected ResourceTemplateLoader loader
-
-
Constructor Detail
-
FreemarkerEngine
public FreemarkerEngine()
-
FreemarkerEngine
public FreemarkerEngine(freemarker.template.Configuration cfg, ResourceLocator locator)
-
-
Method Detail
-
setMessageBundle
public void setMessageBundle(ResourceBundle messages)
set the resource bundle to be used with method message and lmessage. If the resourcebundle is not of the type ResourceComposite, lmessage will create a default ResourceComposite.- Specified by:
setMessageBundle
in interfaceRenderingEngine
-
getMessageBundle
public ResourceBundle getMessageBundle()
- Specified by:
getMessageBundle
in interfaceRenderingEngine
-
setResourceLocator
public void setResourceLocator(ResourceLocator locator)
- Specified by:
setResourceLocator
in interfaceRenderingEngine
-
getResourceLocator
public ResourceLocator getResourceLocator()
- Specified by:
getResourceLocator
in interfaceRenderingEngine
-
getLoader
public ResourceTemplateLoader getLoader()
-
setSharedVariable
public void setSharedVariable(String key, Object value)
- Specified by:
setSharedVariable
in interfaceRenderingEngine
-
getObjectWrapper
public DocumentObjectWrapper getObjectWrapper()
-
getConfiguration
public freemarker.template.Configuration getConfiguration()
-
getView
public View getView(String path)
- Specified by:
getView
in interfaceRenderingEngine
-
getView
public View getView(String path, Object object)
- Specified by:
getView
in interfaceRenderingEngine
-
render
public void render(String template, Object input, Writer writer) throws RenderingException
Description copied from interface:RenderingEngine
Starts the rendering for the given document context.- Specified by:
render
in interfaceRenderingEngine
- Throws:
RenderingException
-
flushCache
public void flushCache()
- Specified by:
flushCache
in interfaceRenderingEngine
-
-