Class CssLinkResourceTransformer
- java.lang.Object
- org.springframework.web.reactive.resource.ResourceTransformerSupport
- org.springframework.web.reactive.resource.CssLinkResourceTransformer
- All Implemented Interfaces:
ResourceTransformer
public class CssLinkResourceTransformer extends ResourceTransformerSupport
AResourceTransformerimplementation that modifies links in a CSS file to match the public URL paths that should be exposed to clients (e.g. with an MD5 content-based hash inserted in the URL).The implementation looks for links in CSS
@importstatements and also inside CSSurl()functions. All links are then passed through theResourceResolverChainand resolved relative to the location of the containing CSS file. If successfully resolved, the link is modified, otherwise the original link is preserved.- Since:
- 5.0
- Author:
- Rossen Stoyanchev
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classCssLinkResourceTransformer.AbstractLinkParserAbstract base class forCssLinkResourceTransformer.LinkParserimplementations.protected static interfaceCssLinkResourceTransformer.LinkParserExtract content chunks that represent links.
Constructor Summary
Constructors Constructor Description CssLinkResourceTransformer()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description reactor.core.publisher.Mono<Resource>transform(ServerWebExchange exchange, Resource inputResource, ResourceTransformerChain transformerChain)Transform the given resource.Methods inherited from class org.springframework.web.reactive.resource.ResourceTransformerSupport
getResourceUrlProvider, resolveUrlPath, setResourceUrlProvider, toAbsolutePath
Constructor Detail
CssLinkResourceTransformer
public CssLinkResourceTransformer()
Method Detail
transform
public reactor.core.publisher.Mono<Resource> transform(ServerWebExchange exchange, Resource inputResource, ResourceTransformerChain transformerChain)
Description copied from interface:ResourceTransformerTransform the given resource.- Parameters:
exchange- the current exchangeinputResource- the resource to transformtransformerChain- the chain of remaining transformers to delegate to- Returns:
- the transformed resource (never empty)