Issue
Is it possible to use two filters that have the same url-mapping?
<filter>
<filter-name>TeeFilter</filter-name>
<filter-class>filter1r</filter-class>
</filter>
<filter-mapping>
<filter-name>TeeFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<display-name>CredentialsFilter</display-name>
<filter-name>CredentialsFilter</filter-name>
<filter-class>filter2</filter-class>
</filter>
<filter-mapping>
<filter-name>CredentialsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Solution
Yes. You can.
The order you placed in web.xml will execute.
So here,
First control goes to TeeFilter
and then to CredentialsFilter
.
And if you want to execute CredentialsFilter
first, change the order in web.xml
Answered By - Suresh Atta
Answer Checked By - Cary Denson (JavaFixing Admin)