-
Bug
-
Resolution: Done
-
Major
-
1.0.0.Alpha7
-
None
When an async request processing is started and then dispatched back to the servlet container, AsyncEvent.getAsyncContext() returns null within any AsyncListener invocation (onComplete, onError).
This is because the HttpServletRequestImpl.asyncContext field is set to null within HttpServletRequestImplasyncRequestDispatched() which is called as part of dispatching async request. This causes a problem as the AsyncContext is needed on AsyncListener. Therefore, AsyncContext should not probably be kept in a field but rather put into a stack (since the servlet to which the request is dispatched could in theory also start async processing and so on...).
The problem can be reproduced by the test: AsyncListenerOnErrorTest.testAsyncListenerOnErrorInvoked2()
Note that the test passes but NPE can be seen in the log.