接口 ResourceResolver
- 所有已知实现类:
AbstractResourceResolver
,CachingResourceResolver
,EncodedResourceResolver
,GzipResourceResolver
,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.- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 reactor.core.publisher.Mono<Resource>
resolveResource(ServerWebExchange exchange, 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.reactor.core.publisher.Mono<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.
方法详细资料
resolveResource
reactor.core.publisher.Mono<Resource> resolveResource(@Nullable ServerWebExchange exchange, 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.- 参数:
exchange
- the current exchangerequestPath
- the portion of the request path to use. This is expected to be the encoded path, i.e.PathContainer.value()
.locations
- the locations to search in when looking up resourceschain
- the chain of remaining resolvers to delegate to- 返回:
- the resolved resource or an empty
Mono
if unresolved
resolveUrlPath
reactor.core.publisher.Mono<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.
- 参数:
resourcePath
- the "internal" resource path to resolve a path for public use. This is expected to be the encoded path.locations
- the locations to search in when looking up resourceschain
- the chain of resolvers to delegate to- 返回:
- the resolved public URL path or an empty
Mono
if unresolved