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
A ResourceTransformer implementation 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 @import statements and also inside CSS url() functions. All links are then passed through the ResourceResolverChain and 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
  • Constructor Details

    • CssLinkResourceTransformer

      public CssLinkResourceTransformer()
  • Method Details

    • transform

      public reactor.core.publisher.Mono<Resource> transform(ServerWebExchange exchange, Resource inputResource, ResourceTransformerChain transformerChain)
      Description copied from interface: ResourceTransformer
      Transform the given resource.
      Parameters:
      exchange - the current exchange
      inputResource - the resource to transform
      transformerChain - the chain of remaining transformers to delegate to
      Returns:
      the transformed resource (never empty)