• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Order of Filter Execution

 
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


In what order are thr filter invoked for the following browser request?
/admin/index.jsp

Options:
a. FilterOne, FilterThree
b. FilterOne, FilterTwo, FilterThree
c. FilterThree, FilterTwo
d. Filterhree, FilterTwo
e. FilterThree
f. None

What will be the order of filter execution for the above coding?

I think it will be:
1. EXACT MATCH
2. DIRECTORY MATCH
3. EXTENSION MATCH

as like servlt-mapping...whether it is applicable to filter-mapping too.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Michael,

Filter executes in the order they are defined in the DD.
see this link
 
Micheal John
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what will be the output?
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the order is :
FilterOne --> FilterThree --> FilterFour
 
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I too think it's FilterOne --> FilterThree --> FilterFour.

Does that mean the answer is "f. None"?
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Resolving Filter is slightly different than Servlet. While application deployment, container has to form the chain based on the filters mapping to the resources in the deployment declaration.

So Container forms the first set chain based on the url mappings (<url-pattern> then exact mapping (<servlet-name> with the second set. Order of application is first chain and then second chain.
 
Micheal John
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone confirm the answer?
 
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Filters will be executed in order they are defined in the deployment descriptor and requested URL lies in the range of defined URL Mapping.

In your case the answer will be option f because the order of execution will be FilterOne,FilterThree,FilterFour.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic