public class FreeMarkerTemplateProcessor extends AbstractTemplateProcessor implements SAXElementVisitor, Consumer
FreeMarkerContentHandlerFactory
.
NOTE that this visitor supports the extra "useNodeModel" parameter when
using DOM based filtering. When set to true (default=false), the targeted
DOM element will be attached to the model that is passed to the FreeMarker
templating engine. This allows the DOM model to be referenced from within
the FreeMarker template, with the targeted element name being the "root"
name when forming expressions. See freemarker.org
for more info.AbstractTemplateProcessor.Action, AbstractTemplateProcessor.ActionDecoder
TEMPLATE_SPLIT_PI
Modifier | Constructor and Description |
---|---|
protected |
FreeMarkerTemplateProcessor()
Default constructor.
|
|
FreeMarkerTemplateProcessor(TemplatingConfiguration templatingConfiguration)
Programmatically configure the FreeMarker Templating Visitor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
consumes(Object object)
Does this consumer consume the specified named object.
|
protected void |
loadTemplate(SmooksResourceConfiguration config) |
void |
onChildElement(SAXElement element,
SAXElement childElement,
ExecutionContext executionContext)
Process the onChildElement event for the targeted element.
|
void |
onChildText(SAXElement element,
SAXText childText,
ExecutionContext executionContext)
Process the onChildText event for the targeted element.
|
protected void |
visit(Element element,
ExecutionContext executionContext)
Apply the template for DOM.
|
void |
visitAfter(Element element,
ExecutionContext executionContext)
Visit the supplied element after visiting its child elements.
|
void |
visitAfter(SAXElement element,
ExecutionContext executionContext)
Visit the supplied element after visiting its child elements.
|
void |
visitBefore(Element element,
ExecutionContext executionContext)
Visit the supplied element before visiting its child elements.
|
void |
visitBefore(SAXElement element,
ExecutionContext executionContext)
Visit the supplied element before visiting its child elements.
|
applyTemplateBefore, getAction, getBindBeanId, getBindId, getEncoding, getOutputStreamResource, getProducts, initialize, processTemplateAction, processTemplateAction, setTemplatingConfiguration
protected FreeMarkerTemplateProcessor()
public FreeMarkerTemplateProcessor(TemplatingConfiguration templatingConfiguration)
templatingConfiguration
- The templating configuration.protected void loadTemplate(SmooksResourceConfiguration config) throws IOException
loadTemplate
in class AbstractTemplateProcessor
IOException
public boolean consumes(Object object)
Consumer
Producer
that is executing
on the same element. The consumer should only return false
if it knows for
certain that it doesn't consumer the specified named object. If uncertain, it should
error on the side of saying that it does consume the object.public void visitBefore(Element element, ExecutionContext executionContext) throws SmooksException
DOMVisitBefore
visitBefore
in interface DOMVisitBefore
visitBefore
in class AbstractTemplateProcessor
element
- The DOM element being visited.executionContext
- Request relative instance.SmooksException
- Element processing failure.public void visitAfter(Element element, ExecutionContext executionContext) throws SmooksException
DOMVisitAfter
visitAfter
in interface DOMVisitAfter
visitAfter
in class AbstractTemplateProcessor
element
- The DOM element being visited.executionContext
- Request relative instance.SmooksException
- Element processing failure.protected void visit(Element element, ExecutionContext executionContext) throws SmooksException
visit
in class AbstractTemplateProcessor
element
- The targeted DOM Element.executionContext
- The Smooks execution context.SmooksException
- Failed to apply template. See cause.public void visitBefore(SAXElement element, ExecutionContext executionContext) throws SmooksException, IOException
SAXVisitBefore
visitBefore
in interface SAXVisitBefore
element
- The SAX element being visited.executionContext
- Execution context.SmooksException
- Event processing failure.IOException
- Error writing event to output writer.public void onChildText(SAXElement element, SAXText childText, ExecutionContext executionContext) throws SmooksException, IOException
SAXVisitChildren
onChildText
in interface SAXVisitChildren
element
- The element containing the text (parent). The targeted element.childText
- The text.executionContext
- Execution context.SmooksException
- Event processing failure.IOException
- Error writing event to output writer.public void onChildElement(SAXElement element, SAXElement childElement, ExecutionContext executionContext) throws SmooksException, IOException
SAXVisitChildren
onChildElement
in interface SAXVisitChildren
element
- The element containing the child element (parent). The targeted element.childElement
- The child element just added to the targeted element.executionContext
- Execution context.SmooksException
- Event processing failure.IOException
- Error writing event to output writer.public void visitAfter(SAXElement element, ExecutionContext executionContext) throws SmooksException, IOException
SAXVisitAfter
visitAfter
in interface SAXVisitAfter
element
- The SAX element being visited.executionContext
- Execution context.SmooksException
- Event processing failure.IOException
- Error writing event to output writer.Copyright © 2020. All rights reserved.