From 8d4394da00e4cb098fe129fbcb4959758fb85831 Mon Sep 17 00:00:00 2001 From: markt Date: Thu, 19 May 2011 08:55:43 +0000 Subject: [PATCH] Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51229 Fix bugs in the Servlet 3.0 asynchronous examples. Patch provided by Eiji Takahashi. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1124614 13f79535-47bb-0310-9956-ffa450edef68 --- webapps/docs/changelog.xml | 4 ++++ webapps/examples/WEB-INF/classes/async/Async0.java | 2 +- webapps/examples/jsp/async/index.jsp | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 07494b903..576629bba 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -63,6 +63,10 @@ Add documentation for AJP-NIO connector. (markt/rjung) + + 51229: Fix bugs in the Servlet 3.0 asynchronous examples. + Patch provided by Eiji Takahashi. (markt) + diff --git a/webapps/examples/WEB-INF/classes/async/Async0.java b/webapps/examples/WEB-INF/classes/async/Async0.java index fabafe3d9..93dd0a0d4 100644 --- a/webapps/examples/WEB-INF/classes/async/Async0.java +++ b/webapps/examples/WEB-INF/classes/async/Async0.java @@ -37,9 +37,9 @@ public class Async0 extends HttpServlet { protected void service(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { if (Boolean.TRUE == req.getAttribute("dispatch")) { log.info("Received dispatch, completing on the worker thread."); - req.getAsyncContext().complete(); log.info("After complete called started:"+req.isAsyncStarted()); resp.getWriter().write("Async dispatch worked:+"+System.currentTimeMillis()+"\n"); + req.getAsyncContext().complete(); } else { resp.setContentType("text/plain"); final AsyncContext actx = req.startAsync(); diff --git a/webapps/examples/jsp/async/index.jsp b/webapps/examples/jsp/async/index.jsp index 5f53107a8..7ab54aff8 100644 --- a/webapps/examples/jsp/async/index.jsp +++ b/webapps/examples/jsp/async/index.jsp @@ -65,5 +65,5 @@ Use cases: 7. Stock ticker - "> StockTicker + "> StockTicker \ No newline at end of file -- 2.11.0