org.springframework.web.reactive.resource

## Class AppCacheManifestTransformer

- java.lang.Object
- - org.springframework.web.reactive.resource.ResourceTransformerSupport
  - - org.springframework.web.reactive.resource.AppCacheManifestTransformer

All Implemented Interfaces:
  ResourceTransformer

    public class AppCacheManifestTransformer
    extends ResourceTransformerSupport

A `ResourceTransformer` HTML5 AppCache manifests.

This transformer:

- modifies links to match the public URL paths that should be exposed to clients, using configured `ResourceResolver` strategies
- appends a comment in the manifest, containing a Hash (e.g. "# Hash: 9de0f09ed7caf84e885f1f0f11c7e326"), thus changing the content of the manifest in order to trigger an appcache reload in the browser.

All files with an ".appcache" file extension (or the extension given to the constructor) will be transformed by this class. The hash is computed using the content of the appcache manifest so that changes in the manifest should invalidate the browser cache. This should also work with changes in referenced resources whose links are also versioned.

Since:
  5.0
Author:
  Rossen Stoyanchev, Brian Clozel
See Also:
  HTML5 offline applications spec

### Constructor Summary

Constructors
Constructor and Description
`AppCacheManifestTransformer()` Create an AppCacheResourceTransformer that transforms files with extension ".appcache".
`AppCacheManifestTransformer(String fileExtension)` Create an AppCacheResourceTransformer that transforms files with the extension given as a parameter.

### Method Summary

All Methods Instance Methods Concrete Methods
`reactor.core.publisher.Mono<org.springframework.core.io.Resource>` `transform(org.springframework.web.server.ServerWebExchange exchange, org.springframework.core.io.Resource inputResource, ResourceTransformerChain chain)` Transform the given resource.

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

`getResourceUrlProvider, resolveUrlPath, setResourceUrlProvider, toAbsolutePath`

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

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

### Constructor Detail

#### AppCacheManifestTransformer

    public AppCacheManifestTransformer()

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

#### AppCacheManifestTransformer

    public AppCacheManifestTransformer(String fileExtension)

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

### Method Detail

#### transform

    public reactor.core.publisher.Mono<org.springframework.core.io.Resource> transform(org.springframework.web.server.ServerWebExchange exchange,
                                                                                       org.springframework.core.io.Resource inputResource,
                                                                                       ResourceTransformerChain chain)

Description copied from interface: `ResourceTransformer`
Transform the given resource.

Parameters:
  `exchange` - the current exchange
  `inputResource` - the resource to transform
  `chain` - the chain of remaining transformers to delegate to
Returns:
  the transformed resource (never empty)