I am trying to map a filter to a specific url in web.xml. The problem is that there is a dynamic path segment in the url and I need to map my filter only to URLs ending with a specific path. For given URLs:
http://company.com/webApp/aaa/end
http://company.com/webApp/bbb/end
http://company.com/webApp/ccc/end
I need to map a servlet like:
<filter id="EndFilter">
<filter-name>EndFilter</filter-name>
<filter-class>com.company.EndFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>EndFilter</filter-name>
<url-pattern>*/end</url-pattern>
</filter-mapping>
I know that */ is not a valid wildcard but I dont know if this type of mapping is even possible. It is easy to map URLs with resources like pictures with endings *.png or *.jpeg wildcard but i can't find a way to map a simple url path segment.
From the servlet 3.1 specification chapter 12:
So it looks like it is not possible.