public abstract class AbstractConfigurableTemplateResolver extends AbstractTemplateResolver
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:
NonCacheableCacheEntryValidity
.AlwaysValidCacheEntryValidity
.TTLCacheEntryValidity
.Modifier and Type | Field and Description |
---|---|
static Long |
DEFAULT_CACHE_TTL_MS
Default value for the cache TTL: null.
|
static boolean |
DEFAULT_CACHEABLE
Default value for the cacheable flag: true.
|
static TemplateMode |
DEFAULT_TEMPLATE_MODE
Default template mode:
TemplateMode.HTML |
DEFAULT_EXISTENCE_CHECK
Constructor and Description |
---|
AbstractConfigurableTemplateResolver() |
Modifier and Type | Method and Description |
---|---|
void |
addTemplateAlias(String alias,
String templateName)
Adds a new template alias to the currently configured ones.
|
void |
clearTemplateAliases()
Removes all currently configured template aliases.
|
protected String |
computeResourceName(IEngineConfiguration configuration,
String ownerTemplate,
String template,
String prefix,
String suffix,
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 ITemplateResource |
computeTemplateResource(IEngineConfiguration configuration,
String ownerTemplate,
String template,
Map<String,Object> templateResolutionAttributes)
Computes the resolved template resource.
|
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 ICacheEntryValidity |
computeValidity(IEngineConfiguration configuration,
String ownerTemplate,
String template,
Map<String,Object> templateResolutionAttributes)
Computes the validity to be applied to the template resolution.
|
Set<String> |
getCacheablePatterns()
Returns the patterns (as String) specified for establishing which
templates have to be considered cacheable.
|
PatternSpec |
getCacheablePatternSpec()
Returns the pattern spec specified for establishing which
templates have to be considered cacheable.
|
Long |
getCacheTTLMs()
Returns the TTL (Time To Live) in cache of templates resolved by this
resolver.
|
String |
getCharacterEncoding()
Returns the character encoding to be used for reading template resources
resolved by this template resolver.
|
Set<String> |
getCSSTemplateModePatterns()
Returns the patterns specified for establishing the
TemplateMode.CSS
template mode to resolved templates. |
PatternSpec |
getCSSTemplateModePatternSpec()
Returns the pattern spec specified for establishing the
TemplateMode.CSS
template mode to resolved templates. |
Set<String> |
getHtml5TemplateModePatterns()
Deprecated.
Deprecated in 3.0.0. Use the methods for the
TemplateMode.XML template mode instead.
Will be removed in 3.1 |
PatternSpec |
getHtml5TemplateModePatternSpec()
Deprecated.
Deprecated in 3.0.0. Use the methods for the
TemplateMode.XML template mode instead.
Will be removed in 3.1 |
Set<String> |
getHtmlTemplateModePatterns()
Returns the patterns specified for establishing the
TemplateMode.HTML
template mode to resolved templates. |
PatternSpec |
getHtmlTemplateModePatternSpec()
Returns the pattern spec specified for establishing the
TemplateMode.HTML
template mode to resolved templates. |
Set<String> |
getJavaScriptTemplateModePatterns()
Returns the patterns specified for establishing the
TemplateMode.JAVASCRIPT
template mode to resolved templates. |
PatternSpec |
getJavaScriptTemplateModePatternSpec()
Returns the pattern spec specified for establishing the
TemplateMode.JAVASCRIPT
template mode to resolved templates. |
Set<String> |
getLegacyHtml5TemplateModePatterns()
Deprecated.
Deprecated in 3.0.0. Use the methods for the
TemplateMode.XML template mode instead.
Will be removed in 3.1 |
PatternSpec |
getLegacyHtml5TemplateModePatternSpec()
Deprecated.
Deprecated in 3.0.0. Use the methods for the
TemplateMode.XML template mode instead.
Will be removed in 3.1 |
Set<String> |
getNonCacheablePatterns()
Returns the patterns (as String) specified for establishing which
templates have to be considered non cacheable.
|
PatternSpec |
getNonCacheablePatternSpec()
Returns the pattern spec specified for establishing which
templates have to be considered non cacheable.
|
String |
getPrefix()
Returns the (optional) prefix to be added to all template names in order
to convert template names into resource names.
|
Set<String> |
getRawTemplateModePatterns()
Returns the patterns specified for establishing the
TemplateMode.RAW
template mode to resolved templates. |
PatternSpec |
getRawTemplateModePatternSpec()
Returns the pattern spec specified for establishing the
TemplateMode.RAW
template mode to resolved templates. |
String |
getSuffix()
Returns the (optional) suffix to be added to all template names in order
to convert template names into resource names.
|
Map<String,String> |
getTemplateAliases()
Returns the currently configured template aliases.
|
TemplateMode |
getTemplateMode()
Returns the template mode to be applied to templates resolved by
this template resolver.
|
Set<String> |
getTextTemplateModePatterns()
Returns the patterns specified for establishing the
TemplateMode.TEXT
template mode to resolved templates. |
PatternSpec |
getTextTemplateModePatternSpec()
Returns the pattern spec specified for establishing the
TemplateMode.TEXT
template mode to resolved templates. |
Set<String> |
getValidXhtmlTemplateModePatterns()
Deprecated.
Deprecated in 3.0.0. Use the methods for the
TemplateMode.XML template mode instead.
Will be removed in 3.1 |
PatternSpec |
getValidXhtmlTemplateModePatternSpec()
Deprecated.
Deprecated in 3.0.0. Use the methods for the
TemplateMode.XML template mode instead.
Will be removed in 3.1 |
Set<String> |
getValidXmlTemplateModePatterns()
Deprecated.
Deprecated in 3.0.0. Use the methods for the
TemplateMode.XML template mode instead.
Will be removed in 3.1 |
PatternSpec |
getValidXmlTemplateModePatternSpec()
Deprecated.
Deprecated in 3.0.0. Use the methods for the
TemplateMode.XML template mode instead.
Will be removed in 3.1 |
Set<String> |
getXhtmlTemplateModePatterns()
Deprecated.
Deprecated in 3.0.0. Use the methods for the
TemplateMode.XML template mode instead.
Will be removed in 3.1 |
PatternSpec |
getXhtmlTemplateModePatternSpec()
Deprecated.
Deprecated in 3.0.0. Use the methods for the
TemplateMode.XML template mode instead.
Will be removed in 3.1 |
Set<String> |
getXmlTemplateModePatterns()
Returns the patterns specified for establishing the
TemplateMode.XML
template mode to resolved templates. |
PatternSpec |
getXmlTemplateModePatternSpec()
Returns the pattern spec specified for establishing the
TemplateMode.XML
template mode to resolved templates. |
boolean |
isCacheable()
Returns whether templates resolved by this resolver have to be considered
cacheable or not.
|
void |
setCacheable(boolean cacheable)
Sets a new value for the cacheable flag.
|
void |
setCacheablePatterns(Set<String> cacheablePatterns)
Sets the new patterns to be applied for establishing which
templates have to be considered cacheable
|
void |
setCacheTTLMs(Long cacheTTLMs)
Sets a new value for the cache TTL for resolved templates.
|
void |
setCharacterEncoding(String characterEncoding)
Sets a new character encoding for reading template resources.
|
void |
setCSSTemplateModePatterns(Set<String> newCSSTemplateModePatterns)
Sets the new patterns to be applied for establishing the
TemplateMode.CSS
template mode as Strings. |
void |
setHtml5TemplateModePatterns(Set<String> newHtml5TemplateModePatterns)
Deprecated.
Deprecated in 3.0.0. Use the methods for the
TemplateMode.XML template mode instead.
Will be removed in 3.1 |
void |
setHtmlTemplateModePatterns(Set<String> newHtmlTemplateModePatterns)
Sets the new patterns to be applied for establishing the
TemplateMode.HTML
template mode as Strings. |
void |
setJavaScriptTemplateModePatterns(Set<String> newJavaScriptTemplateModePatterns)
Sets the new patterns to be applied for establishing the
TemplateMode.JAVASCRIPT
template mode as Strings. |
void |
setLegacyHtml5TemplateModePatterns(Set<String> newLegacyHtml5TemplateModePatterns)
Deprecated.
Deprecated in 3.0.0. Use the methods for the
TemplateMode.XML template mode instead.
Will be removed in 3.1 |
void |
setNonCacheablePatterns(Set<String> nonCacheablePatterns)
Sets the new patterns to be applied for establishing which
templates have to be considered non cacheable
|
void |
setPrefix(String prefix)
Sets a new (optional) prefix to be added to all template names in order
to convert template names into resource names.
|
void |
setRawTemplateModePatterns(Set<String> newRawTemplateModePatterns)
Sets the new patterns to be applied for establishing the
TemplateMode.RAW
template mode as Strings. |
void |
setSuffix(String suffix)
Sets a new (optional) suffix to be added to all template names in order
to convert template names into resource names.
|
void |
setTemplateAliases(Map<String,String> templateAliases)
Sets all the new template aliases to be used.
|
void |
setTemplateMode(String templateMode)
Sets the template mode to be applied to templates resolved by this resolver.
|
void |
setTemplateMode(TemplateMode templateMode)
Sets the template mode to be applied to templates resolved by this resolver.
|
void |
setTextTemplateModePatterns(Set<String> newTextTemplateModePatterns)
Sets the new patterns to be applied for establishing the
TemplateMode.TEXT
template mode as Strings. |
void |
setValidXhtmlTemplateModePatterns(Set<String> newValidXhtmlTemplateModePatterns)
Deprecated.
Deprecated in 3.0.0. Use the methods for the
TemplateMode.XML template mode instead.
Will be removed in 3.1 |
void |
setValidXmlTemplateModePatterns(Set<String> newValidXmlTemplateModePatterns)
Deprecated.
Deprecated in 3.0.0. Use the methods for the
TemplateMode.XML template mode instead.
Will be removed in 3.1 |
void |
setXhtmlTemplateModePatterns(Set<String> newXhtmlTemplateModePatterns)
Deprecated.
Deprecated in 3.0.0. Use the methods for the
TemplateMode.XML template mode instead.
Will be removed in 3.1 |
void |
setXmlTemplateModePatterns(Set<String> newXmlTemplateModePatterns)
Sets the new patterns to be applied for establishing the
TemplateMode.XML
template mode as Strings. |
computeResolvable, getCheckExistence, getName, getOrder, getResolvablePatterns, getResolvablePatternSpec, resolveTemplate, setCheckExistence, setName, setOrder, setResolvablePatterns
public static final TemplateMode DEFAULT_TEMPLATE_MODE
Default template mode: TemplateMode.HTML
public static final boolean DEFAULT_CACHEABLE
Default value for the cacheable flag: true.
public static final Long 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).
public AbstractConfigurableTemplateResolver()
public final String getPrefix()
Returns the (optional) prefix to be added to all template names in order to convert template names into resource names.
public final void setPrefix(String prefix)
Sets a new (optional) prefix to be added to all template names in order to convert template names into resource names.
prefix
- the prefix to be set.public final String getSuffix()
Returns the (optional) suffix to be added to all template names in order to convert template names into resource names.
public final void setSuffix(String suffix)
Sets a new (optional) suffix to be added to all template names in order to convert template names into resource names.
suffix
- the suffix to be set.public final String getCharacterEncoding()
Returns the character encoding to be used for reading template resources resolved by this template resolver.
public final void setCharacterEncoding(String characterEncoding)
Sets a new character encoding for reading template resources.
characterEncoding
- the character encoding to be used.public final TemplateMode getTemplateMode()
Returns the template mode to be applied to templates resolved by this template resolver.
If template mode patterns (see setXhtmlTemplateModePatterns(Set)
,
setHtml5TemplateModePatterns(Set)
, etc.) are also set, they have higher
priority than the template mode set here (this would act as a default).
public final void setTemplateMode(TemplateMode templateMode)
Sets the template mode to be applied to templates resolved by this resolver.
If template mode patterns (see setXhtmlTemplateModePatterns(Set)
,
setHtml5TemplateModePatterns(Set)
, etc.) are also set, they have higher
priority than the template mode set here (this would act as a default).
templateMode
- the template mode.public final void setTemplateMode(String templateMode)
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 setXhtmlTemplateModePatterns(Set)
,
setHtml5TemplateModePatterns(Set)
, etc.) are also set, they have higher
priority than the template mode set here (this would act as a default).
templateMode
- the template mode.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).
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).
cacheable
- whether resolved patterns should be considered cacheable or not.public final Long 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.
public final void setCacheTTLMs(Long cacheTTLMs)
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.
cacheTTLMs
- the new cache TTL, or null for using natural LRU eviction.public final Map<String,String> 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.
public final void setTemplateAliases(Map<String,String> templateAliases)
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.
templateAliases
- the new template aliases.public final void addTemplateAlias(String alias, String templateName)
Adds a new template alias to the currently configured ones.
alias
- the new alias nametemplateName
- the name of the template the alias will be applied topublic final void clearTemplateAliases()
Removes all currently configured template aliases.
public final PatternSpec getXmlTemplateModePatternSpec()
Returns the pattern spec specified for establishing the TemplateMode.XML
template mode to resolved templates.
public final Set<String> getXmlTemplateModePatterns()
Returns the patterns specified for establishing the TemplateMode.XML
template mode to resolved templates.
This is a convenience method equivalent to getXmlTemplateModePatternSpec()
.getPatterns()
public final void setXmlTemplateModePatterns(Set<String> newXmlTemplateModePatterns)
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>)
newXmlTemplateModePatterns
- the new patternspublic final PatternSpec getHtmlTemplateModePatternSpec()
Returns the pattern spec specified for establishing the TemplateMode.HTML
template mode to resolved templates.
public final Set<String> getHtmlTemplateModePatterns()
Returns the patterns specified for establishing the TemplateMode.HTML
template mode to resolved templates.
This is a convenience method equivalent to getHtmlTemplateModePatternSpec()
.getPatterns()
public final void setHtmlTemplateModePatterns(Set<String> newHtmlTemplateModePatterns)
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>)
newHtmlTemplateModePatterns
- the new patternspublic final PatternSpec getJavaScriptTemplateModePatternSpec()
Returns the pattern spec specified for establishing the TemplateMode.JAVASCRIPT
template mode to resolved templates.
public final Set<String> getJavaScriptTemplateModePatterns()
Returns the patterns specified for establishing the TemplateMode.JAVASCRIPT
template mode to resolved templates.
This is a convenience method equivalent to getJavaScriptTemplateModePatternSpec()
.getPatterns()
public final void setJavaScriptTemplateModePatterns(Set<String> newJavaScriptTemplateModePatterns)
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>)
newJavaScriptTemplateModePatterns
- the new patternspublic final PatternSpec getCSSTemplateModePatternSpec()
Returns the pattern spec specified for establishing the TemplateMode.CSS
template mode to resolved templates.
public final Set<String> getCSSTemplateModePatterns()
Returns the patterns specified for establishing the TemplateMode.CSS
template mode to resolved templates.
This is a convenience method equivalent to getCSSTemplateModePatternSpec()
.getPatterns()
public final void setCSSTemplateModePatterns(Set<String> newCSSTemplateModePatterns)
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>)
newCSSTemplateModePatterns
- the new patternspublic final PatternSpec getRawTemplateModePatternSpec()
Returns the pattern spec specified for establishing the TemplateMode.RAW
template mode to resolved templates.
public final Set<String> getRawTemplateModePatterns()
Returns the patterns specified for establishing the TemplateMode.RAW
template mode to resolved templates.
This is a convenience method equivalent to getRawTemplateModePatternSpec()
.getPatterns()
public final void setRawTemplateModePatterns(Set<String> newRawTemplateModePatterns)
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>)
newRawTemplateModePatterns
- the new patternspublic final PatternSpec getTextTemplateModePatternSpec()
Returns the pattern spec specified for establishing the TemplateMode.TEXT
template mode to resolved templates.
public final Set<String> getTextTemplateModePatterns()
Returns the patterns specified for establishing the TemplateMode.TEXT
template mode to resolved templates.
This is a convenience method equivalent to getTextTemplateModePatternSpec()
.getPatterns()
public final void setTextTemplateModePatterns(Set<String> newTextTemplateModePatterns)
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>)
newTextTemplateModePatterns
- the new patterns@Deprecated public final PatternSpec getValidXmlTemplateModePatternSpec()
TemplateMode.XML
template mode instead.
Will be removed in 3.1
Returns the pattern spec specified for establishing the deprecated VALIDXML (validated XML)
template mode to resolved templates. Note that, due to the deprecation of this template mode, these patterns
will be applied to the TemplateMode.XML
template mode instead.
@Deprecated public final Set<String> getValidXmlTemplateModePatterns()
TemplateMode.XML
template mode instead.
Will be removed in 3.1
Returns the patterns specified for establishing the deprecated VALIDXML (validated XML)
template mode to resolved templates. Note that, due to the deprecation of this template mode, these patterns
will be applied to the TemplateMode.XML
template mode instead.
This is a convenience method equivalent to getValidXmlTemplateModePatternSpec()
.getPatterns()
@Deprecated public final void setValidXmlTemplateModePatterns(Set<String> newValidXmlTemplateModePatterns)
TemplateMode.XML
template mode instead.
Will be removed in 3.1
Sets the new patterns to be applied for establishing the deprecated VALIDXML (validated XML)
template mode as Strings. Note that, due to the deprecation of this template mode, these patterns
will be applied to the TemplateMode.XML
template mode instead.
This is a convenience method equivalent to getValidXmlTemplateModePatternSpec()
.setPatterns(Set<String>)
newValidXmlTemplateModePatterns
- the new patterns@Deprecated public final PatternSpec getXhtmlTemplateModePatternSpec()
TemplateMode.XML
template mode instead.
Will be removed in 3.1
Returns the pattern spec specified for establishing the deprecated XHTML
template mode to resolved templates. Note that, due to the deprecation of this template mode, these patterns
will be applied to the TemplateMode.HTML
template mode instead.
@Deprecated public final Set<String> getXhtmlTemplateModePatterns()
TemplateMode.XML
template mode instead.
Will be removed in 3.1
Returns the patterns specified for establishing the deprecated XHTML
template mode to resolved templates. Note that, due to the deprecation of this template mode, these patterns
will be applied to the TemplateMode.HTML
template mode instead.
This is a convenience method equivalent to getXhtmlTemplateModePatternSpec()
.getPatterns()
@Deprecated public final void setXhtmlTemplateModePatterns(Set<String> newXhtmlTemplateModePatterns)
TemplateMode.XML
template mode instead.
Will be removed in 3.1
Sets the new patterns to be applied for establishing the deprecated XHTML
template mode as Strings. Note that, due to the deprecation of this template mode, these patterns
will be applied to the TemplateMode.HTML
template mode instead.
This is a convenience method equivalent to getXhtmlTemplateModePatternSpec()
.setPatterns(Set<String>)
newXhtmlTemplateModePatterns
- the new patterns@Deprecated public final PatternSpec getValidXhtmlTemplateModePatternSpec()
TemplateMode.XML
template mode instead.
Will be removed in 3.1
Returns the pattern spec specified for establishing the deprecated VALIDXHTML (validated XHTML)
template mode to resolved templates. Note that, due to the deprecation of this template mode, these patterns
will be applied to the TemplateMode.HTML
template mode instead.
@Deprecated public final Set<String> getValidXhtmlTemplateModePatterns()
TemplateMode.XML
template mode instead.
Will be removed in 3.1
Returns the patterns specified for establishing the deprecated VALIDXHTML (validated XHTML)
template mode to resolved templates. Note that, due to the deprecation of this template mode, these patterns
will be applied to the TemplateMode.HTML
template mode instead.
This is a convenience method equivalent to getValidXhtmlTemplateModePatternSpec()
.getPatterns()
@Deprecated public final void setValidXhtmlTemplateModePatterns(Set<String> newValidXhtmlTemplateModePatterns)
TemplateMode.XML
template mode instead.
Will be removed in 3.1
Sets the new patterns to be applied for establishing the deprecated VALIDXHTML (validated XHTML)
template mode as Strings. Note that, due to the deprecation of this template mode, these patterns
will be applied to the TemplateMode.HTML
template mode instead.
This is a convenience method equivalent to getValidXhtmlTemplateModePatternSpec()
.setPatterns(Set<String>)
newValidXhtmlTemplateModePatterns
- the new patterns@Deprecated public final PatternSpec getLegacyHtml5TemplateModePatternSpec()
TemplateMode.XML
template mode instead.
Will be removed in 3.1
Returns the pattern spec specified for establishing the deprecated LEGACYHTML5 (non-XML-formed HTML5 that needs HTML-to-XML conversion)
template mode to resolved templates. Note that, due to the deprecation of this template mode, these patterns
will be applied to the TemplateMode.HTML
template mode instead.
@Deprecated public final Set<String> getLegacyHtml5TemplateModePatterns()
TemplateMode.XML
template mode instead.
Will be removed in 3.1
Returns the patterns specified for establishing the deprecated LEGACYHTML5 (non-XML-formed HTML5 that needs HTML-to-XML conversion)
template mode to resolved templates. Note that, due to the deprecation of this template mode, these patterns
will be applied to the TemplateMode.HTML
template mode instead.
This is a convenience method equivalent to getLegacyHtml5TemplateModePatternSpec()
.getPatterns()
@Deprecated public final void setLegacyHtml5TemplateModePatterns(Set<String> newLegacyHtml5TemplateModePatterns)
TemplateMode.XML
template mode instead.
Will be removed in 3.1
Sets the new patterns to be applied for establishing the deprecated LEGACYHTML5 (non-XML-formed HTML5 that needs HTML-to-XML conversion)
template mode as Strings. Note that, due to the deprecation of this template mode, these patterns
will be applied to the TemplateMode.HTML
template mode instead.
This is a convenience method equivalent to getLegacyHtml5TemplateModePatternSpec()
.setPatterns(Set<String>)
newLegacyHtml5TemplateModePatterns
- the new patterns@Deprecated public final PatternSpec getHtml5TemplateModePatternSpec()
TemplateMode.XML
template mode instead.
Will be removed in 3.1
Returns the pattern spec specified for establishing the deprecated HTML5 (correct, XML-formed HTML5)
template mode to resolved templates. Note that, due to the deprecation of this template mode, these patterns
will be applied to the TemplateMode.HTML
template mode instead.
@Deprecated public final Set<String> getHtml5TemplateModePatterns()
TemplateMode.XML
template mode instead.
Will be removed in 3.1
Returns the patterns specified for establishing the deprecated HTML5 (correct, XML-formed HTML5)
template mode to resolved templates. Note that, due to the deprecation of this template mode, these patterns
will be applied to the TemplateMode.HTML
template mode instead.
This is a convenience method equivalent to getHtml5TemplateModePatternSpec()
.getPatterns()
@Deprecated public final void setHtml5TemplateModePatterns(Set<String> newHtml5TemplateModePatterns)
TemplateMode.XML
template mode instead.
Will be removed in 3.1
Sets the new patterns to be applied for establishing the deprecated HTML5 (correct, XML-formed HTML5)
template mode as Strings. Note that, due to the deprecation of this template mode, these patterns
will be applied to the TemplateMode.HTML
template mode instead.
This is a convenience method equivalent to getHtml5TemplateModePatternSpec()
.setPatterns(Set<String>)
newHtml5TemplateModePatterns
- the new patternspublic final PatternSpec 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.
public final Set<String> 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()
public final void setCacheablePatterns(Set<String> cacheablePatterns)
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>)
cacheablePatterns
- the new patternspublic final PatternSpec 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.
public final Set<String> 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()
public final void setNonCacheablePatterns(Set<String> nonCacheablePatterns)
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>)
nonCacheablePatterns
- the new patternsprotected String computeResourceName(IEngineConfiguration configuration, String ownerTemplate, String template, String prefix, String suffix, 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).
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.templateAliases
- the template aliases map.templateResolutionAttributes
- the template resolution attributes, if any. Might be null.protected TemplateMode computeTemplateMode(IEngineConfiguration configuration, String ownerTemplate, String template, Map<String,Object> templateResolutionAttributes)
AbstractTemplateResolver
Computes the template mode that should be applied to a template, according to existing configuration.
computeTemplateMode
in class AbstractTemplateResolver
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.protected ICacheEntryValidity computeValidity(IEngineConfiguration configuration, String ownerTemplate, String template, Map<String,Object> templateResolutionAttributes)
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.
computeValidity
in class AbstractTemplateResolver
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.protected final ITemplateResource computeTemplateResource(IEngineConfiguration configuration, String ownerTemplate, String template, Map<String,Object> templateResolutionAttributes)
AbstractTemplateResolver
Computes the resolved template resource.
computeTemplateResource
in class AbstractTemplateResolver
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.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.
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.Copyright © 2015 The THYMELEAF team. All rights reserved.