3

由于这个这个问题,我创建了一个Filter来检查Cookie带有请求对象的 s 和相应的请求。现在我想将它映射为就像我在. 假设我有,那么我必须为两者而不是其他任何东西(例如或不允许)映射,我的意思是除了请求之外没有任何东西。我正在使用 Apache Tomcat 7.0.22 容器。forwardFilterwelcome-fileweb.xml
welcome-fileindex.htmlFilterwww.example.com/www.example.com/index.htmlwww.example.com/foo/*www.example.com/*welcome-file

4

1 回答 1

2

只需将这些添加到您的 web.xml

<filter>
  <filter-name>myFilter</filter-name>
  <filter-class>com.examples.myFilter</filter-class>
</filter>

<filter-mapping>
  <filter-name>myFilter</filter-name>
  <url-pattern>/index.html</url-pattern>
</filter-mapping>
于 2012-04-15T00:32:03.837 回答