Document media type registration for appcache files

Since appcache manifests can have various file extensions, developers
should register the (file extension, media type) mapping in their Spring
MVC / Reactive Web configuration.

This commit adds javadoc on both `AppCacheManifestTransformer` variants
to explain how to do that.

Issue: SPR-14510
This commit is contained in:
Brian Clozel 2016-09-16 12:04:56 +02:00
parent 3fdc11e739
commit 084daa7fb5
2 changed files with 16 additions and 9 deletions

View File

@ -53,13 +53,16 @@ import org.springframework.web.server.ServerWebExchange;
* of the manifest in order to trigger an appcache reload in the browser.
* </ul>
*
* All files that have the ".appcache" file extension, or the extension given
* in the constructor, will be transformed by this class.
*
* <p>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
* <p>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.
*
* <p>In order to serve manifest files with the proper {@code "text/manifest"} content type,
* it is required to configure it with
* {@code requestedContentTypeResolverBuilder.mediaType("appcache", MediaType.valueOf("text/manifest")}
* in {@code WebReactiveConfiguration.configureRequestedContentTypeResolver()}.
*
* @author Rossen Stoyanchev
* @author Brian Clozel
* @since 5.0

View File

@ -47,11 +47,15 @@ import org.springframework.util.StringUtils;
* thus changing the content of the manifest in order to trigger an appcache reload in the browser.
* </ul>
*
* All files that have the ".appcache" file extension, or the extension given in the constructor,
* will be transformed by this class.
* <p>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.
*
* <p>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.
* <p>In order to serve manifest files with the proper {@code "text/manifest"} content type,
* it is required to configure it with
* {@code contentNegotiationConfigurer.mediaType("appcache", MediaType.valueOf("text/manifest")}
* in a {@code WebMvcConfigurerAdapter}.
*
* @author Brian Clozel
* @since 4.1