path adjustments
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 5 Aug 2009 23:58:18 +0000 (23:58 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 5 Aug 2009 23:58:18 +0000 (23:58 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@801472 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/connector/AsyncContextImpl.java
webapps/examples/WEB-INF/classes/async/Async0.java
webapps/examples/jsp/async/async1.jsp

index 8e232bd..b6abc96 100644 (file)
@@ -84,6 +84,8 @@ public class AsyncContextImpl implements AsyncContext {
     public void dispatch() {
         HttpServletRequest sr = (HttpServletRequest)getServletRequest();
         String path = sr.getRequestURI();
+        String cpath = sr.getContextPath();
+        if (cpath.length()>1) path = path.substring(cpath.length());
         dispatch(path);
     }
 
@@ -267,8 +269,7 @@ public class AsyncContextImpl implements AsyncContext {
             //this is the same as
             //request.startAsync().complete();
             recycle();
-        } else if (state.compareAndSet(AsyncState.DISPATCHED, AsyncState.NOT_STARTED) ||
-                   state.compareAndSet(AsyncState.COMPLETING, AsyncState.NOT_STARTED)) {
+        } else if (state.compareAndSet(AsyncState.COMPLETING, AsyncState.NOT_STARTED)) {
             for (AsyncListenerWrapper wrapper : listeners) {
                 try {
                     wrapper.fireOnComplete();
index 40797bf..777f077 100644 (file)
@@ -38,11 +38,11 @@ public class Async0 extends HttpServlet {
             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\n");
+            resp.getWriter().write("Async dispatch worked:+"+System.currentTimeMillis()+"\n");
         } else {
             resp.setContentType("text/plain");
             final AsyncContext actx = req.startAsync();
-            actx.setAsyncTimeout(30*1000);
+            actx.setAsyncTimeout(Long.MAX_VALUE);
             Runnable run = new Runnable() {
                 public void run() {
                     try {
index b2a2b6c..ab3fd22 100644 (file)
@@ -7,4 +7,4 @@ System.out.println("Inside Async 1");
     request.getAsyncContext().complete();
   }
 %>
-Completed async request.
\ No newline at end of file
+Completed async request at <%=new java.sql.Date()%>
\ No newline at end of file