我正在尝试使用杠杆浏览器缓存来处理我的web css,js文件。我正在关注这个http://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#Expires_Filter,它说要添加 -
<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 10 minutes</param-value>
</init-param>
<init-param>
<param-name>ExpiresByType text/css</param-name>
<param-value>access plus 10 minutes</param-value>
</init-param>
<init-param>
<param-name>ExpiresByType application/javascript</param-name>
<param-value>access plus 10 minutes</param-value>
</init-param>
</filter>
...
<filter-mapping>
<filter-name>ExpiresFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
在web.xml中。但在filter-mapping
标记dispatcher
标记内显示错误
The content of element type "filter-mapping" must match "(filter-name,(url-pattern|servlet-name))".
这意味着我认为过滤器映射中的内容应该只有filter-name
和url-pattern|servlet-name
。我也按照urlRewriter中的建议尝试了configuring Tomcat for leveraging browser caching?,但stukc遇到了同样的问题。请有人解释一下。