371903: Implement servlet 3.0 spec change (spec section 9.4) to not commit response in Dispatcher.forward() when request.isAysncStarted()
Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
parent
7a58f3408e
commit
265d35324a
|
@ -287,21 +287,9 @@ public class Dispatcher implements RequestDispatcher
|
|||
|
||||
_contextHandler.handle(_path,baseRequest, (HttpServletRequest)request, (HttpServletResponse)response);
|
||||
|
||||
if (baseRequest.getResponse().isWriting())
|
||||
if (!request.isAsyncStarted())
|
||||
{
|
||||
try {response.getWriter().close();}
|
||||
catch(IllegalStateException e)
|
||||
{
|
||||
response.getOutputStream().close();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try {response.getOutputStream().close();}
|
||||
catch(IllegalStateException e)
|
||||
{
|
||||
response.getWriter().close();
|
||||
}
|
||||
commitResponse(response,baseRequest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -320,6 +308,33 @@ public class Dispatcher implements RequestDispatcher
|
|||
}
|
||||
|
||||
|
||||
private void commitResponse(ServletResponse response, Request baseRequest) throws IOException
|
||||
{
|
||||
if (baseRequest.getResponse().isWriting())
|
||||
{
|
||||
try
|
||||
{
|
||||
response.getWriter().close();
|
||||
}
|
||||
catch (IllegalStateException e)
|
||||
{
|
||||
response.getOutputStream().close();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
response.getOutputStream().close();
|
||||
}
|
||||
catch (IllegalStateException e)
|
||||
{
|
||||
response.getWriter().close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
Loading…
Reference in New Issue