public class CachingResourceTransformer extends java.lang.Object implements ResourceTransformer
ResourceTransformer
that checks a
Cache
to see if a previously transformed resource
exists in the cache and returns it if found, and otherwise delegates to the resolver
chain and saves the result in the cache.Modifier and Type | Field and Description |
---|---|
private Cache |
cache |
private static Log |
logger |
Constructor and Description |
---|
CachingResourceTransformer(Cache cache) |
CachingResourceTransformer(CacheManager cacheManager,
java.lang.String cacheName) |
Modifier and Type | Method and Description |
---|---|
Cache |
getCache()
Return the configured
Cache . |
Resource |
transform(HttpServletRequest request,
Resource resource,
ResourceTransformerChain transformerChain)
Transform the given resource.
|
private static final Log logger
private final Cache cache
public CachingResourceTransformer(CacheManager cacheManager, java.lang.String cacheName)
public CachingResourceTransformer(Cache cache)
public Cache getCache()
Cache
.public Resource transform(HttpServletRequest request, Resource resource, ResourceTransformerChain transformerChain) throws java.io.IOException
ResourceTransformer
transform
in interface ResourceTransformer
request
- the current requestresource
- the resource to transformtransformerChain
- the chain of remaining transformers to delegate tonull
)java.io.IOException
- if the transformation fails