public static class MarkupTemplateEngine.CachingTemplateResolver
extends MarkupTemplateEngine.DefaultTemplateResolver
A template resolver which avoids calling ClassLoader.getResource if a template path already has been queried before. This improves performance if caching is enabled in the configuration.
| Constructor and description |
|---|
CachingTemplateResolver(Map<String, URL> cache)Creates a new caching template resolver. |
CachingTemplateResolver()Creates a new caching template resolver using a concurrent hash map as the backing cache. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
configure(ClassLoader templateClassLoader, TemplateConfiguration configuration)* * This method is called once the template engine is initialized, providing the resolver with the * template engine configuration and its template class loader. *
|
|
public URL |
resolveTemplate(String templatePath)* * Resolvers must implement this method in order to resolve a template, given a template path. They * must return a valid URL or an IOException. *
|
| Methods inherited from class | Name |
|---|---|
class MarkupTemplateEngine.DefaultTemplateResolver |
configure, resolveTemplate |
Indicates whether this resolver should consult and populate its cache.
Creates a new caching template resolver. The cache implementation being used depends on the use of the template engine. If multiple templates can be rendered in parallel, it must be using a thread-safe cache.
cache - the backing cacheCreates a new caching template resolver using a concurrent hash map as the backing cache.
* * This method is called once the template engine is initialized, providing the resolver with the * template engine configuration and its template class loader. *
templateClassLoader - the classloader where templates will be searched for
*configuration - the configuration of the template engine* * Resolvers must implement this method in order to resolve a template, given a template path. They * must return a valid URL or an IOException. *
templatePath - path to the template
*Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.