Change default appcache manifest file extension
This commit changes the default file extension configured with `AppCacheManifestTranformer`. This ResourceTransformer was previously considering `.manifest` files by default, but this has been changed in the official spec to `appcache`, in order not to clash with Microsoft's unregistered application/manifest type. Issue: SPR-14687
This commit is contained in:
parent
4588b6c9f4
commit
1881aa5b5b
|
@ -48,7 +48,7 @@ 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 ".manifest" file extension, or the extension given
|
||||
* 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
|
||||
|
@ -58,7 +58,7 @@ import org.springframework.web.server.ServerWebExchange;
|
|||
* @author Rossen Stoyanchev
|
||||
* @author Brian Clozel
|
||||
* @since 5.0
|
||||
* @see <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html#offline">HTML5 offline applications spec</a>
|
||||
* @see <a href="https://html.spec.whatwg.org/multipage/browsers.html#offline">HTML5 offline applications spec</a>
|
||||
*/
|
||||
public class AppCacheManifestTransformer extends ResourceTransformerSupport {
|
||||
|
||||
|
@ -75,10 +75,10 @@ public class AppCacheManifestTransformer extends ResourceTransformerSupport {
|
|||
|
||||
|
||||
/**
|
||||
* Create an AppCacheResourceTransformer that transforms files with extension ".manifest".
|
||||
* Create an AppCacheResourceTransformer that transforms files with extension ".appcache".
|
||||
*/
|
||||
public AppCacheManifestTransformer() {
|
||||
this("manifest");
|
||||
this("appcache");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -82,7 +82,7 @@ public class AppCacheManifestTransformerTests {
|
|||
|
||||
@Test
|
||||
public void syntaxErrorInManifest() throws Exception {
|
||||
Resource resource = new ClassPathResource("test/error.manifest", getClass());
|
||||
Resource resource = new ClassPathResource("test/error.appcache", getClass());
|
||||
given(this.chain.transform(this.exchange, resource)).willReturn(resource);
|
||||
|
||||
Resource result = this.transformer.transform(this.exchange, resource, this.chain);
|
||||
|
@ -105,7 +105,7 @@ public class AppCacheManifestTransformerTests {
|
|||
transformers.add(new CssLinkResourceTransformer());
|
||||
this.chain = new DefaultResourceTransformerChain(resolverChain, transformers);
|
||||
|
||||
Resource resource = new ClassPathResource("test/appcache.manifest", getClass());
|
||||
Resource resource = new ClassPathResource("test/test.appcache", getClass());
|
||||
Resource result = this.transformer.transform(this.exchange, resource, this.chain);
|
||||
byte[] bytes = FileCopyUtils.copyToByteArray(result.getInputStream());
|
||||
String content = new String(bytes, "UTF-8");
|
||||
|
|
|
@ -47,7 +47,7 @@ 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 ".manifest" file extension, or the extension given in the constructor,
|
||||
* 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;
|
||||
|
@ -55,7 +55,7 @@ import org.springframework.util.StringUtils;
|
|||
*
|
||||
* @author Brian Clozel
|
||||
* @since 4.1
|
||||
* @see <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html#offline">HTML5 offline applications spec</a>
|
||||
* @see <a href="https://html.spec.whatwg.org/multipage/browsers.html#offline">HTML5 offline applications spec</a>
|
||||
*/
|
||||
public class AppCacheManifestTransformer extends ResourceTransformerSupport {
|
||||
|
||||
|
@ -72,10 +72,10 @@ public class AppCacheManifestTransformer extends ResourceTransformerSupport {
|
|||
|
||||
|
||||
/**
|
||||
* Create an AppCacheResourceTransformer that transforms files with extension ".manifest".
|
||||
* Create an AppCacheResourceTransformer that transforms files with extension ".appcache".
|
||||
*/
|
||||
public AppCacheManifestTransformer() {
|
||||
this("manifest");
|
||||
this("appcache");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -66,7 +66,7 @@ public class AppCacheManifestTransformerTests {
|
|||
|
||||
@Test
|
||||
public void syntaxErrorInManifest() throws Exception {
|
||||
Resource resource = new ClassPathResource("test/error.manifest", getClass());
|
||||
Resource resource = new ClassPathResource("test/error.appcache", getClass());
|
||||
given(this.chain.transform(this.request, resource)).willReturn(resource);
|
||||
|
||||
Resource result = this.transformer.transform(this.request, resource, this.chain);
|
||||
|
@ -89,7 +89,7 @@ public class AppCacheManifestTransformerTests {
|
|||
transformers.add(new CssLinkResourceTransformer());
|
||||
this.chain = new DefaultResourceTransformerChain(resolverChain, transformers);
|
||||
|
||||
Resource resource = new ClassPathResource("test/appcache.manifest", getClass());
|
||||
Resource resource = new ClassPathResource("test/test.appcache", getClass());
|
||||
Resource result = this.transformer.transform(this.request, resource, this.chain);
|
||||
byte[] bytes = FileCopyUtils.copyToByteArray(result.getInputStream());
|
||||
String content = new String(bytes, "UTF-8");
|
||||
|
|
Loading…
Reference in New Issue