Bug 22290 - HttpServlet should use Wrapper class for doHead
Summary: HttpServlet should use Wrapper class for doHead
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Servlet & JSP API (show other bugs)
Version: 5.0.7
Hardware: Other other
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
: 10555 (view as bug list)
Depends on:
Reported: 2003-08-11 03:42 UTC by Greg Wilkins
Modified: 2004-11-16 19:05 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Greg Wilkins 2003-08-11 03:42:42 UTC
The HttpServlet.NoBodyResponse class implements

It should extend HttpServletResponseWrapper

This is simpler and I think more legal - as it is unclear (to me
at least) that the spec allows for arbitrary wrapper classes
to be used.
Comment 1 william.barker 2003-08-11 05:00:28 UTC
Please cite the section of the Servlet-2.4 spec that you feel is violated if 
you REOPEN, since I can't find it.
Comment 2 Greg Wilkins 2003-08-11 06:53:56 UTC
Note that even if this is/was legal, I think there is no harm
in using the wrappers provided here and it will reduce the code volume.

The way in which the spec gets violated is a little obscure, but
it depends on SRV.8.2 Using a Request Dispatcher, which says:

"To use a request dispatcher, a servlet calls either the include method or
forward method of the RequestDispatcher interface. The parameters to these
methods can be either the request and response arguments that were passed in via
the service method of the javax.servlet interface, or instances of subclasses of
the request and response wrapper classes that were introduced for version 2.3 of
the specification. In the latter case, the wrapper instances must wrap the
request or response objects that the container passed into the service method."

The problem occurs if I write a servlet based on HttpServlet and in doGet 
call a RequestDispatcher with the response that was passed in to doGet.  For
a HEAD method, this is not the response passed to the service method, nor is it
a wrapper of that object.

This leads to a class of errors for webapps that want/need to unwrap
to the objects passed to service not working for HEAD requests. I have 
actually seen such problems in the field.


Comment 3 Tim Funk 2003-10-02 01:16:26 UTC
Who is responsible for the servlet api classes? The Sun people or the tomcat
people? If it is the Sun people - then shouldn't this be sent to the
servletapi-feedback@eng.sun.com and set as resolved?
Comment 4 Mark Thomas 2004-01-10 11:57:42 UTC
I have sent the following to servletapi-feedback@eng.sun.com

The following bugs were reported against Tomcat.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10555 (tomcat 4)
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22290 (tomcat 5)

I have resolved these bugs as INVALID for Tomcat as the NoBodyResponse class 
is part of the API spec (it is included in the API class files download) and 
is outside of our control. If you believe this is not the case, or can provide 
any other feedback that would be useful to add to our bug reports, please let 
me know.


Mark Thomas
Comment 5 Mark Thomas 2004-01-10 11:58:09 UTC
*** Bug 10555 has been marked as a duplicate of this bug. ***