tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier (tomcat) ...@ice-sa.com>
Subject Re: servlet filter not working over virtual directories in tomcat
Date Sat, 24 Oct 2015 09:56:23 GMT
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message