Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

two servlet filters how to bypass second one

 
John El
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two filters, FilterA & FilterB, but I want FilterA to decide whether or not to run FilterB.
I saw a similar post from 3 years ago
http://www.coderanch.com/t/361028/Servlets/java/two-servlet-filters-bypass-second
but the reply doesn't suite my situation. I don't have access to FilterB, I only have access to FilterA.

Any ideas?
Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by John El:
I don't have access to FilterB, I only have access to FilterA.

I'm not sure what this means. Does it mean that you cannot modify FilterB's code?
 
Mohd Fuzail
Ranch Hand
Posts: 107
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think John wants to decide at runtime whether he wants to execute Filter B or not and this decision he needs to make from Filter A code
[ June 11, 2008: Message edited by: Mohd Fuzail ]
 
John El
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're both right. I cannot modify FilterB's code and I want to decide at runtime whether or not to run FilterB.

The solution is to extend FilterB, then inside FilterBExtended decide whether or not to call super.doFilter.

However; that solution just led to another problem...I'm trying to trap an error inside the filter, but it seems the error occurs deeper in the chain, and may not be reasonably trappable.

Thanks
 
saurabh mehta
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Edit: thread hi-jack removed. Please ask your questions in a new topic]
[ June 23, 2008: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic