2015-09-04 41 views
1

我在服務器端生成html5緩存清單xml,並且我得到 應用程序緩存錯誤事件:清單獲取失敗(406)此錯誤消息在我的控制檯中。SpringMVC生成清單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> 

如果我把控制器方法從瀏覽器中產生:

CACHE MANIFEST

CACHE: API /視圖/ bestellijstsearchlistview /順序/搜索/模板/標籤,名稱,%20customer.naam,orderParts.orderItems.product.description,orderParts.orderItems.product.externalId /頁/ 1 /尺寸/ 500 NETWORK: API /視圖/視圖/系統/平 *

我生成這個文件我該怎麼做,什麼都可以用我的解決方案的問題?

回答

0

我試圖通過從註釋中刪除產品屬性來解決此問題,並將.manifest添加到了urlname中。

我控制器的標題:

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


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