Obsolete Pages{{Obsolete}}
The official documentation is at: http://docs.alfresco.com
The FreeMarker Rendering Engine is designed to create new renditions by applying a FreeMarker template to a
piece of content in a content node. It was introduced in version 3.3 as one of the first rendering engines
available to the core rendition service. This rendering engine has a name of 'freemarkerRenderingEngine' and
is represented by the class org.alfresco.repo.rendition.executer.FreemarkerRenderingEngine
Like all rendering engines, the FreeMarker Rendering Engine generates one rendition node from a given source node. It applies a FreeMarker template transformation to the content of the source node and parameters can be supplied to configure the transformation. The first parameters to describe are those that can be used to specify the FreeMarker template itself. All of these three parameters are optional, but one of them must be set for the engine to work:
These constants are all defined in the BaseTemplateRenderingEngine
class from which both the
XSLT Rendering Engine and the FreeMarker Rendering Engine are derived. As mentioned earlier, one of these parameters must be specified in all rendering definitions that make use of the FreeMarker Rendering Engine.
The order in which they are evaluated is the order in which they appear in the list above.
Another parameter that is specific to templating rendering engines (such as the FreeMarker Rendering Engine) is PARAM_MODEL. This parameter is a Map object (implementing java.util.Map
) that contains entries whose keys are String
objects and whose values are Serializable
objects. These entries are passed on to the template service as part of the model that is combined with the source node and template to produce the rendition.
Finally, the FreeMarker Rendering Engine takes one other optional parameter, PARAM_IMAGE_RESOLVER. This parameter specifies a org.alfresco.service.cmr.repository.TemplateImageResolver
which is used to resolve any image paths specified in the template.
The model passed by the FreeMarker Rendering Engine to the template service contains the following entries (as well as any that are provided by PARAM_MODEL😞
java.util.Date
objectorg.alfresco.service.cmr.repository.NodeRef
.org.alfresco.service.cmr.repository.NodeRef
.org.alfresco.service.cmr.repository.NodeRef
.org.alfresco.service.cmr.repository.NodeRef
.org.alfresco.repo.template.TemplateNode
.Model entries that are provided by the rendition definition via the PARAM_MODEL parameter are provided to the template with no namespace qualification.
The FreeMarker Rendering Engine processes FreeMarker templates using the org.alfresco.repo.template.FreemarkerProcessor
.
For more information on how to create and use custom FreeMarker templates see the FreeMarker Manual