public abstract class ResourceTransformerSupport extends Object implements ResourceTransformer
ResourceTransformer
with an optional helper method
for resolving public links within a transformed resource.Constructor and Description |
---|
ResourceTransformerSupport() |
Modifier and Type | Method and Description |
---|---|
ResourceUrlProvider |
getResourceUrlProvider()
Return the configured
ResourceUrlProvider . |
protected reactor.core.publisher.Mono<String> |
resolveUrlPath(String resourcePath,
ServerWebExchange exchange,
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. |
protected String |
toAbsolutePath(String path,
ServerWebExchange exchange)
Transform the given relative request path to an absolute path,
taking the path of the given request as a point of reference.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
transform
public void setResourceUrlProvider(@Nullable 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 and not for
relative links.resourceUrlProvider
- the URL provider to use@Nullable public ResourceUrlProvider getResourceUrlProvider()
ResourceUrlProvider
.protected reactor.core.publisher.Mono<String> resolveUrlPath(String resourcePath, ServerWebExchange exchange, Resource resource, ResourceTransformerChain transformerChain)
resourcePath
- the path to a resource that needs to be re-writtenexchange
- the current exchangeresource
- the resource being transformedtransformerChain
- the transformer chainMono
protected String toAbsolutePath(String path, ServerWebExchange exchange)
path
- the relative path to transformexchange
- the current exchange