Class WebJarsResourceResolver
java.lang.Object
org.springframework.web.servlet.resource.AbstractResourceResolver
org.springframework.web.servlet.resource.WebJarsResourceResolver
- All Implemented Interfaces:
- ResourceResolver
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:
- 4.2
- Author:
- Brian Clozel
- See Also:
- 
Field SummaryFields inherited from class org.springframework.web.servlet.resource.AbstractResourceResolverlogger
- 
Constructor SummaryConstructorsConstructorDescriptionCreate aWebJarsResourceResolverwith a defaultWebJarAssetLocatorinstance.WebJarsResourceResolver(org.webjars.WebJarAssetLocator webJarAssetLocator) Create aWebJarsResourceResolverwith a customWebJarAssetLocatorinstance, e.g.
- 
Method SummaryModifier and TypeMethodDescriptionprotected StringfindWebJarResourcePath(String path) protected ResourceresolveResourceInternal(HttpServletRequest request, String requestPath, List<? extends Resource> locations, ResourceResolverChain chain) protected StringresolveUrlPathInternal(String resourceUrlPath, List<? extends Resource> locations, ResourceResolverChain chain) Methods inherited from class org.springframework.web.servlet.resource.AbstractResourceResolverresolveResource, resolveUrlPath
- 
Constructor Details- 
WebJarsResourceResolverpublic WebJarsResourceResolver()Create aWebJarsResourceResolverwith a defaultWebJarAssetLocatorinstance.
- 
WebJarsResourceResolverpublic WebJarsResourceResolver(org.webjars.WebJarAssetLocator webJarAssetLocator) Create aWebJarsResourceResolverwith a customWebJarAssetLocatorinstance, e.g. with a custom index.- Since:
- 4.3
 
 
- 
- 
Method Details- 
resolveResourceInternal@Nullable protected Resource resolveResourceInternal(@Nullable HttpServletRequest request, String requestPath, List<? extends Resource> locations, ResourceResolverChain chain) - Specified by:
- resolveResourceInternalin class- AbstractResourceResolver
 
- 
resolveUrlPathInternal@Nullable protected String resolveUrlPathInternal(String resourceUrlPath, List<? extends Resource> locations, ResourceResolverChain chain) - Specified by:
- resolveUrlPathInternalin class- AbstractResourceResolver
 
- 
findWebJarResourcePath
 
-