2013-07-05 53 views
1

我想使用HTML5标准为我的Spring MVC应用程序构建一个缓存。如何使用html 5缓存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 inspector)

如何实现我的目标?

感谢

回答

0

此外,添加到您的调度员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。

+0

当我添加bean时,我的jsp页面不显示也不缓存 – chillo

+0

它们在添加之前显示吗?我认为前缀需要是基于上面的内容的“collabook”。 – occasl

相关问题