• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

filter mapping

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can any one explain me about this..

Which of the statements is true about the following deployment descriptor snippet?

<filter-mapping>
<filter-name>Filter1</filter-name>
<servlet-name>ServletToFilter</servlet-name></filter-mapping><filter-mapping>

<filter-name>Filter2</filter-name>
<url-pattern>/*</url-pattern></filter-mapping>

How come the answer for the above question is " Filter2 will be invoked before Filter1 if ServletToFilter is requested"

Becuase filters are invoked the order in which they apper in DD right..
so it should be Filter..
 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The rule of filter chain is to loop through URL pattern matching first, it invokes the one matches; then the servlet matching.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Becuase filters are invoked the order in which they apper in DD right..


Nope. As Grace pointed out, URL matching takes priority before Name matching.
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Satou is right.

Filter Chaining Rules:

1. All filters with matching URL patterns are located. They are executed in the order of declaration in the DD.
2. After this, all the filters with the matching servlet-name in the DD are located and executed in the order of declaration.
 
After some pecan pie, you might want to cleanse your palatte with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic