Class CachingResourceTransformer
java.lang.Object
org.springframework.web.reactive.resource.CachingResourceTransformer
- All Implemented Interfaces:
ResourceTransformer
A
ResourceTransformer
that checks a Cache
to see if a
previously transformed resource exists in the cache and returns it if found,
or otherwise delegates to the resolver chain and caches the result.- Since:
- 5.0
- Author:
- Rossen Stoyanchev
-
Constructor Summary
ConstructorDescriptionCachingResourceTransformer
(Cache cache) CachingResourceTransformer
(CacheManager cacheManager, String cacheName) -
Method Summary
Modifier and TypeMethodDescriptiongetCache()
Return the configuredCache
.reactor.core.publisher.Mono<Resource>
transform
(ServerWebExchange exchange, Resource resource, ResourceTransformerChain transformerChain) Transform the given resource.
-
Constructor Details
-
CachingResourceTransformer
-
CachingResourceTransformer
-
-
Method Details
-
getCache
Return the configuredCache
. -
transform
public reactor.core.publisher.Mono<Resource> transform(ServerWebExchange exchange, Resource resource, ResourceTransformerChain transformerChain) Description copied from interface:ResourceTransformer
Transform the given resource.- Specified by:
transform
in interfaceResourceTransformer
- Parameters:
exchange
- the current exchangeresource
- the resource to transformtransformerChain
- the chain of remaining transformers to delegate to- Returns:
- the transformed resource (never empty)
-