[jboss-jira] [JBoss JIRA] (WFLY-4352) Servlet 3 - async-mode - onComplete not tirggered when JSP is dispatched
Stuart Douglas (JIRA)
issues at jboss.org
Sun Mar 29 21:10:19 EDT 2015
[ https://issues.jboss.org/browse/WFLY-4352?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stuart Douglas resolved WFLY-4352.
----------------------------------
Fix Version/s: 9.0.0.Beta2
Resolution: Done
> Servlet 3 - async-mode - onComplete not tirggered when JSP is dispatched
> ------------------------------------------------------------------------
>
> Key: WFLY-4352
> URL: https://issues.jboss.org/browse/WFLY-4352
> Project: WildFly
> Issue Type: Feature Request
> Components: Web (Undertow)
> Affects Versions: 8.2.0.Final
> Reporter: Günther Grill
> Assignee: Stuart Douglas
> Labels: async, asynchronous, jsp, servlet
> Fix For: 9.0.0.Beta2
>
> Attachments: AsyncServlet.war
>
>
> When a JSP is dispatched in a Async-Servlet, the {{AsyncListener#onComplete}} is never triggered.
> {code:title=AsyncServlet.java|borderStyle=solid}
> @WebServlet(urlPatterns = { "/AsyncServlet" }, asyncSupported = true)
> public class AsyncServlet extends HttpServlet {
> public AsyncServlet() {
> super();
> }
> @Override
> protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
> res.setContentType("text/html");
> final AsyncContext ac;
> if (req.isAsyncStarted()) {
> ac = req.getAsyncContext();
> } else {
> ac = req.startAsync();
> }
> ac.setTimeout(5000);
> ac.addListener(new AsyncListener() {
> @Override
> public void onTimeout(AsyncEvent event) throws IOException {
> System.out.println("onTimeout");
> }
> @Override
> public void onStartAsync(AsyncEvent event) throws IOException {
> System.out.println("onStartAsync");
> }
> @Override
> public void onError(AsyncEvent event) throws IOException {
> System.out.println("onError");
> }
> @Override
> public void onComplete(AsyncEvent event) throws IOException {
> System.out.println("onComplete");
> }
> });
> System.out.println("Calling JSP...");
> ac.dispatch("/result.jsp");
> System.out.println("After JSP call");
> }
> }
> {code}
> {code:title=result.jsp|borderStyle=solid}
> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
> pageEncoding="ISO-8859-1"%>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
> <title>AsyncServletTest</title>
> </head>
> <body>
> <p>JSP Content</p>
> <%
> System.out.println("Start JSP");
> Thread.sleep(1000); // sleep 1 seconds
> String resp = (String)request.getAttribute("result");
> resp = resp + "<p>on JSP</p>";
> Thread.sleep(1000); // sleep 1 seconds
> System.out.println("End JSP");
> %>
> <p><%=resp%></p>
> </body>
> </html>
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)
More information about the jboss-jira
mailing list