同一过滤器的多个过滤器映射

时间:2012-12-18 21:35:52

标签: servlets servlet-filters

我在weblogic中部署了2个网络应用。因为他们每个人都有一个单独的hibernate会话工厂。 我在webapp2中使用specialServlet来使第二级缓存无效。 filter1用于设置hibernate会话,因此我可以调用以使第二级缓存无效。

来自web app1的

我在web app2中包含/ servlet / specialServlet。

我希望定期请求为filter1调用/servlet/*

但对servlet/specialServlet我希望filter1不仅可以通过常规请求调用,还可以调用include请求。 指定过滤器映射的最佳方法是什么? 同样,过滤器映射元素的顺序对filter1

很重要
 <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">          
  xxx
                  <filter>
                      <filter-name>filter1</filter-name>
                      <filter-class>xxx</filter-class>
                  </filter>
                  <filter-mapping>
                    <filter-name>filter1</filter-name>
                    <url-pattern>/servlet/*</url-pattern>
                  </filter-mapping>          
                  <filter-mapping>
                    <filter-name>filter1</filter-name>
                    <url-pattern>/servlet/specialServlet</url-pattern>
                    <dispatcher>INCLUDE</dispatcher>
                  </filter-mapping>
   xxx
  </web-app>

0 个答案:

没有答案