446506 getAsyncContext ISE before startAsync on async dispatches

This commit is contained in:
Greg Wilkins 2014-10-10 14:19:25 +11:00
parent f07387c703
commit 6a0e220b9c
2 changed files with 12 additions and 1 deletions

View File

@ -398,7 +398,7 @@ public class Request implements HttpServletRequest
public AsyncContext getAsyncContext()
{
HttpChannelState state = getHttpChannelState();
if (_async==null || state.isInitial() && !state.isAsync())
if (_async==null || !state.isAsyncStarted())
throw new IllegalStateException(state.getStatusString());
return _async;

View File

@ -583,6 +583,17 @@ public class AsyncServletTest
@Override
public void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException
{
// this should always fail at this point
try
{
request.getAsyncContext();
throw new IllegalStateException();
}
catch(IllegalStateException e)
{
// ignored
}
// System.err.println(request.getDispatcherType()+" "+request.getRequestURI());
response.addHeader("history",request.getDispatcherType()+" "+request.getRequestURI());
if (request instanceof ServletRequestWrapper || response instanceof ServletResponseWrapper)