aspose file tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes doubt regarding complete() method of AsyncContext interface? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "doubt regarding complete() method of AsyncContext interface?" Watch "doubt regarding complete() method of AsyncContext interface?" New topic

doubt regarding complete() method of AsyncContext interface?

gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 924

on the servlet 3.0 specs at page no. 17 it says that complete method can throw IllegalStateException as is clear from the paragraph copied from the specs :

public void complete() - If request.startAsync is called then this
method MUST be called to complete the async processing and commit and
close the response. The complete method can be invoked by the container if
the request is dispatched to a servlet that does not support async processing, or
the target servlet called by AsyncContext.dispatch does not do a
subsequent call to startAsync. In this case, it is the container's responsibility
to call complete() as soon as that servlet's service method is exited. An
IllegalStateException MUST be thrown if startAsync was not called

if you look at the api-docs of complete() method , there is no clause regarding IllegalStateException . secondly the above paragraph is not clear. it says that if the servlet to which the request is DISPATCHED does not do startAsync then the container must call complete(). immediately in the next line ,it says that IllegalStateException must be thrown if startAsync is not called.

again i have downloaded the servlet 3.0 specs that says maintainence release rev a , december 2010. also i have final release of the specs whose date is december 2009. in crosschecked both the versions. am i reading the wrong version of specs or there is more updated spec(maybe errata). or am i totally misunderstanding the specs and the api docs. please help as i have already posted 3-4 questions back to back.

subject: doubt regarding complete() method of AsyncContext interface?
It's not a secret anymore!