Class WebJarsResourceResolver
java.lang.Object
org.springframework.web.reactive.resource.AbstractResourceResolver
org.springframework.web.reactive.resource.WebJarsResourceResolver
- All Implemented Interfaces:
ResourceResolver
Deprecated, for removal: This API element is subject to removal in a future version.
A
ResourceResolver
that delegates to the chain to locate a resource and then
attempts to find a matching versioned resource contained in a WebJar JAR file.
This allows WebJars.org users to write version agnostic paths in their templates,
like <script src="/webjars/jquery/jquery.min.js"/>
.
This path will be resolved to the unique version <script src="/webjars/jquery/1.2.0/jquery.min.js"/>
,
which is a better fit for HTTP caching and version management in applications.
This also resolves resources for version agnostic HTTP requests "GET /jquery/jquery.min.js"
.
This resolver requires the org.webjars:webjars-locator-core
library
on the classpath and is automatically registered if that library is present.
Be aware that WebJarAssetLocator
constructor performs a classpath scanning that
could slow down application startup.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev, Brian Clozel
- See Also:
-
Field Summary
Fields inherited from class org.springframework.web.reactive.resource.AbstractResourceResolver
logger
-
Constructor Summary
ConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Create aWebJarsResourceResolver
with a defaultWebJarAssetLocator
instance.WebJarsResourceResolver
(org.webjars.WebJarAssetLocator webJarAssetLocator) Deprecated, for removal: This API element is subject to removal in a future version.Create aWebJarsResourceResolver
with a customWebJarAssetLocator
instance, e.g. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
findWebJarResourcePath
(String path) Deprecated, for removal: This API element is subject to removal in a future version.protected reactor.core.publisher.Mono<Resource>
resolveResourceInternal
(ServerWebExchange exchange, String requestPath, List<? extends Resource> locations, ResourceResolverChain chain) Deprecated, for removal: This API element is subject to removal in a future version.protected reactor.core.publisher.Mono<String>
resolveUrlPathInternal
(String resourceUrlPath, List<? extends Resource> locations, ResourceResolverChain chain) Deprecated, for removal: This API element is subject to removal in a future version.Methods inherited from class org.springframework.web.reactive.resource.AbstractResourceResolver
resolveResource, resolveUrlPath
-
Constructor Details
-
WebJarsResourceResolver
public WebJarsResourceResolver()Deprecated, for removal: This API element is subject to removal in a future version.Create aWebJarsResourceResolver
with a defaultWebJarAssetLocator
instance. -
WebJarsResourceResolver
public WebJarsResourceResolver(org.webjars.WebJarAssetLocator webJarAssetLocator) Deprecated, for removal: This API element is subject to removal in a future version.Create aWebJarsResourceResolver
with a customWebJarAssetLocator
instance, e.g. with a custom index.
-
-
Method Details
-
resolveResourceInternal
protected reactor.core.publisher.Mono<Resource> resolveResourceInternal(@Nullable ServerWebExchange exchange, String requestPath, List<? extends Resource> locations, ResourceResolverChain chain) Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
resolveResourceInternal
in classAbstractResourceResolver
-
resolveUrlPathInternal
protected reactor.core.publisher.Mono<String> resolveUrlPathInternal(String resourceUrlPath, List<? extends Resource> locations, ResourceResolverChain chain) Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
resolveUrlPathInternal
in classAbstractResourceResolver
-
findWebJarResourcePath
Deprecated, for removal: This API element is subject to removal in a future version.
-
LiteWebJarsResourceResolver