如何在Tomcat 7中将缓存控制设置为无缓存?

时间:2017-03-08 16:19:07

标签: tomcat caching tomcat7 cache-control no-cache

我正在尝试将Tomcat 7的Cache Control设置为no-cache选项。

我尝试使用ExpiresFilter中的web.xml,如下所示:

<filter>
    <filter-name>ExpiresFilter</filter-name>
    <filter-class>org.apache.catalina.filters.ExpiresFilter</filter-class>
    <init-param>
    <param-name>ExpiresByType image</param-name>
    <param-value>access plus 0 seconds</param-value>
    </init-param>
    <init-param>
    <param-name>ExpiresByType text/css</param-name>
    <param-value>access plus 0 seconds</param-value>
    </init-param>
    <init-param>
    <param-name>ExpiresByType application/javascript</param-name>
    <param-value>access plus 0 seconds</param-value>
    </init-param>

    <init-param>
    <param-name>ExpiresDefault</param-name>
    <param-value>access plus 0 seconds</param-value>
    </init-param>
</filter>

<filter-mapping>
<filter-name>ExpiresFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>

然而,当我阅读我的回复标题时,我得到的是:

Cache-Control:max-age=0

而不是Cache-Control: no-cache

如何将Tomcat服务器设置为仅通过配置文件指定Cache-Control: no-cache

0 个答案:

没有答案