Package org.springframework.web.servlet.resource

# Class WebJarsResourceResolver

java.lang.Object
org.springframework.web.servlet.resource.AbstractResourceResolver
org.springframework.web.servlet.resource.WebJarsResourceResolver

All Implemented Interfaces:
  `ResourceResolver`

@Deprecated(since="6.2", forRemoval=true) public class WebJarsResourceResolver extends AbstractResourceResolver
Deprecated, for removal: This API element is subject to removal in a future version.
as of 6.2, in favor of `LiteWebJarsResourceResolver`
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, Sebastien Deleuze
See Also:
  - `ResourceChainRegistration`
  - webjars.org
  - `LiteWebJarsResourceResolver`

## Field Summary

### Fields inherited from class org.springframework.web.servlet.resource.AbstractResourceResolver

`logger`

## Constructor Summary

Constructors
Constructor
Description
`WebJarsResourceResolver()`
Deprecated, for removal: This API element is subject to removal in a future version.
Create a `WebJarsResourceResolver` with a default `WebJarAssetLocator` instance.
`WebJarsResourceResolver(org.webjars.WebJarAssetLocator webJarAssetLocator)`
Deprecated, for removal: This API element is subject to removal in a future version.
Create a `WebJarsResourceResolver` with a custom `WebJarAssetLocator` instance, for example, with a custom index.

## Method Summary

Modifier and Type
Method
Description
`protected String`
`findWebJarResourcePath(String path)`
Deprecated, for removal: This API element is subject to removal in a future version.
`protected org.springframework.core.io.Resource`
`resolveResourceInternal(HttpServletRequest request, String requestPath, List<? extends org.springframework.core.io.Resource> locations, ResourceResolverChain chain)`
Deprecated, for removal: This API element is subject to removal in a future version.
`protected String`
`resolveUrlPathInternal(String resourceUrlPath, List<? extends org.springframework.core.io.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.servlet.resource.AbstractResourceResolver

`resolveResource, resolveUrlPath`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### WebJarsResourceResolver

public WebJarsResourceResolver()
Deprecated, for removal: This API element is subject to removal in a future version.
Create a `WebJarsResourceResolver` with a default `WebJarAssetLocator` instance.

### WebJarsResourceResolver

public WebJarsResourceResolver(org.webjars.WebJarAssetLocator webJarAssetLocator)
Deprecated, for removal: This API element is subject to removal in a future version.
Create a `WebJarsResourceResolver` with a custom `WebJarAssetLocator` instance, for example, with a custom index.

Since:
  4.3

## Method Details

### resolveResourceInternal

@Nullable protected org.springframework.core.io.Resource resolveResourceInternal(@Nullable HttpServletRequest request, String requestPath, List<? extends org.springframework.core.io.Resource> locations, ResourceResolverChain chain)
Deprecated, for removal: This API element is subject to removal in a future version.

Specified by:
  `resolveResourceInternal` in class `AbstractResourceResolver`

### resolveUrlPathInternal

@Nullable protected String resolveUrlPathInternal(String resourceUrlPath, List<? extends org.springframework.core.io.Resource> locations, ResourceResolverChain chain)
Deprecated, for removal: This API element is subject to removal in a future version.

Specified by:
  `resolveUrlPathInternal` in class `AbstractResourceResolver`

### findWebJarResourcePath

@Nullable protected String findWebJarResourcePath(String path)
Deprecated, for removal: This API element is subject to removal in a future version.