Details
Description
I have Servlet with use RequestDispatcher.include()/forward() to JSP.
My Servlet extends HttpServlet. I don`t overwrite doHead() method.
While processing HEAD method following exception throws:
09:18:57,647 ERROR [[SimpleDispatchServlet]] 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) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:493) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481) at com.km.webapp.test.simple.SimpleDispatchServlet.doGet(SimpleDispatchServlet.java:26) at javax.servlet.http.HttpServlet.doHead(HttpServlet.java:274) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:806) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSubjectValve.java:56) at org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:353) at org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619)
Exploring code I found that Tomcat`s implementation of RequestDispatcher expects that passed Response/Request objects is original objects or is wrapped by ServletRequestWrapper/ServletResponseWrapper. But geronimo-servlet_2.5_spec/HttpServlet.java#doHead() use NoBodyResponse class which is not instance of ServletResponseWrapper. So, exception thrown.