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





--- Comment #4 from Konstantin Kolinko <knst.koli...@gmail.com>  2009-01-22 
09:33:58 PST ---
Do you know where to get sources for that appbase-1.0.jar ? It is
c.s.rave.web.ui.appbase.servlet.LifecycleListener class in it that triggers the
issue.

My analysis, wrt TC 6.0 is the following:

1. WEB-INF/lib/appbase-1.0.jar file contains META-INF/taglib.tld Tag Library
Descriptor file, that registers LifecycleListener class as a listener.

2. I won't dig into details of LifecycleListener class, but the essence is that
its implementation of ServletRequestListener#requestDestroyed( ) method does
remove _all_ attributes from the ServletRequest.

Maybe it should resort to removing only the ones that implement those *Bean
interfaces, but, oh well, I do not see anything in its behavior to be against
the spec. Though it is certainly a trick.

3. o.a.c.servlets.DefaultServlet (the servlet that serves the static files)
uses request attributes to deliver file name and other information to sendfile
support in Apr/Nio - see method of DefaultServlet#checkSendfile() for details.

Note, that sendfile support is only used if the file size is greater than some
threshold that can be specified when configuring DefaultServlet (by default in
TC 6.0: 48 Kb). That is the only substantial difference between a.jar and
b.jar.

4. requestDestroyed( ) event is sent by
o.a.c.core.StandardContextValve#invoke()

5. All the following is a theory. I have not tested it on a running Tomcat
instance:

I suspect that the removal of the request attributes occurs before the file is
served by the sendfile support in Http11(Apr/Nio)Processor. That is, the
following events happen:

1) DefaultServlet#checkSendfile() checks that sendfile support should be used,
sets the request attributes and skips further processing.
2) StandardContextValve calls requestDestroyed( ) and LifecycleListener class
removes all attributes from the request
3) Http11(Apr/Nio)Processor does not receive information about the file that it
has to send.

Maybe this can be fixed by triggering
Http11(Apr/Nio)Processor#prepareResponse() before the requestDestroyed( ) event
occurs. That is, by invoking o.a.coyote.Response#sendHeaders() through a call
to javax.servlet.ServletResponse#flushBuffer().

Note: you can disable sendfile support in DefaultServlet by configuring it with
negative value for sendfileSize. See
http://tomcat.apache.org/tomcat-6.0-doc/default-servlet.html

(In reply to comment #1):
> WinXP SP3, TC5.5 without native - OK
> WinXP SP3, TC5.5 with native - OK

I suspect that the Listener in appbase-1.0.jar was ignored by TC5.5 (see bug
40809, esp. comment #8 there), thus not triggering the issue. Note, that
web.xml should be changed to follow the Servlet 2.4 spec to properly deploy the
app in TC5.5.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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