类 ResourceUrlProvider
- java.lang.Object
- org.springframework.web.reactive.resource.ResourceUrlProvider
public class ResourceUrlProvider extends Object implements ApplicationListener<ContextRefreshedEvent>
A central component to use to obtain the public URL path that clients should use to access a static resource.This class is aware of Spring WebFlux handler mappings used to serve static resources and uses the
ResourceResolver
chains of the configuredResourceHttpRequestHandler
s to make its decisions.- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 ResourceUrlProvider()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 reactor.core.publisher.Mono<String>
getForUriString(String uriString, ServerWebExchange exchange)
Get the public resource URL for the given URI string.Map<PathPattern,ResourceWebHandler>
getHandlerMap()
Return a read-only view of the resource handler mappings either manually configured or auto-detected from Spring configuration.void
onApplicationEvent(ContextRefreshedEvent event)
Handle an application event.void
registerHandlers(Map<String,ResourceWebHandler> handlerMap)
Manually configure resource handler mappings.
构造器详细资料
ResourceUrlProvider
public ResourceUrlProvider()
方法详细资料
getHandlerMap
public Map<PathPattern,ResourceWebHandler> getHandlerMap()
Return a read-only view of the resource handler mappings either manually configured or auto-detected from Spring configuration.
registerHandlers
public void registerHandlers(Map<String,ResourceWebHandler> handlerMap)
Manually configure resource handler mappings.Note: by default resource mappings are auto-detected from the Spring
ApplicationContext
. If this property is used, auto-detection is turned off.
onApplicationEvent
public void onApplicationEvent(ContextRefreshedEvent event)
从接口复制的说明:ApplicationListener
Handle an application event.- 指定者:
onApplicationEvent
在接口中ApplicationListener<ContextRefreshedEvent>
- 参数:
event
- the event to respond to
getForUriString
public final reactor.core.publisher.Mono<String> getForUriString(String uriString, ServerWebExchange exchange)
Get the public resource URL for the given URI string.The URI string is expected to be a path and if it contains a query or fragment those will be preserved in the resulting public resource URL.
- 参数:
uriString
- the URI string to transformexchange
- the current exchange- 返回:
- the resolved public resource URL path, or empty if unresolved