https://issues.apache.org/bugzilla/show_bug.cgi?id=57314

--- Comment #16 from Konstantin Kolinko <knst.koli...@gmail.com> ---
If you are using ThreadLocals implementing a Filter is the usual and better
approach.

1) A Filter fulfills the same task of being executed when request enters
application and when it leaves it.
2) A filter can use try/finally and deal .
3) A filter can be configured with what it is interested with
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>ERROR</dispatcher>
<dispatcher>ASYNC</dispatcher>

Are you trying to emulate a Filter using a "listener"?
Does ServletRequestListener serve its own purpose, or it re-implements a
filter? Do you expect it to be called on all those dispatches, without being
configured in what of them it is interested in?


Looking at Tomcat issues in Bugzilla that mention ServletRequestListener

Bug 49991  -> login page called by Authenticator
Bug 51653  -> dealing with <dispatcher>ERROR</dispatcher>
Bug 50789  -> dealing with <dispatcher>ERROR</dispatcher> but it somehow went
down to discussion of forwards and to a custom Context option

Are we now to discuss <dispatcher>ASYNC</dispatcher>?

BTW, The Filter chapter in Servlet Specification explicitly says about "same
thread" (<quote>A Filter and the target servlet or resource at the end
of the filter chain must execute in the same invocation thread.</quote> and
several other phrases). Is there anything about listeners?

Does your proposal contradict with use case from bug 51653?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to