Class ResourceTransformerSupport

  • java.lang.Object
    • org.springframework.web.reactive.resource.ResourceTransformerSupport
    • Constructor Detail

      • ResourceTransformerSupport

        public ResourceTransformerSupport()
    • Method Detail

      • setResourceUrlProvider

        public void setResourceUrlProvider(@Nullable
                                           ResourceUrlProvider resourceUrlProvider)
        Configure a 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
      • resolveUrlPath

        protected reactor.core.publisher.Mono<java.lang.String> resolveUrlPath(java.lang.String resourcePath,
                                                                               ServerWebExchange exchange,
                                                                               Resource resource,
                                                                               ResourceTransformerChain transformerChain)
        A transformer can use this method when a resource being transformed contains links to other resources. Such links need to be replaced with the public facing link as determined by the resource resolver chain (e.g. the public URL may have a version inserted).
        resourcePath - the path to a resource that needs to be re-written
        exchange - the current exchange
        resource - the resource being transformed
        transformerChain - the transformer chain
        the resolved URL or an empty Mono
      • toAbsolutePath

        protected java.lang.String toAbsolutePath(java.lang.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. The resulting path is also cleaned from sequences like "path/..".
        path - the relative path to transform
        exchange - the current exchange
        the absolute request path for the given resource path