以下是我的web.xml的内容,应用程序在websphere 8.5
中被取消部署<filter>
<filter-name>securityFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>CheckFilter</filter-name>
<url-pattern>/index.jsp</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
我面临的问题是当我点击像https://servername:portNumber/contextPath/?QueryParam这样的网址时,我的CheckFilter没有被调用 同样适用于tomcat&amp;的WebLogic。
但如果我输入网址https://servername:portNumber/contextPath/index.jsp?QueryParam
我的过滤器被调用。要获得第一个url的响应,我需要更改什么。
即。不给出index.jsp过滤器应该被调用。
答案 0 :(得分:0)
因此,根据您的要求,您有两种选择
1)像这样在/
添加urlpattern(因为如果你只调用应用程序上下文,模式中没有index.jsp)
<filter-mapping>
<filter-name>RootFilter</filter-name>
<url-pattern>/index.jsp</url-pattern>
<url-pattern>/</url-pattern>
</filter-mapping>
2)由于请求转发到index.jsp
,您可以将FORWARD
添加到过滤器映射中,如下所示:
<filter-mapping>
<filter-name>RootFilter</filter-name>
<url-pattern>/index.jsp</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>