A geronimo user has recently reported a problem forwarding/including HEAD requests and it looks like a bug to me.

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.

I wondered if there would be consensus that this is a bug and the proposed fix is appropriate?

thanks
david jencks

Reply via email to