In my Servlet application, I'm using a Jar which contains an @WebFilter
class in it. I should not remove the Jar dependency or the @WebFilter
class inside it. I tried to set some bogus filter url pattern for the unwanted filter, but it doesn't work as that @WebFilter
is mapped to /*
.
package com.somepackage;
@WebFilter("/*")
public class CustomFilter implements Filter {
This is how I set the bogus url in web.xml
<filter>
<filter-name>CustomFilter</filter-name>
<filter-class>com.somepackage.CustomFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CustomFilter</filter-name>
<url-pattern>/thispathnotexist/*</url-pattern>
</filter-mapping>
It doesn;t have any effect as all the requests are still passed through CustomFilter. Is there any way that I can disable this particular filter in my appliction?