Interface ResourceResolver
- All Known Implementing Classes:
AbstractResourceResolver
,CachingResourceResolver
,EncodedResourceResolver
,LiteWebJarsResourceResolver
,PathResourceResolver
,VersionResourceResolver
,WebJarsResourceResolver
public interface ResourceResolver
A strategy for resolving a request to a server-side resource.
Provides mechanisms for resolving an incoming request to an actual
Resource
and for obtaining the
public URL path that clients should use when requesting the resource.
- Since:
- 4.1
- Author:
- Jeremy Grelle, Rossen Stoyanchev, Sam Brannen
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionresolveResource
(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.resolveUrlPath
(String resourcePath, 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.
-
Method Details
-
resolveResource
@Nullable Resource resolveResource(@Nullable 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.- Parameters:
request
- the current request (may not be present in some calls)requestPath
- 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
@Nullable String resolveUrlPath(String resourcePath, 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.This is useful when rendering URL links to clients.
- Parameters:
resourcePath
- 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
-