Bug 44562 - HEAD requests cannot go through request dispatch include.
HEAD requests cannot go through request dispatch include.
Product: Tomcat 5
Classification: Unclassified
Component: Servlet & JSP API
PC Mac OS X 10.4
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
: 44829 (view as bug list)
Depends on:
  Show dependency tree
Reported: 2008-03-07 13:19 UTC by david jencks
Modified: 2008-07-30 10:26 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description david jencks 2008-03-07 13:19:40 UTC
See https://issues.apache.org/jira/browse/GERONIMO-3896


tomcat complains:
Servlet.service() for servlet SimpleDispatchServlet threw exception
javax.servlet.ServletException: Original SevletResponse or wrapped original ServletResponse not passed to
RequestDispatcher in violation of SRV.8.2 and SRV.
        at org.apache.catalina.core.ApplicationDispatcher.checkSameObjects(ApplicationDispatcher.java:985)

The relevant code seems to be in javax.servlet.http.HttpServlet

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

which is fine but

class NoBodyResponse implements HttpServletResponse {

rather than
class NoBodyResponse extends HttpServletResponseWrapper {

The patch attached to the jira issue makes this change and adapts NoBodyResponse to be a subclass of HttpServletResponseWrapper and the user reports that it fixes the problem.   I don't know if there would be formatting issues applying the patch to tomcat's copy of the spec classes.
Comment 1 Mark Thomas 2008-03-09 10:25:16 UTC
Thanks for the patch. It has been applied to trunk and proposed for 6.0.x (and 5.5.x and 4.1.x)
Comment 2 Mark Thomas 2008-03-19 16:16:36 UTC
This is fixed in 6.0.x and will be in 6.0.17 onwards.
Comment 3 Mark Thomas 2008-04-16 00:18:27 UTC
*** Bug 44829 has been marked as a duplicate of this bug. ***
Comment 4 Mark Thomas 2008-05-16 11:00:24 UTC
Still open for 5.5.x
Comment 5 Mark Thomas 2008-07-30 10:26:00 UTC
This has been fixed in 5.5.x and will be included in 5.5.27 onwards