Class BroadleafCachingResourceResolver
java.lang.Object
org.springframework.web.servlet.resource.AbstractResourceResolver
org.broadleafcommerce.common.web.resource.resolver.BroadleafCachingResourceResolver
- All Implemented Interfaces:
org.springframework.core.Ordered,org.springframework.web.servlet.resource.ResourceResolver
@Component("blCacheResourceResolver")
public class BroadleafCachingResourceResolver
extends org.springframework.web.servlet.resource.AbstractResourceResolver
implements org.springframework.core.Ordered
A ResourceResolver that handles using the theme as part of the cache key and adds in
support to disable with environment properties.
We bypass CachingResourceResolver and instead borrow its code in order to be
able to inject the theme key that is needed by BLC since Spring's class could not be
leveraged otherwise.
- Since:
- Broadleaf 4.0
- Author:
- Brian Polster
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BroadleafContextUtilstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected booleanFields inherited from class org.springframework.web.servlet.resource.AbstractResourceResolver
loggerFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionBroadleafCachingResourceResolver(org.springframework.cache.Cache cache) BroadleafCachingResourceResolver(org.springframework.cache.CacheManager cacheManager) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcomputeKey(jakarta.servlet.http.HttpServletRequest request, String requestPath) Pulled fromCachingResourceResolverorg.springframework.cache.CachegetCache()Return the configuredCache.intgetOrder()protected StringReturns the theme path from theBroadleafRequestContextor an empty string if no theme was resolvedprotected voidlogNullReferenceUrlPatchMatch(String resourceUrlPath) protected org.springframework.core.io.ResourceresolveResourceInternal(jakarta.servlet.http.HttpServletRequest request, String requestPath, List<? extends org.springframework.core.io.Resource> locations, org.springframework.web.servlet.resource.ResourceResolverChain chain) protected StringresolveUrlPathInternal(String resourceUrlPath, List<? extends org.springframework.core.io.Resource> locations, org.springframework.web.servlet.resource.ResourceResolverChain chain) voidsetOrder(int order) Methods inherited from class org.springframework.web.servlet.resource.AbstractResourceResolver
resolveResource, resolveUrlPath
-
Field Details
-
RESOLVED_RESOURCE_CACHE_KEY_PREFIX
- See Also:
-
RESOLVED_URL_PATH_CACHE_KEY_PREFIX
- See Also:
-
RESOLVED_RESOURCE_CACHE_KEY_PREFIX_NULL
- See Also:
-
RESOLVED_URL_PATH_CACHE_KEY_PREFIX_NULL
- See Also:
-
blcContextUtil
-
resourceCachingEnabled
@Value("${resource.caching.enabled:true}") protected boolean resourceCachingEnabled
-
-
Constructor Details
-
BroadleafCachingResourceResolver
@Autowired public BroadleafCachingResourceResolver(@Qualifier("blSpringCacheManager") org.springframework.cache.CacheManager cacheManager) -
BroadleafCachingResourceResolver
public BroadleafCachingResourceResolver(org.springframework.cache.Cache cache)
-
-
Method Details
-
getCache
public org.springframework.cache.Cache getCache()Return the configuredCache. -
resolveResourceInternal
protected org.springframework.core.io.Resource resolveResourceInternal(jakarta.servlet.http.HttpServletRequest request, String requestPath, List<? extends org.springframework.core.io.Resource> locations, org.springframework.web.servlet.resource.ResourceResolverChain chain) - Specified by:
resolveResourceInternalin classorg.springframework.web.servlet.resource.AbstractResourceResolver
-
computeKey
Pulled fromCachingResourceResolver- Parameters:
request-requestPath-- Returns:
-
resolveUrlPathInternal
protected String resolveUrlPathInternal(String resourceUrlPath, List<? extends org.springframework.core.io.Resource> locations, org.springframework.web.servlet.resource.ResourceResolverChain chain) - Specified by:
resolveUrlPathInternalin classorg.springframework.web.servlet.resource.AbstractResourceResolver
-
logNullReferenceUrlPatchMatch
-
getThemePathFromBRC
Returns the theme path from theBroadleafRequestContextor an empty string if no theme was resolved- Returns:
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
setOrder
public void setOrder(int order)
-