SpringMVC 生成的清单 xml 清单获取失败 (406)

SpringMVC generated manifest xml Manifest fetch failed (406)

我正在服务器端生成一个 html5 缓存清单 xml 然后我得到 应用程序缓存错误事件:清单获取失败 (406) 此错误消息在我的控制台中。

我的 html 中有这个标签:

<html manifest="http://localhost:8080/test/api/view/view/system/manifest">

我的控制器方法:

@RequestMapping(value = "manifest", produces = "text/cache-manifest", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
public String manifest() {
    logger.debug("Generating the manifest file!");

    StringBuilder strManiFstBuilder = new StringBuilder();
    strManiFstBuilder.append("CACHE MANIFEST"); 
    strManiFstBuilder.append("\n");
    strManiFstBuilder.append("#revision 1");
    strManiFstBuilder.append("\n");
    strManiFstBuilder.append("CACHE:");
    strManiFstBuilder.append("\n");
    strManiFstBuilder.append("api/view/view/order");
    strManiFstBuilder.append("\n");
    strManiFstBuilder.append("NETWORK:");
    strManiFstBuilder.append("\n");
    strManiFstBuilder.append("api/view/view/system/ping");
    strManiFstBuilder.append("\n");
    strManiFstBuilder.append("*");
    strManiFstBuilder.append("\n");

    return strManiFstBuilder.toString();
}

我的 web.xml

里有这个
<mime-mapping>
    <extension>manifest</extension> 
    <mime-type>text/cache-manifest</mime-type>
</mime-mapping>

如果我从浏览器调用控制器方法,则会生成:

缓存清单

缓存: api/view/bestellijstsearchlistview/order/search/template/tags,姓名,%20customer.naam,orderParts.orderItems.product.description,orderParts.orderItems.product.externalId/page/1/size/500 网络: api/view/view/system/ping *

我必须生成这个文件,我该怎么做,我的解决方案有什么问题?

我设法通过从注释中删除 produces 属性来解决这个问题,并将 .manifest 添加到 urlname。

我的控制器header:

@RequestMapping(value = "cache.manifest", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
public String manifest() {


<html manifest="http://localhost:8080/system/cache.manifest">