Top Description Interfaces Classes
module spring.webmvc

Package org.springframework.web.servlet.resource

Annotations
@NonNullApi
@NonNullFields
Imports
org.springframework.lang.NonNullApi, .NonNullFields

Support classes for serving static resources.

Interface Summary

Modifier and TypeInterface and Description
public interface
HttpResource

Extended interface for a Resource to be written to an HTTP response.

public interface
ResourceResolver

A strategy for resolving a request to a server-side resource.

public interface
ResourceResolverChain

A contract for invoking a chain of ResourceResolvers where each resolver is given a reference to the chain allowing it to delegate when necessary.

public interface
ResourceTransformer

An abstraction for transforming the content of a resource.

public interface
ResourceTransformerChain

A contract for invoking a chain of ResourceTransformers where each resolver is given a reference to the chain allowing it to delegate when necessary.

public interface
VersionPathStrategy

A strategy for extracting and embedding a resource version in its URL path.

public interface
VersionStrategy

An extension of VersionPathStrategy that adds a method to determine the actual version of a Resource.

Class Summary

Modifier and TypeClass and Description
public abstract class
public abstract class
AbstractVersionStrategy

Abstract base class for VersionStrategy implementations.

public class
CachingResourceResolver

A org.springframework.web.servlet.resource.ResourceResolver that resolves resources from a org.springframework.cache.Cache or otherwise delegates to the resolver chain and saves the result in the cache.

public class
CachingResourceTransformer

A org.springframework.web.servlet.resource.ResourceTransformer that checks a org.springframework.cache.Cache to see if a previously transformed resource exists in the cache and returns it if found, and otherwise delegates to the resolver chain and saves the result in the cache.

public class
ContentVersionStrategy

A VersionStrategy that calculates a Hex MD5 hash from the content of the resource and appends it to the file name, e.g. "styles/main-e36d2e05253c6c7085a91522ce43a0b4.css".

public class
CssLinkResourceTransformer

A ResourceTransformer implementation that modifies links in a CSS file to match the public URL paths that should be exposed to clients (e.g. with an MD5 content-based hash inserted in the URL).

pack-priv class
DefaultResourceResolverChain

Default immutable implementation of ResourceResolverChain.

pack-priv class
DefaultResourceTransformerChain

Default immutable implementation of ResourceTransformerChain.

public class
DefaultServletHttpRequestHandler

An HttpRequestHandler for serving static files using the Servlet container's "default" Servlet.

public class
EncodedResourceResolver

Resolver that delegates to the chain, and if a resource is found, it then attempts to find an encoded (e.g. gzip, brotli) variant that is acceptable based on the "Accept-Encoding" request header.

public class
FixedVersionStrategy

A VersionStrategy that relies on a fixed version applied as a request path prefix, e.g. reduced SHA, version name, release date, etc.

This is useful for example when ContentVersionStrategy cannot be used such as when using JavaScript module loaders which are in charge of loading the JavaScript resources and need to know their relative paths.

public class
NoResourceFoundException

Raised when ResourceHttpRequestHandler can not find a resource.

public class
PathResourceResolver

A simple ResourceResolver that tries to find a resource under the given locations matching to the request path.

public class
ResourceHttpRequestHandler

HttpRequestHandler that serves static resources in an optimized way according to the guidelines of Page Speed, YSlow, etc.

The properties "locations" and "locationValues" accept locations from which static resources can be served by this handler.

public abstract class
ResourceTransformerSupport

A base class for a ResourceTransformer with an optional helper method for resolving public links within a transformed resource.

public class
ResourceUrlEncodingFilter

A filter that wraps the HttpServletResponse and overrides its encodeURL method in order to translate internal resource request URLs into public URL paths for external use.

public class
ResourceUrlProvider

A central component to use to obtain the public URL path that clients should use to access a static resource.

public class
ResourceUrlProviderExposingInterceptor

An interceptor that exposes the ResourceUrlProvider instance it is configured with as a request attribute.

public class
TransformedResource

An extension of ByteArrayResource that a ResourceTransformer can use to represent an original resource preserving all other information except the content.

public class
VersionResourceResolver

Resolves request paths containing a version string that can be used as part of an HTTP caching strategy in which a resource is cached with a date in the distant future (e.g. 1 year) and cached until the version, and therefore the URL, is changed.

public class
WebJarsResourceResolver

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.