public class CachingResourceResolver extends AbstractResourceResolver
ResourceResolver
that
resolves resources from a Cache
or otherwise
delegates to the resolver chain and saves the result in the cache.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
RESOLVED_RESOURCE_CACHE_KEY_PREFIX
The prefix used for resolved resource cache keys.
|
static java.lang.String |
RESOLVED_URL_PATH_CACHE_KEY_PREFIX
The prefix used for resolved URL path cache keys.
|
logger
Constructor and Description |
---|
CachingResourceResolver(Cache cache) |
CachingResourceResolver(CacheManager cacheManager,
java.lang.String cacheName) |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
computeKey(HttpServletRequest request,
java.lang.String requestPath) |
Cache |
getCache()
Return the configured
Cache . |
java.util.List<java.lang.String> |
getContentCodings()
Return a read-only list with the supported content codings.
|
protected Resource |
resolveResourceInternal(HttpServletRequest request,
java.lang.String requestPath,
java.util.List<? extends Resource> locations,
ResourceResolverChain chain) |
protected java.lang.String |
resolveUrlPathInternal(java.lang.String resourceUrlPath,
java.util.List<? extends Resource> locations,
ResourceResolverChain chain) |
void |
setContentCodings(java.util.List<java.lang.String> codings)
Configure the supported content codings from the
"Accept-Encoding" header for which to cache resource variations.
|
resolveResource, resolveUrlPath
public static final java.lang.String RESOLVED_RESOURCE_CACHE_KEY_PREFIX
public static final java.lang.String RESOLVED_URL_PATH_CACHE_KEY_PREFIX
public CachingResourceResolver(Cache cache)
public CachingResourceResolver(CacheManager cacheManager, java.lang.String cacheName)
public Cache getCache()
Cache
.public void setContentCodings(java.util.List<java.lang.String> codings)
The codings configured here are generally expected to match those
configured on EncodedResourceResolver.setContentCodings(List)
.
By default this property is set to ["br", "gzip"] based on
the value of EncodedResourceResolver.DEFAULT_CODINGS
.
codings
- one or more supported content codingspublic java.util.List<java.lang.String> getContentCodings()
protected Resource resolveResourceInternal(@Nullable HttpServletRequest request, java.lang.String requestPath, java.util.List<? extends Resource> locations, ResourceResolverChain chain)
resolveResourceInternal
in class AbstractResourceResolver
protected java.lang.String computeKey(@Nullable HttpServletRequest request, java.lang.String requestPath)
protected java.lang.String resolveUrlPathInternal(java.lang.String resourceUrlPath, java.util.List<? extends Resource> locations, ResourceResolverChain chain)
resolveUrlPathInternal
in class AbstractResourceResolver