Last active
August 29, 2015 14:12
-
-
Save maxant/e9898335b1c20300ec22 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@WebServlet(urlPatterns = { "/AsyncServlet3" }, asyncSupported = true) | |
public class AsyncServlet3 extends HttpServlet { | |
@EJB private Service4 service; | |
protected void doGet(HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { | |
... | |
final AsyncContext ctx = request.startAsync(request, response); | |
service.foo(s -> { | |
... | |
pw.write("</body></html>"); | |
response.flushBuffer(); | |
ctx.complete(); // all done, free resources | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment