[Prev] Thread [Next]  |  [Prev] Date [Next]

DO NOT REPLY [Bug 51197] sendError/sendRedirect don't work with AsyncContext bugzilla Fri Feb 17 11:00:51 2012


Zack Radick <[EMAIL PROTECTED]> changed:

           What    |Removed                     |Added
             Status|RESOLVED                    |REOPENED
            Version|7.0.14                      |7.0.25
         Resolution|FIXED                       |

--- Comment #3 from Zack Radick <[EMAIL PROTECTED]> 2012-02-17 18:34:07 UTC ---
I am seeing the same behavior with Tomcat 7.0.25.  Within an asynchronous
context this does not work as expected (the client does not receive any

HttpServletResponse response = (HttpServletResponse)asyncContext.getResponse();
response.sendError( responseCode, error );

However, this does (the client receives the error output with an appropriate
status code):

HttpServletResponse response = (HttpServletResponse)asyncContext.getResponse();
response.setStatus( responseCode );
response.getOutputStream().write( error.getBytes() );

In both cases the underlying ServletResponse has the appropriate status set,
but the results sent to the client differ.  I am using the default HTTP1.1

The behavior is reproducible in 7.0.16 as well (7.0.15 is no longer in the
archives it seems).  I also tried using the Writer (as opposed to the
OutputStream) to ensure that nothing had previously been written to the Stream,
but it exhibited the same behavior.

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]