public class FreeMarkerTemplateProcessor extends Object implements TemplateProcessor
Modifier and Type | Field and Description |
---|---|
protected freemarker.template.Configuration |
configuration |
protected static org.slf4j.Logger |
LOG |
protected TemplateVariationDefinitionBasedTemplateLoader |
templateLoader |
protected boolean |
templateProcessingStrictMode |
Constructor and Description |
---|
FreeMarkerTemplateProcessor(freemarker.template.Configuration configuration,
TemplateEngineConfigurationApi templateEngineConfiguration,
org.springframework.core.io.ResourceLoader resourceLoader,
boolean templateProcessingStrictMode) |
FreeMarkerTemplateProcessor(TemplateEngineConfigurationApi templateEngineConfiguration,
org.springframework.core.io.ResourceLoader resourceLoader,
boolean templateProcessingStrictMode) |
Modifier and Type | Method and Description |
---|---|
boolean |
canRender(TemplateModel templateModel,
TemplateVariationModel templateVariation)
Before a template is rendered, the service will call this method to check, whether this processor is able to handle the given template.
|
freemarker.template.Configuration |
getConfiguration() |
boolean |
isTemplateProcessingStrictMode() |
TemplateProcessingResult |
processTemplate(TemplateHolder template,
Map<String,Object> payload)
Processes a template given by its definition which might have been loaded through the
TemplateRepositoryService . |
void |
setTemplateProcessingStrictMode(boolean templateProcessingStrictMode) |
protected static final org.slf4j.Logger LOG
protected final freemarker.template.Configuration configuration
protected final TemplateVariationDefinitionBasedTemplateLoader templateLoader
protected boolean templateProcessingStrictMode
public FreeMarkerTemplateProcessor(freemarker.template.Configuration configuration, TemplateEngineConfigurationApi templateEngineConfiguration, org.springframework.core.io.ResourceLoader resourceLoader, boolean templateProcessingStrictMode)
public FreeMarkerTemplateProcessor(TemplateEngineConfigurationApi templateEngineConfiguration, org.springframework.core.io.ResourceLoader resourceLoader, boolean templateProcessingStrictMode)
public boolean canRender(TemplateModel templateModel, TemplateVariationModel templateVariation)
TemplateProcessor
canRender
in interface TemplateProcessor
templateModel
- the template definition containing meta information like type and sub type of the templatetemplateVariation
- the template to check, if it can be rendered by this processortrue
if it can be rendered by this processor, false
otherwisepublic TemplateProcessingResult processTemplate(TemplateHolder template, Map<String,Object> payload)
TemplateProcessor
TemplateRepositoryService
.
The payload is used for the placeholders within the template content and must be valid according the TemplateVariationModel.getParameters()
definition.processTemplate
in interface TemplateProcessor
template
- the template holder with template and template variation informationpayload
- the optional payload, if the template is using placeholders to render properly (must be valid according the parameter definition)public boolean isTemplateProcessingStrictMode()
public void setTemplateProcessingStrictMode(boolean templateProcessingStrictMode)
public freemarker.template.Configuration getConfiguration()
Copyright © 2019. All rights reserved.