public class CssLinkResourceTransformer extends ResourceTransformerSupport
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.
Modifier and Type | Class and Description |
---|---|
protected static class |
CssLinkResourceTransformer.AbstractCssLinkParser |
protected static interface |
CssLinkResourceTransformer.CssLinkParser |
Constructor and Description |
---|
CssLinkResourceTransformer() |
Modifier and Type | Method and Description |
---|---|
Resource |
transform(HttpServletRequest request,
Resource resource,
ResourceTransformerChain transformerChain)
Transform the given resource.
|
getResourceUrlProvider, resolveUrlPath, setResourceUrlProvider
public Resource transform(HttpServletRequest request, Resource resource, ResourceTransformerChain transformerChain) throws java.io.IOException
ResourceTransformer
request
- the current requestresource
- the resource to transformtransformerChain
- the chain of remaining transformers to delegate tonull
java.io.IOException
- if the transformation fails