Hi guys,
On SWChan's blog (
https://weblogs.java.net/blog/swchan2/archive/2011/09/08/startasync-servlet-30)
it
says
AsyncListener#onStartAsync(AsyncEvent) will be invoked when the
AsyncContext is reinitialized, for instance, when AsyncContext#dispatch() is
invoked.
In the spec (3.1) it is mentioned that
java.lang.IllegalStateException should be thrown
if AsyncContext#startAsync() method is called again within the scope of the
same dispatch
When i have say servlet A and servlet B.
In Servlet A I do
AsyncContext ac = req.startAsync();
ac.addListener(myAsyncListener1);
ac.start(new Runnable() {
public void run() {
ac.dispatch("/b"); // /b is mapped to Servlet B
}
});
In Servlet B can I start another AsyncContext ?
I guess i am wondering what is the scope of "the same dispatch" in this
context? Would be glad if someone could point out what i've missed in the
spec.
Thanks
Toby