You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2010/01/06 13:26:33 UTC

DO NOT REPLY [Bug 48492] New: RequestDispatcher.include(...) jumps the queue of out.print()

https://issues.apache.org/bugzilla/show_bug.cgi?id=48492

           Summary: RequestDispatcher.include(...) jumps the queue of
                    out.print()
           Product: Tomcat 6
           Version: 6.0.16
          Platform: PC
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: major
          Priority: P2
         Component: Servlet & JSP API
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: mozilla@horz.de


The response of the including Servlet/JSP is always put after all responses
of all included Servlets/JSP:

B.jsp
---------------------------------------------------------
Line B
---------------------------------------------------------

ABC.jsp
---------------------------------------------------------
Line A
<% RequestDispatcher dispatcher = request.getRequestDispatcher("/B.jsp");
   dispatcher.include( request, response ); %>
Line C
---------------------------------------------------------

Expected Response of ABC.jsp:
---------------------------------------------------------
Line A
Line B
Line C
---------------------------------------------------------

Actual Response of ABC.jsp:
---------------------------------------------------------
Line B
Line A
Line C
---------------------------------------------------------

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48492] RequestDispatcher.include(...) jumps the queue of out.print()

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48492

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Mark Thomas <ma...@apache.org> 2010-01-06 07:14:12 GMT ---
Bugzilla is not the correct forum to ask questions about spec interpretation.
Please follow my previous advice and read the JSP spec (not the Servlet spec)
and if things are still not clear use the users list for further assistance.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48492] RequestDispatcher.include(...) jumps the queue of out.print()

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48492

Alexander Horz <mo...@horz.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |

--- Comment #2 from Alexander Horz <mo...@horz.de> 2010-01-06 07:10:48 UTC ---
> This is as expected. Search the JSP spec for "flush".
Could you please point out why the actual behaviour should be expected 
according to the spec?

IMHO, the actual result is NOT expected (cf. JavaTM Servlet Specification,
Version 2.5 MR6, p. 61):
------------------------------------------------------------------------
SRV.8.3    The Include Method

The include method of the RequestDispatcher interface may be called at
any time. The target servlet of the include method has access to all
aspects of the request object, but its use of the response object is
more limited.

It can only write information to the ServletOutputStream or Writer of
the response object and commit a response by writing content past the
end of the response buffer, or by explicitly calling the flushBuffer
method of the ServletResponse interface. It cannot set headers [...]
------------------------------------------------------------------------

In addition, you may find (on p. 62 of the spec.):
------------------------------------------------------------------------
SRV.8.4    The Forward Method

The forward method of the RequestDispatcher interface may be called
by the calling servlet only when no output has been committed to the
client. [...]
------------------------------------------------------------------------

These two occurences are the only two near to RequestDispatcher.include().
Could you please provide a page or section number where to look for?

Anyway, in both cases (includ() or forward()) the target servlet is
expected to write to the OutputStream or Writer of the calling servlet.
Hence, if the target servlet calls the flushBuffer method, the output
of the calling servlet is expected to be appear *before* the output of
the target servlet.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48492] RequestDispatcher.include(...) jumps the queue of out.print()

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48492

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Mark Thomas <ma...@apache.org> 2010-01-06 06:34:52 GMT ---
This is as expected. Search the JSP spec for "flush". If you need further
assistance please ask on the users list.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org