@Resource(type="st") public class StringTemplateContentHandlerFactory extends Object implements ContentHandlerFactory
DOMElementVisitor
Creator class.
Creates DOMElementVisitor
instances for applying
StringTemplate transformations (i.e. ".st" files).
This templating solution relies on the Smooks JavaBean Cartridge
to perform the JavaBean population that's required by StringTemplate.
<resource-config selector="target-element"> <!-- SeeURIResourceLocator
--> <resource>/com/acme/AcmeStringTemplate.st</resource> <!-- (Optional) The action to be applied on the template content. Should the content generated by the template: 1. replace ("replace") the target element, or 2. be added to ("addto") the target element, or 3. be inserted before ("insertbefore") the target element, or 4. be inserted after ("insertafter") the target element. 5. be bound to ("bindto") aBeanContext
variable named by the "bindId" param. Default "replace".--> <param name="action">replace/addto/insertbefore/insertafter</param> <!-- (Optional) Should the template be applied before (true) or after (false) Smooks visits the child elements of the target element. Default "false".--> <param name="applyTemplateBefore">true/false</param> <!-- (Optional) The name of theOutputStreamResource
to which the result should be written. If set, the "action" param is ignored. --> <param name="outputStreamResource">xyzResource</param> <!-- (Optional) Template encoding. Default "UTF-8".--> <param name="encoding">encoding</param> <!-- (Optional) bindId when "action" is "bindto". <param name="bindId">xxxx</param> </resource-config>
PARAM_RESTYPE
Constructor and Description |
---|
StringTemplateContentHandlerFactory() |
Modifier and Type | Method and Description |
---|---|
ContentHandler |
create(SmooksResourceConfiguration resourceConfig)
Create a StringTemplate based ContentHandler.
|
public ContentHandler create(SmooksResourceConfiguration resourceConfig) throws SmooksConfigurationException, InstantiationException
create
in interface ContentHandlerFactory
resourceConfig
- The SmooksResourceConfiguration for the StringTemplate.ContentHandler
instance.SmooksConfigurationException
- Successfully created ContentHandler, but an error occured during configuration.InstantiationException
- Unable to create ContentHandler instance.Copyright © 2020. All rights reserved.