Bug 10555 - doHEAD breaks spec SRV 8.2
Summary: doHEAD breaks spec SRV 8.2
Status: RESOLVED DUPLICATE of bug 22290
Alias: None
Product: Tomcat 4
Classification: Unclassified
Component: Servlet & JSP API (show other bugs)
Version: 4.1.6
Hardware: Other other
: P3 major (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-08 14:51 UTC by Greg Wilkins
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Wilkins 2002-07-08 14:51:00 UTC
The HttpServlet.doHead method is

 protected void doHead(HttpServletRequest req, HttpServletResponse resp)
	throws ServletException, IOException
    {
	NoBodyResponse response = new NoBodyResponse(resp);
	
	doGet(req, response);
	response.setContentLength();
    }

where

  class NoBodyResponse implements HttpServletResponse {...}



This breaks older versions of Jetty if a head request is
passed to a request dispatcher.  This is because Jetty used
to enforce the SRV 8.2 and the javadoc for RequestDispatcher 
that says

 * The request and response parameters must be either the same
 * objects as were passed to the calling servlet's service method or be
 * subclasses of the {@link ServletRequestWrapper} or 
 * {@link ServletResponseWrapper} classes that wrap them.


Thus the doHead mechanism breaks this because NoBodyResponse
does not extend HttpServletResponseWrapper.

The NoBodyResponse should extend the wrapper, so that containers can
enforce the SRC8.2 if they wish.
Comment 1 Mark Thomas 2004-01-10 11:58:08 UTC

*** This bug has been marked as a duplicate of 22290 ***