org.springframework.web.servlet.resource

## Class AppCacheManifestTransformer

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

- All Implemented Interfaces:
    ResourceTransformer

  Deprecated.
  as of 5.3 since browser support is going away

      @Deprecated
      public class AppCacheManifestTransformer
      extends ResourceTransformerSupport

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

  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 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`.

  Since:
    4.1
  Author:
    Brian Clozel
  See Also:
    HTML5 offline applications spec

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `Resource` | `transform(HttpServletRequest request, Resource resource, ResourceTransformerChain chain)` Deprecated. Transform the given resource.

    - ### Methods inherited from class org.springframework.web.servlet.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()

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

    - #### AppCacheManifestTransformer

          public AppCacheManifestTransformer(String fileExtension)

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

  - ### Method Detail

    - #### transform

          public Resource transform(HttpServletRequest request,
                                    Resource resource,
                                    ResourceTransformerChain chain)
                             throws IOException

      Deprecated.
      Description copied from interface: `ResourceTransformer`
      Transform the given resource.
      Parameters:
        `request` - the current request
        `resource` - the resource to transform
        `chain` - the chain of remaining transformers to delegate to
      Returns:
        the transformed resource (never `null`)
      Throws:
        `IOException` - if the transformation fails