Servlet Filter Priority

Since the filters are linked one after another, I cannot know when to delete the MDC / NDC information (log4j). What is the topmost servlet filter?

I have one defined inside deploy / jboss-portal-ha.sar / portal-server.war / WEB-INF / Web.xml and several others are distributed around the application server.

What is the priority rule in this case?

+4
source share
1 answer

Servlet filters are bound in the order in which they are defined in your web.xml and must be specific to each web application context, which is almost always synonymous with a web application archive (WAR).

Details around the exact order used (which takes into account both the <url-pattern> and <servlet-name> elements) are documented in the Java servlet specification in the section "SRV.6.2.4" Filter Configuration in a Web Application ", available for download http : //download.oracle.com/otndocs/jcp/servlet-2.5-mrel2-eval-oth-JSpec/ .

+2
source

All Articles