Class AbstractConfigurableTemplateResolver
- All Implemented Interfaces:
ITemplateResolver
- Direct Known Subclasses:
ClassLoaderTemplateResolver
,FileTemplateResolver
,UrlTemplateResolver
,WebApplicationTemplateResolver
Abstract implementation of ITemplateResolver
extending AbstractTemplateResolver
and providing a large set of methods for configuring resource name (from template name), template mode,
cache validity and character encoding.
Unless overriden, this class will always apply the following validity to template resolutions:
- If not cacheable:
NonCacheableCacheEntryValidity
. - If cacheable and TTL not set:
AlwaysValidCacheEntryValidity
. - If cacheable and TTL set:
TTLCacheEntryValidity
.
- Since:
- 3.0.0
- Author:
- Daniel Fernández
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Long
Default value for the cache TTL: null.static final boolean
Default value for the cacheable flag: true.static final TemplateMode
Default template mode:TemplateMode.HTML
Fields inherited from class org.thymeleaf.templateresolver.AbstractTemplateResolver
DEFAULT_EXISTENCE_CHECK, DEFAULT_USE_DECOUPLED_LOGIC
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addTemplateAlias
(String alias, String templateName) Adds a new template alias to the currently configured ones.final void
Removes all currently configured template aliases.protected String
computeResourceName
(IEngineConfiguration configuration, String ownerTemplate, String template, String prefix, String suffix, boolean forceSuffix, Map<String, String> templateAliases, Map<String, Object> templateResolutionAttributes) Computes the resource name that will be used for resolving, from the template name and other parameters configured at this configurable resolver.protected TemplateMode
computeTemplateMode
(IEngineConfiguration configuration, String ownerTemplate, String template, Map<String, Object> templateResolutionAttributes) Computes the template mode that should be applied to a template, according to existing configuration.protected abstract ITemplateResource
computeTemplateResource
(IEngineConfiguration configuration, String ownerTemplate, String template, String resourceName, String characterEncoding, Map<String, Object> templateResolutionAttributes) Compute the real resource, once the resource name has been computed using prefix, suffix, and other configured artifacts.protected final ITemplateResource
computeTemplateResource
(IEngineConfiguration configuration, String ownerTemplate, String template, Map<String, Object> templateResolutionAttributes) Computes the resolved template resource.protected ICacheEntryValidity
computeValidity
(IEngineConfiguration configuration, String ownerTemplate, String template, Map<String, Object> templateResolutionAttributes) Computes the validity to be applied to the template resolution.Returns the patterns (as String) specified for establishing which templates have to be considered cacheable.final PatternSpec
Returns the pattern spec specified for establishing which templates have to be considered cacheable.final Long
Returns the TTL (Time To Live) in cache of templates resolved by this resolver.final String
Returns the character encoding to be used for reading template resources resolved by this template resolver.Returns the patterns specified for establishing theTemplateMode.CSS
template mode to resolved templates.final PatternSpec
Returns the pattern spec specified for establishing theTemplateMode.CSS
template mode to resolved templates.final boolean
Returns whether the application of the suffix should be forced on the template name.final boolean
Returns whether the configured template mode should be forced instead of attempting a smart template mode resolution based on template resource name.Returns the patterns specified for establishing theTemplateMode.HTML
template mode to resolved templates.final PatternSpec
Returns the pattern spec specified for establishing theTemplateMode.HTML
template mode to resolved templates.Returns the patterns specified for establishing theTemplateMode.JAVASCRIPT
template mode to resolved templates.final PatternSpec
Returns the pattern spec specified for establishing theTemplateMode.JAVASCRIPT
template mode to resolved templates.Returns the patterns (as String) specified for establishing which templates have to be considered non cacheable.final PatternSpec
Returns the pattern spec specified for establishing which templates have to be considered non cacheable.final String
Returns the (optional) prefix to be added to all template names in order to convert template names into resource names.Returns the patterns specified for establishing theTemplateMode.RAW
template mode to resolved templates.final PatternSpec
Returns the pattern spec specified for establishing theTemplateMode.RAW
template mode to resolved templates.final String
Returns the (optional) suffix to be added to all template names in order to convert template names into resource names.Returns the currently configured template aliases.final TemplateMode
Returns the template mode to be applied to templates resolved by this template resolver.Returns the patterns specified for establishing theTemplateMode.TEXT
template mode to resolved templates.final PatternSpec
Returns the pattern spec specified for establishing theTemplateMode.TEXT
template mode to resolved templates.Returns the patterns specified for establishing theTemplateMode.XML
template mode to resolved templates.final PatternSpec
Returns the pattern spec specified for establishing theTemplateMode.XML
template mode to resolved templates.final boolean
Returns whether templates resolved by this resolver have to be considered cacheable or not.final void
setCacheable
(boolean cacheable) Sets a new value for the cacheable flag.final void
setCacheablePatterns
(Set<String> cacheablePatterns) Sets the new patterns to be applied for establishing which templates have to be considered cacheablefinal void
setCacheTTLMs
(Long cacheTTLMs) Sets a new value for the cache TTL for resolved templates.final void
setCharacterEncoding
(String characterEncoding) Sets a new character encoding for reading template resources.final void
setCSSTemplateModePatterns
(Set<String> newCSSTemplateModePatterns) Sets the new patterns to be applied for establishing theTemplateMode.CSS
template mode as Strings.final void
setForceSuffix
(boolean forceSuffix) Sets whether the application of the suffix should be forced on the template name.final void
setForceTemplateMode
(boolean forceTemplateMode) Sets whether the configured template mode should be forced instead of attempting a smart template mode resolution based on template resource name.final void
setHtmlTemplateModePatterns
(Set<String> newHtmlTemplateModePatterns) Sets the new patterns to be applied for establishing theTemplateMode.HTML
template mode as Strings.final void
setJavaScriptTemplateModePatterns
(Set<String> newJavaScriptTemplateModePatterns) Sets the new patterns to be applied for establishing theTemplateMode.JAVASCRIPT
template mode as Strings.final void
setNonCacheablePatterns
(Set<String> nonCacheablePatterns) Sets the new patterns to be applied for establishing which templates have to be considered non cacheablefinal void
Sets a new (optional) prefix to be added to all template names in order to convert template names into resource names.final void
setRawTemplateModePatterns
(Set<String> newRawTemplateModePatterns) Sets the new patterns to be applied for establishing theTemplateMode.RAW
template mode as Strings.final void
Sets a new (optional) suffix to be added to all template names in order to convert template names into resource names.final void
setTemplateAliases
(Map<String, String> templateAliases) Sets all the new template aliases to be used.final void
setTemplateMode
(String templateMode) Sets the template mode to be applied to templates resolved by this resolver.final void
setTemplateMode
(TemplateMode templateMode) Sets the template mode to be applied to templates resolved by this resolver.final void
setTextTemplateModePatterns
(Set<String> newTextTemplateModePatterns) Sets the new patterns to be applied for establishing theTemplateMode.TEXT
template mode as Strings.final void
setXmlTemplateModePatterns
(Set<String> newXmlTemplateModePatterns) Sets the new patterns to be applied for establishing theTemplateMode.XML
template mode as Strings.Methods inherited from class org.thymeleaf.templateresolver.AbstractTemplateResolver
computeResolvable, getCheckExistence, getName, getOrder, getResolvablePatterns, getResolvablePatternSpec, getUseDecoupledLogic, resolveTemplate, setCheckExistence, setName, setOrder, setResolvablePatterns, setUseDecoupledLogic
-
Field Details
-
DEFAULT_TEMPLATE_MODE
Default template mode:
TemplateMode.HTML
-
DEFAULT_CACHEABLE
public static final boolean DEFAULT_CACHEABLEDefault value for the cacheable flag: true.
- See Also:
-
DEFAULT_CACHE_TTL_MS
Default value for the cache TTL: null. This means the parsed template will live in cache until removed by LRU (because of being the oldest entry).
-
-
Constructor Details
-
AbstractConfigurableTemplateResolver
public AbstractConfigurableTemplateResolver()
-
-
Method Details
-
getPrefix
Returns the (optional) prefix to be added to all template names in order to convert template names into resource names.
- Returns:
- the prefix.
-
setPrefix
Sets a new (optional) prefix to be added to all template names in order to convert template names into resource names.
- Parameters:
prefix
- the prefix to be set.
-
getSuffix
Returns the (optional) suffix to be added to all template names in order to convert template names into resource names.
Note that this suffix may not be applied to the template name if the template name already ends in a known file name suffix:
.html
,.htm
,.xhtml
,.xml
,.js
,.json
,.css
,.rss
,.atom
,.txt
. If this behaviour needs to be overridden so that suffix is always applied, thesetForceSuffix(boolean)
will need to be set.- Returns:
- the suffix.
-
setSuffix
Sets a new (optional) suffix to be added to all template names in order to convert template names into resource names.
Note that this suffix may not be applied to the template name if the template name already ends in a known file name suffix:
.html
,.htm
,.xhtml
,.xml
,.js
,.json
,.css
,.rss
,.atom
,.txt
. If this behaviour needs to be overridden so that suffix is always applied, thesetForceSuffix(boolean)
will need to be set.- Parameters:
suffix
- the suffix to be set.
-
getForceSuffix
public final boolean getForceSuffix()Returns whether the application of the suffix should be forced on the template name.
When forced, suffix will be appended to the template name even if the template name ends in a known suffix:
.html
,.htm
,.xhtml
,.xml
,.js
,.json
,.css
,.rss
,.atom
,.txt
.Default value is
.false
- Returns:
- whether the suffix will be forced or not.
- Since:
- 3.0.6
-
setForceSuffix
public final void setForceSuffix(boolean forceSuffix) Sets whether the application of the suffix should be forced on the template name.
When forced, suffix will be appended to the template name even if the template name ends in a known suffix:
.html
,.htm
,.xhtml
,.xml
,.js
,.json
,.css
,.rss
,.atom
,.txt
.Default value is
.false
- Parameters:
forceSuffix
- whether the suffix should be forced or not.- Since:
- 3.0.6
-
getCharacterEncoding
Returns the character encoding to be used for reading template resources resolved by this template resolver.
- Returns:
- the character encoding.
-
setCharacterEncoding
Sets a new character encoding for reading template resources.
- Parameters:
characterEncoding
- the character encoding to be used.
-
getTemplateMode
Returns the template mode to be applied to templates resolved by this template resolver.
If template mode patterns (see
setHtmlTemplateModePatterns(Set)
,setXmlTemplateModePatterns(Set)
, etc.) are also set, they have higher priority than the template mode set here (this would act as a default).Note that this template mode also may not be applied if the template resource name ends in a known file name suffix:
.html
,.htm
,.xhtml
,.xml
,.js
,.json
,.css
,.rss
,.atom
,.txt
. If this behaviour needs to be overridden so that template name is always applied, thesetForceTemplateMode(boolean)
will need to be set.- Returns:
- the template mode to be used.
-
setTemplateMode
Sets the template mode to be applied to templates resolved by this resolver.
If template mode patterns (see
setHtmlTemplateModePatterns(Set)
,setXmlTemplateModePatterns(Set)
, etc.) are also set, they have higher priority than the template mode set here (this would act as a default).Note that this template mode also may not be applied if the template resource name ends in a known file name suffix:
.html
,.htm
,.xhtml
,.xml
,.js
,.json
,.css
,.rss
,.atom
,.txt
. If this behaviour needs to be overridden so that template name is always applied, thesetForceTemplateMode(boolean)
will need to be set.- Parameters:
templateMode
- the template mode.
-
setTemplateMode
Sets the template mode to be applied to templates resolved by this resolver.
Allowed templates modes are defined by the
TemplateMode
class.If template mode patterns (see
setHtmlTemplateModePatterns(Set)
,setXmlTemplateModePatterns(Set)
, etc.) are also set, they have higher priority than the template mode set here (this would act as a default).Note that this template mode also may not be applied if the template resource name ends in a known file name suffix:
.html
,.htm
,.xhtml
,.xml
,.js
,.json
,.css
,.rss
,.atom
,.txt
. If this behaviour needs to be overridden so that template name is always applied, thesetForceTemplateMode(boolean)
will need to be set.- Parameters:
templateMode
- the template mode.
-
getForceTemplateMode
public final boolean getForceTemplateMode()Returns whether the configured template mode should be forced instead of attempting a smart template mode resolution based on template resource name.
When forced, the configured template mode (
setTemplateMode(TemplateMode)
will be applied even if the template resource name ends in a known suffix:.html
,.htm
,.xhtml
,.xml
,.js
,.json
,.css
,.rss
,.atom
,.txt
.Default value is
.false
- Returns:
- whether the suffix will be forced or not.
- Since:
- 3.0.6
-
setForceTemplateMode
public final void setForceTemplateMode(boolean forceTemplateMode) Sets whether the configured template mode should be forced instead of attempting a smart template mode resolution based on template resource name.
When forced, the configured template mode (
setTemplateMode(TemplateMode)
will be applied even if the template resource name ends in a known suffix:.html
,.htm
,.xhtml
,.xml
,.js
,.json
,.css
,.rss
,.atom
,.txt
.Default value is
.false
- Parameters:
forceTemplateMode
- whether the configured template mode should be forced or not.- Since:
- 3.0.6
-
isCacheable
public final boolean isCacheable()Returns whether templates resolved by this resolver have to be considered cacheable or not.
If cacheable patterns (see
setCacheablePatterns(Set)
) are also set, they have higher priority than the value set here (this would act as a default).- Returns:
- whether templates resolved are cacheable or not.
-
setCacheable
public final void setCacheable(boolean cacheable) Sets a new value for the cacheable flag.
If cacheable patterns (see
setCacheablePatterns(Set)
) are also set, they have higher priority than the value set here (this would act as a default).- Parameters:
cacheable
- whether resolved patterns should be considered cacheable or not.
-
getCacheTTLMs
Returns the TTL (Time To Live) in cache of templates resolved by this resolver.
If a template is resolved as cacheable but cache TTL is null, this means the template will live in cache until evicted by LRU (Least Recently Used) algorithm for being the oldest entry in cache.
- Returns:
- the cache TTL for resolved templates.
-
setCacheTTLMs
Sets a new value for the cache TTL for resolved templates.
If a template is resolved as cacheable but cache TTL is null, this means the template will live in cache until evicted by LRU (Least Recently Used) algorithm for being the oldest entry in cache.
- Parameters:
cacheTTLMs
- the new cache TTL, or null for using natural LRU eviction.
-
getTemplateAliases
Returns the currently configured template aliases.
Template aliases allow the use of several (and probably shorter) names for templates.
Aliases are applied to template names before prefix/suffix.
- Returns:
- the map of template aliases.
-
setTemplateAliases
Sets all the new template aliases to be used.
Template aliases allow the use of several (and probably shorter) names for templates.
Aliases are applied to template names before prefix/suffix.
- Parameters:
templateAliases
- the new template aliases.
-
addTemplateAlias
Adds a new template alias to the currently configured ones.
- Parameters:
alias
- the new alias nametemplateName
- the name of the template the alias will be applied to
-
clearTemplateAliases
public final void clearTemplateAliases()Removes all currently configured template aliases.
-
getXmlTemplateModePatternSpec
Returns the pattern spec specified for establishing the
TemplateMode.XML
template mode to resolved templates.- Returns:
- the pattern spec
-
getXmlTemplateModePatterns
Returns the patterns specified for establishing the
TemplateMode.XML
template mode to resolved templates.This is a convenience method equivalent to
getXmlTemplateModePatternSpec()
.getPatterns()- Returns:
- the pattern spec
-
setXmlTemplateModePatterns
Sets the new patterns to be applied for establishing the
TemplateMode.XML
template mode as Strings.This is a convenience method equivalent to
getXmlTemplateModePatternSpec()
.setPatterns(Set<String>)- Parameters:
newXmlTemplateModePatterns
- the new patterns
-
getHtmlTemplateModePatternSpec
Returns the pattern spec specified for establishing the
TemplateMode.HTML
template mode to resolved templates.- Returns:
- the pattern spec
- Since:
- 3.0.0
-
getHtmlTemplateModePatterns
Returns the patterns specified for establishing the
TemplateMode.HTML
template mode to resolved templates.This is a convenience method equivalent to
getHtmlTemplateModePatternSpec()
.getPatterns()- Returns:
- the pattern spec
- Since:
- 3.0.0
-
setHtmlTemplateModePatterns
Sets the new patterns to be applied for establishing the
TemplateMode.HTML
template mode as Strings.This is a convenience method equivalent to
getHtmlTemplateModePatternSpec()
.setPatterns(Set<String>)- Parameters:
newHtmlTemplateModePatterns
- the new patterns- Since:
- 3.0.0
-
getJavaScriptTemplateModePatternSpec
Returns the pattern spec specified for establishing the
TemplateMode.JAVASCRIPT
template mode to resolved templates.- Returns:
- the pattern spec
- Since:
- 3.0.0
-
getJavaScriptTemplateModePatterns
Returns the patterns specified for establishing the
TemplateMode.JAVASCRIPT
template mode to resolved templates.This is a convenience method equivalent to
getJavaScriptTemplateModePatternSpec()
.getPatterns()- Returns:
- the pattern spec
- Since:
- 3.0.0
-
setJavaScriptTemplateModePatterns
Sets the new patterns to be applied for establishing the
TemplateMode.JAVASCRIPT
template mode as Strings.This is a convenience method equivalent to
getJavaScriptTemplateModePatternSpec()
.setPatterns(Set<String>)- Parameters:
newJavaScriptTemplateModePatterns
- the new patterns- Since:
- 3.0.0
-
getCSSTemplateModePatternSpec
Returns the pattern spec specified for establishing the
TemplateMode.CSS
template mode to resolved templates.- Returns:
- the pattern spec
- Since:
- 3.0.0
-
getCSSTemplateModePatterns
Returns the patterns specified for establishing the
TemplateMode.CSS
template mode to resolved templates.This is a convenience method equivalent to
getCSSTemplateModePatternSpec()
.getPatterns()- Returns:
- the pattern spec
- Since:
- 3.0.0
-
setCSSTemplateModePatterns
Sets the new patterns to be applied for establishing the
TemplateMode.CSS
template mode as Strings.This is a convenience method equivalent to
getCSSTemplateModePatternSpec()
.setPatterns(Set<String>)- Parameters:
newCSSTemplateModePatterns
- the new patterns- Since:
- 3.0.0
-
getRawTemplateModePatternSpec
Returns the pattern spec specified for establishing the
TemplateMode.RAW
template mode to resolved templates.- Returns:
- the pattern spec
- Since:
- 3.0.0
-
getRawTemplateModePatterns
Returns the patterns specified for establishing the
TemplateMode.RAW
template mode to resolved templates.This is a convenience method equivalent to
getRawTemplateModePatternSpec()
.getPatterns()- Returns:
- the pattern spec
- Since:
- 3.0.0
-
setRawTemplateModePatterns
Sets the new patterns to be applied for establishing the
TemplateMode.RAW
template mode as Strings.This is a convenience method equivalent to
getRawTemplateModePatternSpec()
.setPatterns(Set<String>)- Parameters:
newRawTemplateModePatterns
- the new patterns- Since:
- 3.0.0
-
getTextTemplateModePatternSpec
Returns the pattern spec specified for establishing the
TemplateMode.TEXT
template mode to resolved templates.- Returns:
- the pattern spec
- Since:
- 3.0.0
-
getTextTemplateModePatterns
Returns the patterns specified for establishing the
TemplateMode.TEXT
template mode to resolved templates.This is a convenience method equivalent to
getTextTemplateModePatternSpec()
.getPatterns()- Returns:
- the pattern spec
- Since:
- 3.0.0
-
setTextTemplateModePatterns
Sets the new patterns to be applied for establishing the
TemplateMode.TEXT
template mode as Strings.This is a convenience method equivalent to
getTextTemplateModePatternSpec()
.setPatterns(Set<String>)- Parameters:
newTextTemplateModePatterns
- the new patterns- Since:
- 3.0.0
-
getCacheablePatternSpec
Returns the pattern spec specified for establishing which templates have to be considered cacheable.
These patterns have higher precedence than the cacheable flag (see
setCacheable(boolean)
). Such flag can be considered a default value after cacheable patterns and non-cacheable patterns have been applied.- Returns:
- the pattern spec
-
getCacheablePatterns
Returns the patterns (as String) specified for establishing which templates have to be considered cacheable.
These patterns have higher precedence than the cacheable flag (see
setCacheable(boolean)
). Such flag can be considered a default value after cacheable patterns and non-cacheable patterns have been applied.This is a convenience method equivalent to
getCacheablePatternSpec()
.getPatterns()- Returns:
- the patterns
-
setCacheablePatterns
Sets the new patterns to be applied for establishing which templates have to be considered cacheable
These patterns have higher precedence than the cacheable flag (see
setCacheable(boolean)
). Such flag can be considered a default value after cacheable patterns and non-cacheable patterns have been applied.This is a convenience method equivalent to
getCacheablePatternSpec()
.setPatterns(Set<String>)- Parameters:
cacheablePatterns
- the new patterns
-
getNonCacheablePatternSpec
Returns the pattern spec specified for establishing which templates have to be considered non cacheable.
These patterns have higher precedence than the cacheable flag (see
setCacheable(boolean)
). Such flag can be considered a default value after cacheable patterns and non-cacheable patterns have been applied.- Returns:
- the pattern spec
-
getNonCacheablePatterns
Returns the patterns (as String) specified for establishing which templates have to be considered non cacheable.
These patterns have higher precedence than the cacheable flag (see
setCacheable(boolean)
). Such flag can be considered a default value after cacheable patterns and non-cacheable patterns have been applied.This is a convenience method equivalent to
getNonCacheablePatternSpec()
.getPatterns()- Returns:
- the patterns
-
setNonCacheablePatterns
Sets the new patterns to be applied for establishing which templates have to be considered non cacheable
These patterns have higher precedence than the cacheable flag (see
setCacheable(boolean)
). Such flag can be considered a default value after cacheable patterns and non-cacheable patterns have been applied.This is a convenience method equivalent to
getNonCacheablePatternSpec()
.setPatterns(Set<String>)- Parameters:
nonCacheablePatterns
- the new patterns
-
computeResourceName
protected String computeResourceName(IEngineConfiguration configuration, String ownerTemplate, String template, String prefix, String suffix, boolean forceSuffix, Map<String, String> templateAliases, Map<String, Object> templateResolutionAttributes) Computes the resource name that will be used for resolving, from the template name and other parameters configured at this configurable resolver.
This method can be overridden by subclasses that need to modify the standard way in which the name of the template resource is computed by default before passing it to the real resource resolution mechanism (in method
computeTemplateResource(IEngineConfiguration, String, String, String, String, Map)
By default, the resource name will be created by first applying the template aliases, and then adding prefix and suffix to the specified template (template name).
- Parameters:
configuration
- the engine configuration in use.ownerTemplate
- the owner template, if the resource being computed is a fragment. Might be null.template
- the template (normally the template name, except for String templates).prefix
- the prefix to be applied.suffix
- the suffix to be applied.forceSuffix
- whether the suffix should be forced or not.templateAliases
- the template aliases map.templateResolutionAttributes
- the template resolution attributes, if any. Might be null.- Returns:
- the resource name that should be used for resolving
- Since:
- 3.0.6
-
computeTemplateMode
protected TemplateMode computeTemplateMode(IEngineConfiguration configuration, String ownerTemplate, String template, Map<String, Object> templateResolutionAttributes) Description copied from class:AbstractTemplateResolver
Computes the template mode that should be applied to a template, according to existing configuration.
- Specified by:
computeTemplateMode
in classAbstractTemplateResolver
- Parameters:
configuration
- the engine configuration.ownerTemplate
- the owner template, if the resource being computed is a fragment. Might be null.template
- the template to be resolved (usually its name).templateResolutionAttributes
- the template resolution attributes, if any. Might be null.- Returns:
- the template mode proposed by the template resolver for the resolved template.
-
computeValidity
protected ICacheEntryValidity computeValidity(IEngineConfiguration configuration, String ownerTemplate, String template, Map<String, Object> templateResolutionAttributes) Description copied from class:AbstractTemplateResolver
Computes the validity to be applied to the template resolution. This includes determining whether the template can be cached or not, and also in what circumstances (for instance, for how much time) can its cache entry be considered valid.
- Specified by:
computeValidity
in classAbstractTemplateResolver
- Parameters:
configuration
- the engine configuration.ownerTemplate
- the owner template, if the resource being computed is a fragment. Might be null.template
- the template to be resolved (usually its name).templateResolutionAttributes
- the template resolution attributes, if any. Might be null.- Returns:
- the validity
-
computeTemplateResource
protected final ITemplateResource computeTemplateResource(IEngineConfiguration configuration, String ownerTemplate, String template, Map<String, Object> templateResolutionAttributes) Description copied from class:AbstractTemplateResolver
Computes the resolved template resource.
- Specified by:
computeTemplateResource
in classAbstractTemplateResolver
- Parameters:
configuration
- the engine configuration.ownerTemplate
- the owner template, if the resource being computed is a fragment. Might be null.template
- the template to be resolved (usually its name).templateResolutionAttributes
- the template resolution attributes, if any. Might be null.- Returns:
- the template resource, or null if this template cannot be resolved (or the resource does not exist).
-
computeTemplateResource
protected abstract ITemplateResource computeTemplateResource(IEngineConfiguration configuration, String ownerTemplate, String template, String resourceName, String characterEncoding, Map<String, Object> templateResolutionAttributes) Compute the real resource, once the resource name has been computed using prefix, suffix, and other configured artifacts.
- Parameters:
configuration
- the engine configuration in use.ownerTemplate
- the owner template, if the resource being computed is a fragment. Might be null.template
- the template (normally the template name, except for String templates).resourceName
- the resource name, complete with prefix, suffix, aliases, etc.characterEncoding
- the character encoding to be used for reading the resource.templateResolutionAttributes
- the template resolution attributes, if any. Might be null.- Returns:
- the template resource
-