Bug 10555

Summary: doHEAD breaks spec SRV 8.2
Product: Tomcat 4 Reporter: Greg Wilkins <gregw>
Component: Servlet & JSP APIAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED DUPLICATE    
Severity: major    
Priority: P3    
Version: 4.1.6   
Target Milestone: ---   
Hardware: Other   
OS: other   

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 ***