1

サーバー側で html5 キャッシュ マニフェスト xml を生成していますが、Application Cache Error event: Manifest fetch failed (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 *

このファイルを生成する必要があります。どうすればそれを行うことができますか?また、ソリューションの何が問題になる可能性がありますか?

4

1 に答える 1

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">
于 2015-09-07T09:23:17.533 に答える