• Post Reply Bookmark Topic Watch Topic
  • New Topic

Filter execution priority

 
Shiang Wang
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two filters associated the same servlet, one is through url-pattern, the other is through servlet-name. When I ran it on jboss(tomcat 5.0),it showed that the filter with servlet-name is executed first and then url-pattern. Could someone confirm that sequence of filters? In SCWCD exam study kit, it said that the container will call the filters that match url-pattern before it calls that match servlet name. It contradicts my result.

Thanks
 
Roger Yates
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was your logging - or however you determined the order - happening before or after the call do doFilter on the FilterChain?
If after, then I may be able to explain. If before, then I can't!

Could you post your filter-mappings as well - in case this helps!
[ October 20, 2004: Message edited by: Roger Yates ]
 
Shiang Wang
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figure it out now. My testing statements are put after doFilter and one uses response wrapper and the other one doesn't. Because of this execise, I understand it better now. URL mapping does have higher priority over servlet mapping.

Thanks
 
Roger Yates
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact, SCWCD Exam Study Kit did a very good job.

You should make sure that you understand the content presented in pages 386 to 389.

Nick
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!