public abstract class ResourceTransformerSupport extends java.lang.Object implements ResourceTransformer
ResourceTransformer
with an optional helper method
for resolving public links within a transformed resource.Modifier and Type | Field and Description |
---|---|
private ResourceUrlProvider |
resourceUrlProvider |
Constructor and Description |
---|
ResourceTransformerSupport() |
Modifier and Type | Method and Description |
---|---|
private ResourceUrlProvider |
findResourceUrlProvider(HttpServletRequest request) |
ResourceUrlProvider |
getResourceUrlProvider() |
protected java.lang.String |
resolveUrlPath(java.lang.String resourcePath,
HttpServletRequest request,
Resource resource,
ResourceTransformerChain transformerChain)
A transformer can use this method when a resource being transformed
contains links to other resources.
|
void |
setResourceUrlProvider(ResourceUrlProvider resourceUrlProvider)
Configure a
ResourceUrlProvider to use when resolving the public
URL of links in a transformed resource (e.g. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
transform
private ResourceUrlProvider resourceUrlProvider
public void setResourceUrlProvider(ResourceUrlProvider resourceUrlProvider)
ResourceUrlProvider
to use when resolving the public
URL of links in a transformed resource (e.g. import links in a CSS file).
This is required only for links expressed as full paths, i.e. including
context and servlet path, and not for relative links.
By default this property is not set. In that case if a
ResourceUrlProvider
is needed an attempt is made to find the
ResourceUrlProvider
exposed through the
ResourceUrlProviderExposingInterceptor
(configured by default in the MVC
Java config and XML namespace). Therefore explicitly configuring this
property should not be needed in most cases.
resourceUrlProvider
- the URL provider to usepublic ResourceUrlProvider getResourceUrlProvider()
ResourceUrlProvider
.protected java.lang.String resolveUrlPath(java.lang.String resourcePath, HttpServletRequest request, Resource resource, ResourceTransformerChain transformerChain)
resourcePath
- the path to a resource that needs to be re-writtenrequest
- the current requestresource
- the resource being transformedtransformerChain
- the transformer chainprivate ResourceUrlProvider findResourceUrlProvider(HttpServletRequest request)