Interface for all Template Resolvers.
Template resolvers are in charge of resolving templates into
TemplateResolution objects that contain additional information related to
the template like:
- Its corresponding template resource (see
org.thymeleaf.templateresource.ITemplateResource).
- The Template Mode to be applied to this template:
TemplateMode
- Whether the template can be cached or not.
- If the template can be cached, (optionally) the time it will live in cache.
The Template Resolver will usually get all this information from a set of configurations
like applicability patterns, template mode patterns, etc. Each
ITemplateResolverimplementation will provide its own set of methods for specifying such configurations.
The fact that a Template Resolver returns a
TemplateResolution does not necessarily
mean that the resolved template resource exists. It might only be so if the template resolver
is configured to perform an existence check on the resource before returning a resolution
result (by means of calling
ITemplateResource#exists()), which might be configurable on
a per-
ITemplateResolver-implementation basis. Implementations might choose not to check
resource existance by default in order to avoid the possible performance impact of a double access
to the resource.
A Template Engine can be configured several template resolvers, and these will
be asked in order (according to the value returned by
#getOrder()) to return
a
TemplateResolution object for each template name. If a template resolver
returns null for a specific resolution, the next one in the chain is asked. Template Resolvers
that are not configured an order will be executed last in the chain.
Implementations of this interface should be thread-safe.
Note a class with this name existed since 1.0, but it was completely reimplemented
in Thymeleaf 3.0