Hi,
Let's explain it with an example where we have a
Servlet (e.g. FilterServlet) with the following mapping:
We can now attach filters on the basis of the url-pattern, for example:
http://localhost:8080/WebAppRoot/filter/*, or we can attach a filter on the Servlet name (FilterServlet). If we have the following filters defined in our web.xml:
If we have deployed our web app and type in the following URL:
http://localhost:8080/WebAppRoot/filter/FilterServlet
We will see the following execution order (where the last Sysem.out is from the FilterServlet itself)
filter.FilterOneURL
filter.FilterTwoURL
filter.FilterOneName
filter.FilterTwoName
nl.servlet.FilterServlet
You can see that the filters with a matching Servlet-name are invoked later than the ones on the basis of the URL-pattern.
Regards,
Frits