1

我想使用 HTML5 标准为我的 spring MVC 应用程序构建一个缓存。

我的项目架构如下:

在我的 web.xml 我添加了这个:

<mime-mapping>
  <extension>manifest</extension>
  <mime-type>text/cache-manifest</mime-type>
</mime-mapping>

我在 WEB-INF 文件夹中创建了一个 .manifest 文件,其中包含

CACHE MANIFEST
 # version 1

CACHE:
home.jsp
css/style.lesss

home.jsp 文件头是:

<html manifest="collabook.manifest">

没有文件被缓存(safari web 检查器)

如何实现我的目标?

谢谢

4

1 回答 1

0

此外,将其添加到您的 dispatcher-servlet.xml:

<resources mapping="/files/to/cache/**" location="/files/to/cache/"

并将其添加到您的视图解析器中:

<bean id="myview"
      class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix">
        <value>/files/to/cache/</value>
    </property>
    <property name="suffix">
        <value>.manifest</value>
    </property>
    <property name="order">
        <value>1</value>
    </property>
</bean>

如果你想为动态内容做一些自定义的事情,你还需要一个 MVC 控制器来获取 URI。

于 2013-07-09T20:56:30.643 回答