Bug 44562 - HEAD requests cannot go through request dispatch include.
Summary: HEAD requests cannot go through request dispatch include.
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Servlet & JSP API (show other bugs)
Version: 5.5.26
Hardware: PC Mac OS X 10.4
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
: 44829 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-03-07 13:19 UTC by david jencks
Modified: 2008-07-30 10:26 UTC (History)
1 user (show)



Attachments

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

briefly...

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.14.2.5.1
        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);
	response.setContentLength();
    }


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