Top Description Fields Constructors Methods
org.springframework.web.servlet.resource

public abstract Class AbstractResourceResolver

extends Object
implements ResourceResolver
Class Inheritance
All Implemented Interfaces
org.springframework.web.servlet.resource.ResourceResolver
Known Direct Subclasses
org.springframework.web.servlet.resource.CachingResourceResolver, org.springframework.web.servlet.resource.EncodedResourceResolver, org.springframework.web.servlet.resource.PathResourceResolver, org.springframework.web.servlet.resource.VersionResourceResolver, org.springframework.web.servlet.resource.WebJarsResourceResolver
Imports
java.util.List, jakarta.servlet.http.HttpServletRequest, org.apache.commons.logging.Log, .LogFactory, org.springframework.core.io.Resource, org.springframework.lang.Nullable

Base class for org.springframework.web.servlet.resource.ResourceResolver implementations. Provides consistent logging.
Author
Rossen Stoyanchev
Since
4.1

Field Summary

Modifier and TypeField and Description
protected final Log

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Resource
resolveResource(HttpServletRequest
the current request (may not be present in some calls)
request
,
String
the portion of the request path to use
requestPath
,
List<? extends Resource>
the locations to search in when looking up resources
locations
,
ResourceResolverChain
the chain of remaining resolvers to delegate to
chain
)

Implements org.springframework.web.servlet.resource.ResourceResolver.resolveResource.

Resolve the supplied request and request path to a Resource that exists under one of the given resource locations.

protected abstract Resource
resolveResourceInternal(HttpServletRequest request, String requestPath, List<? extends Resource> locations, ResourceResolverChain chain)

public String
resolveUrlPath(String
the internal resource path
resourceUrlPath
,
List<? extends Resource>
the locations to search in when looking up resources
locations
,
ResourceResolverChain
the chain of resolvers to delegate to
chain
)

Implements org.springframework.web.servlet.resource.ResourceResolver.resolveUrlPath.

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)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

loggerback to summary
protected final Log logger

Constructor Detail

AbstractResourceResolverback to summary
public AbstractResourceResolver()

Method Detail

resolveResourceback to summary
public Resource resolveResource(HttpServletRequest request, String requestPath, List<? extends Resource> locations, ResourceResolverChain chain)

Implements org.springframework.web.servlet.resource.ResourceResolver.resolveResource.

Doc from org.springframework.web.servlet.resource.ResourceResolver.resolveResource.

Resolve the supplied request and request path to a Resource that exists under one of the given resource locations.

Parameters
request:HttpServletRequest

the current request (may not be present in some calls)

requestPath:String

the portion of the request path to use

locations:List<? extends Resource>

the locations to search in when looking up resources

chain:ResourceResolverChain

the chain of remaining resolvers to delegate to

Returns:Resource

the resolved resource, or null if unresolved

Annotations
@Override
@Nullable
resolveResourceInternalback to summary
protected abstract Resource resolveResourceInternal(HttpServletRequest request, String requestPath, List<? extends Resource> locations, ResourceResolverChain chain)
Annotations
@Nullable
resolveUrlPathback to summary
public String resolveUrlPath(String resourceUrlPath, List<? extends Resource> locations, ResourceResolverChain chain)

Implements org.springframework.web.servlet.resource.ResourceResolver.resolveUrlPath.

Doc from org.springframework.web.servlet.resource.ResourceResolver.resolveUrlPath.

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
resourceUrlPath:String

the internal resource path

locations:List<? extends Resource>

the locations to search in when looking up resources

chain:ResourceResolverChain

the chain of resolvers to delegate to

Returns:String

the resolved public URL path, or null if unresolved

Annotations
@Override
@Nullable
resolveUrlPathInternalback to summary
protected abstract String resolveUrlPathInternal(String resourceUrlPath, List<? extends Resource> locations, ResourceResolverChain chain)
Annotations
@Nullable