Class ResourceUrlProvider
- All Implemented Interfaces:
- EventListener,- Aware,- ApplicationContextAware,- ApplicationListener<ContextRefreshedEvent>
This class is aware of Spring WebFlux handler mappings used to serve static
 resources and uses the ResourceResolver chains of the configured
 ResourceHttpRequestHandlers to make its decisions.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev, Brian Clozel
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionfinal reactor.core.publisher.Mono<String> getForUriString(String uriString, ServerWebExchange exchange) Get the public resource URL for the given URI string.Return a read-only view of the resource handler mappings either manually configured or auto-detected from Spring configuration.voidHandle an application event.voidregisterHandlers(Map<String, ResourceWebHandler> handlerMap) Manually configure resource handler mappings.voidsetApplicationContext(ApplicationContext applicationContext) Set the ApplicationContext that this object runs in.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListenersupportsAsyncExecution
- 
Constructor Details- 
ResourceUrlProviderpublic ResourceUrlProvider()
 
- 
- 
Method Details- 
setApplicationContextDescription copied from interface:ApplicationContextAwareSet the ApplicationContext that this object runs in. Normally this call will be used to initialize the object.Invoked after population of normal bean properties but before an init callback such as InitializingBean.afterPropertiesSet()or a custom init-method. Invoked afterResourceLoaderAware.setResourceLoader(org.springframework.core.io.ResourceLoader),ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher)andMessageSourceAware, if applicable.- Specified by:
- setApplicationContextin interface- ApplicationContextAware
- Parameters:
- applicationContext- the ApplicationContext object to be used by this object
- Throws:
- BeansException- if thrown by application context methods
- See Also:
 
- 
getHandlerMapReturn a read-only view of the resource handler mappings either manually configured or auto-detected from Spring configuration.
- 
registerHandlersManually 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.
- 
onApplicationEventDescription copied from interface:ApplicationListenerHandle an application event.- Specified by:
- onApplicationEventin interface- ApplicationListener<ContextRefreshedEvent>
- Parameters:
- event- the event to respond to
 
- 
getForUriStringpublic 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. - Parameters:
- uriString- the URI string to transform
- exchange- the current exchange
- Returns:
- the resolved public resource URL path, or empty if unresolved
 
 
-