tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: ServletRequestListener.requestDestroyed is called before request leaves a webapp
Date Tue, 09 Aug 2011 20:35:58 GMT
On 09/08/2011 20:55, Volodymyr Sobotovich wrote:
> Hello, everyone.
> 
> I think I have found a bug in Tomcat's lifecycle handling of
> ServletRequestListener. I'd like to discuss it here before posting.
> Tomcat 7.0.19, jdk 1.7.0-b147, Ubuntu Linux 11.04
> Steps to reproduce:
> 1. declare error page for 404 code in web.xml
> 2. Set location of that page to some servlet (let's call it ErrorServlet)
> 3. go to any invalid URL in webapp (to cause 404)
> 4. ErrorServlet is called after requestDestroyed on any registered listener.
> This kind of behaviour is not correct in my opinion because it
> contradicts to contract of ServletRequestListener.
> Also it breaks org.springframework.web.context.request.RequestContextListener
> if ErrorServlet uses session-scoped beans.
> 
> What do you think about that. Should I post in to Bugzilla?

Hmm.

The error page handling is currently at the host level. One could argue
the listeners are being fired in the right place (when processing
enters/leaves the context). However, custom error pages defined by the
web app are currently outside the listener calls and that doesn't seem
right.

Addressing this would mean either:
a) moving the error handling to the context (inside the calls to the
ServletRequestListener) or
b) moving the calls to ServletRequestListener to the host level

I am leaning towards a) but wondering why things are the way the are
currently.

I'd suggest leaving this on the dev list for other folks to comment and
then add it to BZ in a couple of days unless the consensus is that it is
not a bug. The next 7.0.x release won;t be until early Sept so there is
plenty of time to get this right.

Mark

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


Mime
View raw message