Example usage for org.springframework.web.servlet.resource ResourceTransformerChain getResolverChain

List of usage examples for org.springframework.web.servlet.resource ResourceTransformerChain getResolverChain

Introduction

In this page you can find the example usage for org.springframework.web.servlet.resource ResourceTransformerChain getResolverChain.

Prototype

ResourceResolverChain getResolverChain();

Source Link

Document

Return the ResourceResolverChain that was used to resolve the Resource being transformed.

Usage

From source file:org.springframework.web.servlet.resource.AppCacheManifestTransformer.java

private LineOutput processLine(LineInfo info, HttpServletRequest request, Resource resource,
        ResourceTransformerChain transformerChain) {

    if (!info.isLink()) {
        return new LineOutput(info.getLine(), null);
    }/*w  ww . j  a v  a 2 s.  c o  m*/

    Resource appCacheResource = transformerChain.getResolverChain().resolveResource(null, info.getLine(),
            Collections.singletonList(resource));

    String path = info.getLine();
    String absolutePath = toAbsolutePath(path, request);
    String newPath = resolveUrlPath(absolutePath, request, resource, transformerChain);

    if (logger.isTraceEnabled()) {
        if (newPath != null && !newPath.equals(path)) {
            logger.trace("Link modified: " + path + " (original: " + path + ")");
        } else {
            logger.trace("Link not modified: " + path);
        }
    }

    return new LineOutput((newPath != null ? newPath : path), appCacheResource);
}