I cannot find a way to get the url-mapping information inside a filter.
For instance, web.xml:
<filter>
<filter-name>someFilter</filter-name>
<filter-class>com.xxx.filter.SomeFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>someFilter</filter-name>
<url-pattern>/ws/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>someFilter</filter-name>
<url-pattern>/rest/*</url-pattern>
</filter-mapping>
Then inside SomeFilter I would like to get a list of the mappings ["/ws/","/rest/"]. Is there a way to get it?
@Override
public void init(FilterConfig filterConfig){
filterConfig.getXXX() // -> ["/ws/*","/rest/*"]???
}
It's not perfect, but try to define them as init param inside filter, then read init-param from code
Filter Class:
Try to apply that for each filter then store all values in other variable in application, but if you used one Filter in application this will help you.