• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet 3.0. AsyncContext.dispatch()  RSS feed

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

The spec for Servlet 3.0 has three code samples illustrating AsyncContext.dispatch() behavior. Here is one of them:

//REQUEST to /url/A
//FORWARD to /url/B
Line 1: getRequestDispatcher("/url/B").forward(request, response);
Line 2: AsyncContext ac = request.startAsync();
Line 3: ac.dispatch(); //does ASYNC dispatch to /url/A

According to the spec, in this case "... the dispatch is to the URI of the request when it was last dispatched by the container." In my understanding, in the example above the request was last dispatched to /url/B (Line 1). Why is it that they insist the dispatch will be to /url/A (see comment to Line 3)? Is forwarding by a RequestDispatcher not considered to be container dispatching? That's the onyl explanation I could have. Am I right?

Your help is greatly appreciated
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!