| Author |
Filters
|
MaheshS Kumbhar
Ranch Hand
Joined: Sep 24, 2009
Posts: 188
|
|
|
I read in "Head First Servlets and JSP" that if container cant find the right resource for the request, the filter is never invoked. Here by "right resource" do we mean servlet/jsp or even welcome file?
|
I am slow but sure
|
 |
Frits Walraven
Rancher
Joined: Apr 07, 2010
Posts: 1040
|
|
Hi MaheshS,
A filter always works on either a:
Dynamic web-resource, i.e. Servlet, matched by a servlet nameStatic web-resource matched by an URL-pattern
If the filter-mapping doesn't match a servlet name or a static web-resource ( that means the url-pattern doesn't make a match), then the filter is never invoked
If you have a default mapping '/' in the <url-pattern> of a <filter-mapping>, then the filter is never invoked ('/' is only used for the default servlet)
But if you have a mapping of '/*' (meaning all the requests) in the <url-pattern> of a <filter-mapping>, the filter is always invoked, but it can still fail with a "resource unavailable".
Regards,
Frits
|
 |
MaheshS Kumbhar
Ranch Hand
Joined: Sep 24, 2009
Posts: 188
|
|
Thanks Frits
But I didnt get the term default servlet.
('/' is only used for the default servlet).
|
 |
Frits Walraven
Rancher
Joined: Apr 07, 2010
Posts: 1040
|
|
have a look at the specification Servlet 2.4, section SRV.11.1 (and maybe SRV.9.10 about welcome files)
Regards,
Frits
|
 |
 |
|
|
subject: Filters
|
|
|