The javax.servlet.http.HttpServletRequest startAsync method allows the Servlet to handle requests asynchronously, meaning that the response is not immediately written but instead can be written at a later time.
2. Setting an AsyncContext listener for handling the response:
HttpServletRequest request = ...; if (request.isAsyncSupported()) { AsyncContext asyncCtx = request.startAsync(); asyncCtx.addListener(new AsyncListener() { public void onComplete(AsyncEvent event) throws IOException {} public void onError(AsyncEvent event) throws IOException {} public void onStartAsync(AsyncEvent event) throws IOException {} public void onTimeout(AsyncEvent event) throws IOException {} }); }
The javax.servlet.http package library is used for handling HTTP requests and responses in Java Servlets.
Java HttpServletRequest.startAsync - 30 examples found. These are the top rated real world Java examples of javax.servlet.http.HttpServletRequest.startAsync extracted from open source projects. You can rate examples to help us improve the quality of examples.