【发布时间】:2015-11-30 15:17:46
【问题描述】:
我正在服务器端生成一个 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,name,%20customer.naam,orderParts.orderItems.product.description,orderParts.orderItems.product.externalId/page/1/size/500 网络: api/视图/视图/系统/ping *
我必须生成这个文件,我该怎么做?我的解决方案可能有什么问题?
【问题讨论】:
标签: html spring-mvc manifest offline-browsing