public class CachingResourceResolver extends AbstractResourceResolver
ResourceResolver
that resolves resources from a Cache
or
otherwise delegates to the resolver chain and caches the result.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(ServerWebExchange exchange,
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 reactor.core.publisher.Mono<Resource> |
resolveResourceInternal(ServerWebExchange exchange,
java.lang.String requestPath,
java.util.List<? extends Resource> locations,
ResourceResolverChain chain) |
protected reactor.core.publisher.Mono<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 reactor.core.publisher.Mono<Resource> resolveResourceInternal(@Nullable ServerWebExchange exchange, java.lang.String requestPath, java.util.List<? extends Resource> locations, ResourceResolverChain chain)
resolveResourceInternal
in class AbstractResourceResolver
protected java.lang.String computeKey(@Nullable ServerWebExchange exchange, java.lang.String requestPath)
protected reactor.core.publisher.Mono<java.lang.String> resolveUrlPathInternal(java.lang.String resourceUrlPath, java.util.List<? extends Resource> locations, ResourceResolverChain chain)
resolveUrlPathInternal
in class AbstractResourceResolver