Interface BeCPGTemplateRenderService
- All Known Implementing Classes:
FreemarkerTemplateRenderServiceImpl
Renders FreeMarker templates that are looked up in the repository first, then on the classpath, so that a customer can override a shipped template without redeploying the module.
Template names are flat, extension included (for instance nutritionFacts-vertical.ftl).
The locale is honoured through the standard FreeMarker localized lookup, which tries
name_fr_FR.ftl, then name_fr.ftl, then name.ftl. The same rule applies to
the templates pulled in by <#import>, so a shared macro library must stay
locale-neutral.
- Version:
- $Id: $Id
- Author:
- matthieu
-
Method Summary
Modifier and TypeMethodDescriptionvoidDrops the template cache, so that a template just updated in the repository is picked up without waiting for the update delay.booleanTells whether a template resolves, in the repository or on the classpath.Renders a template and returns its output.voidRenders a template directly into the given writer, for large outputs.
-
Method Details
-
render
Renders a template and returns its output.
- Parameters:
templateName- aStringobjectlocale- aLocaleobject, the current locale is used when nullmodel- aMapobject- Returns:
- a
Stringobject - Throws:
TemplateRenderException- if the template is missing or fails
-
render
Renders a template directly into the given writer, for large outputs.
- Parameters:
templateName- aStringobjectlocale- aLocaleobject, the current locale is used when nullmodel- aMapobjectwriter- aWriterobject- Throws:
TemplateRenderException- if the template is missing or fails
-
exists
Tells whether a template resolves, in the repository or on the classpath.
-
clearCache
void clearCache()Drops the template cache, so that a template just updated in the repository is picked up without waiting for the update delay.
-