spring-framework / org.springframework.web.servlet.resource / AppCacheManifestTransformer

AppCacheManifestTransformer

open class AppCacheManifestTransformer : ResourceTransformerSupport

A ResourceTransformer implementation that helps handling resources within HTML5 AppCache manifests for HTML5 offline applications.

This transformer:

All files that have the ".appcache" file extension, or the extension given in the constructor, will be transformed by this class. This hash is computed using the content of the appcache manifest and the content of the linked resources; so changing a resource linked in the manifest or the manifest itself should invalidate the browser cache.

In order to serve manifest files with the proper "text/manifest" content type, it is required to configure it with contentNegotiationConfigurer.mediaType("appcache", MediaType.valueOf("text/manifest") in a WebMvcConfigurer.

Author
Brian Clozel

Since
4.1

See Also
<a href="https://html.spec.whatwg.org/multipage/browsers.html#offline">HTML5 offline applications spec</a>

Constructors

<init>

AppCacheManifestTransformer()

Create an AppCacheResourceTransformer that transforms files with extension ".appcache".

AppCacheManifestTransformer(fileExtension: String)

Create an AppCacheResourceTransformer that transforms files with the extension given as a parameter.

Functions

transform

open fun transform(request: HttpServletRequest, resource: Resource, chain: ResourceTransformerChain): Resource