From 2017de58165fa49ae659530f799228d79cb4e972 Mon Sep 17 00:00:00 2001 From: fhanik Date: Wed, 5 Aug 2009 23:58:18 +0000 Subject: [PATCH] path adjustments git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@801472 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/connector/AsyncContextImpl.java | 5 +++-- webapps/examples/WEB-INF/classes/async/Async0.java | 4 ++-- webapps/examples/jsp/async/async1.jsp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/java/org/apache/catalina/connector/AsyncContextImpl.java b/java/org/apache/catalina/connector/AsyncContextImpl.java index 8e232bdfa..b6abc96cf 100644 --- a/java/org/apache/catalina/connector/AsyncContextImpl.java +++ b/java/org/apache/catalina/connector/AsyncContextImpl.java @@ -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(); diff --git a/webapps/examples/WEB-INF/classes/async/Async0.java b/webapps/examples/WEB-INF/classes/async/Async0.java index 40797bfb2..777f077be 100644 --- a/webapps/examples/WEB-INF/classes/async/Async0.java +++ b/webapps/examples/WEB-INF/classes/async/Async0.java @@ -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 { diff --git a/webapps/examples/jsp/async/async1.jsp b/webapps/examples/jsp/async/async1.jsp index b2a2b6c07..ab3fd222e 100644 --- a/webapps/examples/jsp/async/async1.jsp +++ b/webapps/examples/jsp/async/async1.jsp @@ -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 -- 2.11.0