Hi Andre, As Mark stated earlier - With a context.xml file named TestApp#web.xml you have a defined a new web application with a context path of "/TestApp/web" and a docBase of "C:\web"
This holds true here. Any filter inside “TestApp” would not be able to catch the requests going to "/TestApp/web" application. Regards, Praddy From: André Warnier (tomcat) Sent: Saturday, October 24, 2015 3:26 PM To: users@tomcat.apache.org Subject: Re: servlet filter not working over virtual directories in tomcat On 24.10.2015 05:11, Pradyut Bhattacharya wrote: > The URL pattern therefore needs to be "/*" > Could not do anything with the above statement. May be an example could > suffice. Then maybe try this : Instead of : <filter-mapping> <filter-name>dir_filter</filter-name> <url-pattern>/web/*</url-pattern> </filter-mapping> try : <filter-mapping> <filter-name>dir_filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> Explanation : in <servlet-mapping> and <filter-mapping>, the <url-pattern> is *relative to the webapp context*. In your case, because of the way you have configured this, the webapp has a context of "/TestApp/web". Therefore, if you want the filter to apply to everything under "/TestApp/web", you have to map it to "/*". So that, in URL-space, it will apply to "/TestApp/web/*". The way you originally mapped it above, it would apply to "/TestApp/web/web/*", which is why it seemed not to be working. The filter was there, but never invoked, because there was never any request URL matching "/TestApp/web/web/*". Clearer ? Note that this is the same as what Mark was saying, only in many more words. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org