Class AbstractResourceResolver
- java.lang.Object
- org.springframework.web.servlet.resource.AbstractResourceResolver
- All Implemented Interfaces:
ResourceResolver
- Direct Known Subclasses:
CachingResourceResolver
,GzipResourceResolver
,PathResourceResolver
,VersionResourceResolver
,WebJarsResourceResolver
public abstract class AbstractResourceResolver extends Object implements ResourceResolver
Base class forResourceResolver
implementations. Provides consistent logging.- Since:
- 4.1
- Author:
- Rossen Stoyanchev
Constructor Summary
Constructors Constructor Description AbstractResourceResolver()
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Resource
resolveResource(HttpServletRequest request, String requestPath, List<? extends Resource> locations, ResourceResolverChain chain)
Resolve the supplied request and request path to aResource
that exists under one of the given resource locations.protected abstract Resource
resolveResourceInternal(HttpServletRequest request, String requestPath, List<? extends Resource> locations, ResourceResolverChain chain)
String
resolveUrlPath(String resourceUrlPath, List<? extends Resource> locations, ResourceResolverChain chain)
Resolve the externally facing public URL path for clients to use to access the resource that is located at the given internal resource path.protected abstract String
resolveUrlPathInternal(String resourceUrlPath, List<? extends Resource> locations, ResourceResolverChain chain)
Constructor Detail
AbstractResourceResolver
public AbstractResourceResolver()
Method Detail
resolveResource
public Resource resolveResource(HttpServletRequest request, String requestPath, List<? extends Resource> locations, ResourceResolverChain chain)
Description copied from interface:ResourceResolver
Resolve the supplied request and request path to aResource
that exists under one of the given resource locations.- Specified by:
resolveResource
in interfaceResourceResolver
- Parameters:
request
- the current requestrequestPath
- the portion of the request path to uselocations
- the locations to search in when looking up resourceschain
- the chain of remaining resolvers to delegate to- Returns:
- the resolved resource or
null
if unresolved
resolveUrlPath
public String resolveUrlPath(String resourceUrlPath, List<? extends Resource> locations, ResourceResolverChain chain)
Description copied from interface:ResourceResolver
Resolve the externally facing public URL path for clients to use to access the resource that is located at the given internal resource path.This is useful when rendering URL links to clients.
- Specified by:
resolveUrlPath
in interfaceResourceResolver
- Parameters:
resourceUrlPath
- the internal resource pathlocations
- the locations to search in when looking up resourceschain
- the chain of resolvers to delegate to- Returns:
- the resolved public URL path or
null
if unresolved
resolveResourceInternal
protected abstract Resource resolveResourceInternal(HttpServletRequest request, String requestPath, List<? extends Resource> locations, ResourceResolverChain chain)
resolveUrlPathInternal
protected abstract String resolveUrlPathInternal(String resourceUrlPath, List<? extends Resource> locations, ResourceResolverChain chain)