• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

when is the AsyncContext.complete method called when dispatching request to the container ?

 
gurpeet singh
Ranch Hand
Posts: 924
1
Fedora Java Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please refer servlet 3.0 specifications , section 2.3.3.3 asynchronous processing page 3. following is a paragraph from the above section

Dispatching from a servlet that has asyncSupported=true to one where
asyncSupported is set to false is allowed. In this case, the response will be
committed when the service method of the servlet that does not support async is
exited, and it is the container's responsibility to call complete on the
AsyncContext so that any interested AsyncListener instances will be notified.
The AsyncListener.onComplete notification should also be used by filters as a
mechanism to clear up resources that it has been holding on to for the async task to
complete.


my question is that suppose i have an asynchronous servlet that dispatches request to a jsp page. now suppose my long running process has completed and i called dispatch method and forwarded the request and response objects to the jsp page. now as the above paragraph says that response will be committed when the service method of the servlet that does not support async is exited(here jsp page will result in servlet). my question is that when will be AsyncContext.complete will be called ? before calling dispatch or after calling dispatch or after calling dispatch but before committing response or after committing response?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic