Bear Bibeault wrote:
Ranjeetitm Singh wrote:Hi all,
I have a confusion in Filters . Is it possible for a filter to explicitly block all downstream processing ( by all other filters and
resource processors)
What I mean is ,if there are say 3 filters all applied on Servlet, in order
Filter_1 -------> Filter_2 -----> Filter_3 ------> Servlet
then is it possible that Filter_2 blocks downstream processing by Filter_1 .
No. Filter 1 is called prior to filter 2 so how could it possibly block filter 1?
It seems to me that filter 1 is upstream of filter 2, and filter 2 is downstream of filter 1. So 1 can block 2, but 2 can't block 1. Which means that (going back to the original form of the question before it was inverted): yes, it's possible for a filter to block downstream processing. It's not possible to block upstream processing. A quick Google found
the article mentioned by the original poster, and it seems to confirm this usage: "calls on upstream filters are always on the stack, waiting for downstream calls to return". So of course an upstream filter can block downstream processing, but not vice versa. The article was written in 2001, when filtering was new, to some people. What it describes is not a "trick" - it's basic use of filters. The original poster just interpreted "upstream" and "downstream" differently than what was meant in the article.