Class TemplateInterceptor
java.lang.Object
com.predic8.membrane.core.interceptor.AbstractInterceptor
com.predic8.membrane.core.interceptor.templating.StaticInterceptor
com.predic8.membrane.core.interceptor.templating.TemplateInterceptor
- All Implemented Interfaces:
Interceptor
- Description
- Renders the body content of a message from a template. The template can produce plain text, Json or XML. Variables in the template are substituted with values from the body, header, query parameters, etc. If the extension of a referenced template file is .xml it will use XMLTemplateEngine otherwise StreamingTemplateEngine. Have a look at the samples in examples/template.
- Topic
- 4. Interceptors/Features
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.predic8.membrane.core.interceptor.Interceptor
Interceptor.Flow -
Field Summary
FieldsFields inherited from class com.predic8.membrane.core.interceptor.templating.StaticInterceptor
contentType, jsonBeautifier, location, log, pretty, textTemplateFields inherited from class com.predic8.membrane.core.interceptor.AbstractInterceptor
name, router -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongroovy.text.Templateprotected OutcomehandleInternal(Message msg, Exchange exc, Interceptor.Flow flow) voidinit()Called after parsing is complete and this has been added to the object tree (whose root is Router).voidsetTemplate(groovy.text.Template template) Methods inherited from class com.predic8.membrane.core.interceptor.templating.StaticInterceptor
getContentType, getLocation, getName, getPretty, getShortDescription, getTextTemplate, handleRequest, handleResponse, setContentType, setLocation, setPretty, setTextTemplateMethods inherited from class com.predic8.membrane.core.interceptor.AbstractInterceptor
getDisplayName, getFlow, getHelpId, getLongDescription, getMessage, getRouter, getRule, handleAbort, init, setDisplayName, setFlow
-
Field Details
-
template
protected groovy.text.Template template
-
-
Constructor Details
-
TemplateInterceptor
public TemplateInterceptor()
-
-
Method Details
-
handleInternal
- Overrides:
handleInternalin classStaticInterceptor
-
init
Description copied from class:AbstractInterceptorCalled after parsing is complete and this has been added to the object tree (whose root is Router).- Overrides:
initin classStaticInterceptor- Throws:
Exception
-
getTemplate
public groovy.text.Template getTemplate() -
setTemplate
public void setTemplate(groovy.text.Template template)
-