When using Servlet asynchronous API if you want to dispatch the request back to a particular url -“/url” within the same Servlet Context which of the following API would you use?
A.
ASyncContext.dispatch();
B.
AsyncContext.dispatch(“/url”);
C.
AsyncContext.dispatch(servletContext, “/url”);
D.
AsyncContext.start(runnable);
E.
RequestDispatcher.fotward(“/url”);
F.
RequestDispatcher.forward(servletContext, “/url”);
G.
RequestDispatcher.include(“/url”);
Explanation:
http://blogs.oracle.com/enterprisetechtips/entry/asynchronous_support_in_servlet_3
(Topic: AsyncContext Class, third paragraph)
B
C
B
The dispatch() method, that is, the method with no arguments, forwards the request back to the original URL. Also, if a call to AsyncContext.dispatch or RequestDispatcher.forward occurs after an asynchronous context has been initialized, the dispatch() method forwards the request to the path for the AsyncContext or RequestDispatcher-related requests.
The dispatch(path) method forwards the request to the path relative to the context of the request.
The dispatch(ServletContext, path) method forwards the request to the path relative to the specified context. For example, here is a call that forwards the request back to the container so that the JSP framework can generate the response.