public interface ITemplateEngine
Interface implemented by Thymeleaf Template Engines.
Only one implementation of this interface is provided out-of-the-box: TemplateEngine
.
This interface is meant to be used for mocking or prototyping purposes.
TemplateEngine
Modifier and Type | Method and Description |
---|---|
IEngineConfiguration |
getConfiguration()
Obtain the
IEngineConfiguration the template engine is using (or will be using)
for processing templates. |
String |
process(String template,
IContext context)
Process the specified template (usually the template name).
|
void |
process(String template,
IContext context,
Writer writer)
Process the specified template (usually the template name).
|
String |
process(String template,
Set<String> templateSelectors,
IContext context)
Process the specified template (usually the template name) applying a set of
template selectors.
|
void |
process(String template,
Set<String> templateSelectors,
IContext context,
Writer writer)
Process the specified template (usually the template name) applying a set of
template selectors.
|
String |
process(TemplateSpec templateSpec,
IContext context)
Process a template starting from a
TemplateSpec . |
void |
process(TemplateSpec templateSpec,
IContext context,
Writer writer)
Process a template starting from a
TemplateSpec . |
IThrottledTemplateProcessor |
processThrottled(String template,
IContext context)
Process the specified template (usually the template name).
|
IThrottledTemplateProcessor |
processThrottled(String template,
Set<String> templateSelectors,
IContext context)
Process the specified template (usually the template name) applying a set of
template selectors.
|
IThrottledTemplateProcessor |
processThrottled(TemplateSpec templateSpec,
IContext context)
Process a template starting from a
TemplateSpec . |
IEngineConfiguration getConfiguration()
Obtain the IEngineConfiguration
the template engine is using (or will be using)
for processing templates.
Note that calling this method on a TemplateEngine
implementation will effectively
initialize the engine object, and therefore any modifications to the configuration
will be forbidden from that moment.
String process(String template, IContext context)
Process the specified template (usually the template name). Output will be written
into a String
that will be returned from calling this method, once template processing
has finished.
This is actually a convenience method that will internally create a TemplateSpec
and then
call process(TemplateSpec, IContext)
.
template
- the template; depending on the template resolver this might be a template name or even
the template contents (e.g. StringTemplateResolver).context
- the context.String process(String template, Set<String> templateSelectors, IContext context)
Process the specified template (usually the template name) applying a set of
template selectors. Output will be written into a String
that will be returned from calling this method, once template processing has finished.
Template selectors allow the possibility to process only a part of the specified template, expressing this selection in a syntax similar to jQuery, CSS or XPath selectors. Note this is only available for markup template modes (HTML, XML). For more info on template selectors syntax, have a look at AttoParser's markup selectors documentation.
This is actually a convenience method that will internally create a TemplateSpec
and then
call process(TemplateSpec, IContext)
.
template
- the template; depending on the template resolver this might be a template name or even
the template contents (e.g. StringTemplateResolver).templateSelectors
- the selectors to be used, defining the fragments that should be processedcontext
- the context.String process(TemplateSpec templateSpec, IContext context)
Process a template starting from a TemplateSpec
. Output will be written into a String
that will be returned from calling this method, once template processing has finished.
The template specification will be used as input for the template resolvers, queried in chain until one of them resolves the template, which will then be executed.
The context will contain the variables that will be available for the execution of expressions inside the template.
templateSpec
- the template spec containing the template to be resolved (usually its name only),
template selectors if they are to be applied, a template mode if it should be forced
(instead of computing it at resolution time), and other attributes.context
- the context.void process(String template, IContext context, Writer writer)
Process the specified template (usually the template name). Output will be written
to the specified writer as it is generated from processing the template. This is specially
useful for web environments (using ServletResponse.getWriter()
).
This is actually a convenience method that will internally create a TemplateSpec
and then
call process(TemplateSpec, IContext, Writer)
.
template
- the template; depending on the template resolver this might be a template name or even
the template contents (e.g. StringTemplateResolver).context
- the context.writer
- the writer the results will be output to.void process(String template, Set<String> templateSelectors, IContext context, Writer writer)
Process the specified template (usually the template name) applying a set of
template selectors. Output will be written to the specified writer as it is generated
from processing the template. This is specially useful for web environments
(using ServletResponse.getWriter()
).
Template selectors allow the possibility to process only a part of the specified template, expressing this selection in a syntax similar to jQuery, CSS or XPath selectors. Note this is only available for markup template modes (HTML, XML). For more info on template selectors syntax, have a look at AttoParser's markup selectors documentation.
This is actually a convenience method that will internally create a TemplateSpec
and then
call process(TemplateSpec, IContext, Writer)
.
template
- the template; depending on the template resolver this might be a template name or even
the template contents (e.g. StringTemplateResolver).templateSelectors
- the selectors to be used, defining the fragments that should be processed. Can be null.context
- the context.writer
- the writer the results will be output to.void process(TemplateSpec templateSpec, IContext context, Writer writer)
Process a template starting from a TemplateSpec
. Output will be written to the
specified writer as it is generated from processing the template. This is specially useful for
web environments (using ServletResponse.getWriter()
).
The template specification will be used as input for the template resolvers, queried in chain until one of them resolves the template, which will then be executed.
The context will contain the variables that will be available for the execution of expressions inside the template.
templateSpec
- the template spec containing the template to be resolved (usually its name only),
template selectors if they are to be applied, a template mode if it should be forced
(instead of computing it at resolution time), and other attributes.context
- the context.writer
- the writer the results will be output to.IThrottledTemplateProcessor processThrottled(String template, IContext context)
Process the specified template (usually the template name). Output will be generated from processing the
template as dictated by the returned IThrottledTemplateProcessor
, and will be written to the output
means specified to this throttled processor's methods. This is specially useful for scenarios such as
reactive architectures in which the production of output could be regulated by a back-pressure mechanism.
This is actually a convenience method that will internally create a TemplateSpec
and then
call process(TemplateSpec, IContext, Writer)
.
template
- the template; depending on the template resolver this might be a template name or even
the template contents (e.g. StringTemplateResolver).context
- the context.IThrottledTemplateProcessor processThrottled(String template, Set<String> templateSelectors, IContext context)
Process the specified template (usually the template name) applying a set of
template selectors. Output will be generated from processing the
template as dictated by the returned IThrottledTemplateProcessor
, and will be written to the output
means specified to this throttled processor's methods. This is specially useful for scenarios such as
reactive architectures in which the production of output could be regulated by a back-pressure mechanism.
Template selectors allow the possibility to process only a part of the specified template, expressing this selection in a syntax similar to jQuery, CSS or XPath selectors. Note this is only available for markup template modes (HTML, XML). For more info on template selectors syntax, have a look at AttoParser's markup selectors documentation.
This is actually a convenience method that will internally create a TemplateSpec
and then
call process(TemplateSpec, IContext, Writer)
.
template
- the template; depending on the template resolver this might be a template name or even
the template contents (e.g. StringTemplateResolver).templateSelectors
- the selectors to be used, defining the fragments that should be processed. Can be null.context
- the context.IThrottledTemplateProcessor processThrottled(TemplateSpec templateSpec, IContext context)
Process a template starting from a TemplateSpec
. Output will be generated from processing the
template as dictated by the returned IThrottledTemplateProcessor
, and will be written to the output
means specified to this throttled processor's methods. This is specially useful for scenarios such as
reactive architectures in which the production of output could be regulated by a back-pressure mechanism.
The template specification will be used as input for the template resolvers, queried in chain until one of them resolves the template, which will then be executed.
The context will contain the variables that will be available for the execution of expressions inside the template.
templateSpec
- the template spec containing the template to be resolved (usually its name only),
template selectors if they are to be applied, a template mode if it should be forced
(instead of computing it at resolution time), and other attributes.context
- the context.Copyright © 2016 The THYMELEAF team. All rights reserved.