Class CachedScriptUrlTemplateScanner
- java.lang.Object
-
- org.craftercms.engine.scripting.impl.CachedScriptUrlTemplateScanner
-
- All Implemented Interfaces:
EventListener
,ScriptUrlTemplateScanner
,org.springframework.context.ApplicationListener<SiteContextInitializedEvent>
public class CachedScriptUrlTemplateScanner extends Object implements ScriptUrlTemplateScanner, org.springframework.context.ApplicationListener<SiteContextInitializedEvent>
ScriptUrlTemplateScanner
decorator that caches the result of an actual scan, and also pre-caches the URL templates on site context creation.- Author:
- avasquez
-
-
Field Summary
Fields Modifier and Type Field Description protected ScriptUrlTemplateScanner
actualScanner
protected org.craftercms.core.util.cache.CacheTemplate
cacheTemplate
static String
URL_TEMPLATES_CACHE_KEY_ELEM
-
Constructor Summary
Constructors Constructor Description CachedScriptUrlTemplateScanner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onApplicationEvent(SiteContextInitializedEvent event)
List<org.springframework.web.util.UriTemplate>
scan(SiteContext siteContext)
Scans the site context at a certain path to discover script URL templates.void
setActualScanner(ScriptUrlTemplateScanner actualScanner)
void
setCacheTemplate(org.craftercms.core.util.cache.CacheTemplate cacheTemplate)
-
-
-
Field Detail
-
URL_TEMPLATES_CACHE_KEY_ELEM
public static final String URL_TEMPLATES_CACHE_KEY_ELEM
- See Also:
- Constant Field Values
-
cacheTemplate
protected org.craftercms.core.util.cache.CacheTemplate cacheTemplate
-
actualScanner
protected ScriptUrlTemplateScanner actualScanner
-
-
Method Detail
-
setCacheTemplate
public void setCacheTemplate(org.craftercms.core.util.cache.CacheTemplate cacheTemplate)
-
setActualScanner
public void setActualScanner(ScriptUrlTemplateScanner actualScanner)
-
onApplicationEvent
public void onApplicationEvent(SiteContextInitializedEvent event)
- Specified by:
onApplicationEvent
in interfaceorg.springframework.context.ApplicationListener<SiteContextInitializedEvent>
-
scan
public List<org.springframework.web.util.UriTemplate> scan(SiteContext siteContext)
Description copied from interface:ScriptUrlTemplateScanner
Scans the site context at a certain path to discover script URL templates.- Specified by:
scan
in interfaceScriptUrlTemplateScanner
- Parameters:
siteContext
- the site context to scan- Returns:
- the list of URL templates
-
-