org.springframework.web.reactive.resource

## Class WebJarsResourceResolver

- java.lang.Object
- - org.springframework.web.reactive.resource.AbstractResourceResolver
  - - org.springframework.web.reactive.resource.WebJarsResourceResolver

All Implemented Interfaces:
  ResourceResolver

    public class WebJarsResourceResolver
    extends AbstractResourceResolver

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="/jquery/jquery.min.js"/>`. This path will be resolved to the unique version `<script src="/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.

Since:
  5.0
Author:
  Rossen Stoyanchev, Brian Clozel
See Also:
  webjars.org

### Field Summary

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

`logger`

### Constructor Summary

Constructors
Constructor and Description
`WebJarsResourceResolver()` Create a `WebJarsResourceResolver` with a default `WebJarAssetLocator` instance.
`WebJarsResourceResolver(org.webjars.WebJarAssetLocator webJarAssetLocator)` Create a `WebJarsResourceResolver` with a custom `WebJarAssetLocator` instance, e.g.

### Method Summary

All Methods Instance Methods Concrete Methods
`protected String` `findWebJarResourcePath(String path)`
`protected reactor.core.publisher.Mono<org.springframework.core.io.Resource>` `resolveResourceInternal(org.springframework.web.server.ServerWebExchange exchange, String requestPath, List<? extends org.springframework.core.io.Resource> locations, ResourceResolverChain chain)`
`protected reactor.core.publisher.Mono<String>` `resolveUrlPathInternal(String resourceUrlPath, List<? extends org.springframework.core.io.Resource> locations, ResourceResolverChain chain)`

### Methods inherited from class org.springframework.web.reactive.resource.AbstractResourceResolver

`resolveResource, resolveUrlPath`

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

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

### Constructor Detail

#### WebJarsResourceResolver

    public WebJarsResourceResolver()

Create a `WebJarsResourceResolver` with a default `WebJarAssetLocator` instance.

#### WebJarsResourceResolver

    public WebJarsResourceResolver(org.webjars.WebJarAssetLocator webJarAssetLocator)

Create a `WebJarsResourceResolver` with a custom `WebJarAssetLocator` instance, e.g. with a custom index.

### Method Detail

#### resolveResourceInternal

    protected reactor.core.publisher.Mono<org.springframework.core.io.Resource> resolveResourceInternal(@Nullable
                                                                                                        org.springframework.web.server.ServerWebExchange exchange,
                                                                                                        String requestPath,
                                                                                                        List<? extends org.springframework.core.io.Resource> locations,
                                                                                                        ResourceResolverChain chain)

Specified by:
  `resolveResourceInternal` in class `AbstractResourceResolver`

#### resolveUrlPathInternal

    protected reactor.core.publisher.Mono<String> resolveUrlPathInternal(String resourceUrlPath,
                                                                         List<? extends org.springframework.core.io.Resource> locations,
                                                                         ResourceResolverChain chain)

Specified by:
  `resolveUrlPathInternal` in class `AbstractResourceResolver`

#### findWebJarResourcePath

    @Nullable
    protected String findWebJarResourcePath(String path)