Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51229
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 19 May 2011 08:55:43 +0000 (08:55 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 19 May 2011 08:55:43 +0000 (08:55 +0000)
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
webapps/examples/WEB-INF/classes/async/Async0.java
webapps/examples/jsp/async/index.jsp

index 07494b9..576629b 100644 (file)
       <add>
         Add documentation for AJP-NIO connector. (markt/rjung)
       </add>
+      <fix>
+        <bug>51229</bug>: Fix bugs in the Servlet 3.0 asynchronous examples.
+        Patch provided by Eiji Takahashi. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Other">
index fabafe3..93dd0a0 100644 (file)
@@ -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();
index 5f53107..7ab54af 100644 (file)
@@ -65,5 +65,5 @@ Use cases:
  
  
 7. Stock ticker
-   <a href="<%=response.encodeURL("/examples/async/stock")%>"> StockTicker </a>
+   <a href="<%=response.encodeURL("/examples/async/stockticker")%>"> StockTicker </a>
 </pre>
\ No newline at end of file