类 ResourceTransformerSupport

    • 方法详细资料

      • setResourceUrlProvider

        public void setResourceUrlProvider​(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, 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 use
      • resolveUrlPath

        protected String resolveUrlPath​(String resourcePath,
                                        HttpServletRequest request,
                                        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
        request - the current request
        resource - the resource being transformed
        transformerChain - the transformer chain
        返回:
        the resolved URL, or if not resolvable