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.Configurationcfgprotected ResourceTemplateLoaderloaderprotected LocaleMessagesMethodlocaleMessagesprotected MessagesMethodmessagesstatic StringRENDERING_ENGINE_KEYprotected DocumentObjectWrapperwrapper
-
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 voidflushCache()freemarker.template.ConfigurationgetConfiguration()ResourceTemplateLoadergetLoader()ResourceBundlegetMessageBundle()DocumentObjectWrappergetObjectWrapper()ResourceLocatorgetResourceLocator()ViewgetView(String path)ViewgetView(String path, Object object)voidrender(String template, Object input, Writer writer)Starts the rendering for the given document context.voidsetMessageBundle(ResourceBundle messages)set the resource bundle to be used with method message and lmessage.voidsetResourceLocator(ResourceLocator locator)voidsetSharedVariable(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:
setMessageBundlein interfaceRenderingEngine
-
getMessageBundle
public ResourceBundle getMessageBundle()
- Specified by:
getMessageBundlein interfaceRenderingEngine
-
setResourceLocator
public void setResourceLocator(ResourceLocator locator)
- Specified by:
setResourceLocatorin interfaceRenderingEngine
-
getResourceLocator
public ResourceLocator getResourceLocator()
- Specified by:
getResourceLocatorin interfaceRenderingEngine
-
getLoader
public ResourceTemplateLoader getLoader()
-
setSharedVariable
public void setSharedVariable(String key, Object value)
- Specified by:
setSharedVariablein interfaceRenderingEngine
-
getObjectWrapper
public DocumentObjectWrapper getObjectWrapper()
-
getConfiguration
public freemarker.template.Configuration getConfiguration()
-
getView
public View getView(String path)
- Specified by:
getViewin interfaceRenderingEngine
-
getView
public View getView(String path, Object object)
- Specified by:
getViewin interfaceRenderingEngine
-
render
public void render(String template, Object input, Writer writer) throws RenderingException
Description copied from interface:RenderingEngineStarts the rendering for the given document context.- Specified by:
renderin interfaceRenderingEngine- Throws:
RenderingException
-
flushCache
public void flushCache()
- Specified by:
flushCachein interfaceRenderingEngine
-
-