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 2022/09/21 18:38:23 UTC
[Bug 66272] New: AsyncContextListener.onStartAsync is called before listener can be set
https://bz.apache.org/bugzilla/show_bug.cgi?id=66272
Bug ID: 66272
Summary: AsyncContextListener.onStartAsync is called before
listener can be set
Product: Tomcat 9
Version: 9.0.65
Hardware: PC
OS: Mac OS X 10.1
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
Assignee: dev@tomcat.apache.org
Reporter: a701440@gmail.com
Target Milestone: -----
There is currently no way to have the AsyncContextListener.onStartAsync
callback invoked. In order to set the AsyncContextListener on the AsyncContext
you need to have an instance of the AsyncContext. You can get it by calling
request.startAsync, this method immediately calls onStartAsync on the listener
before the listener could be set.
AsyncContextListener listener = new AsyncContextListener();
AsyncContext asyncContext = request.startAsync(); // calls onStartAsync
before listener could be set
asyncContext.addListener(listener);
--
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
[Bug 66272] AsyncContextListener.onStartAsync is called before listener can be set
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66272
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Mark Thomas <ma...@apache.org> ---
AsyncListener is not designed to work that way.
See the Servlet spec and/or Javadoc.
The Tomcat Javadoc for the Servlet API is even more explicit:
https://tomcat.apache.org/tomcat-10.1-doc/servletapi/jakarta/servlet/AsyncListener.html#onStartAsync(jakarta.servlet.AsyncEvent)
--
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