From: markt Date: Sun, 21 Mar 2010 14:13:40 +0000 (+0000) Subject: Fix a couple of ASync issues that were causing Servlet 3.0 TCK test failures. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=eefc877bb64a59092621aaa48a2dbf4eeca44301;p=tomcat7.0 Fix a couple of ASync issues that were causing Servlet 3.0 TCK test failures. 1. The complete method can be invoked by the container if the request is dispatched to a servlet that does not support async processing, or the target servlet called by AsyncContext.dispatch does not do a subsequent call to startAsync. In this case, it is the container's responsibility to call complete() as soon as that servlet's service method is exited. 2. public boolean isAsyncStarted() - Returns true if async processing has started on this request, and false otherwise. If this request has been dispatched using one of the AsyncContext.dispatch methods since it was put in asynchronous mode, or a call to AsynContext.complete is made, this method returns false. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@925769 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/core/AsyncContextImpl.java b/java/org/apache/catalina/core/AsyncContextImpl.java index 2bb74360f..a77307815 100644 --- a/java/org/apache/catalina/core/AsyncContextImpl.java +++ b/java/org/apache/catalina/core/AsyncContextImpl.java @@ -144,7 +144,9 @@ public class AsyncContextImpl implements AsyncContext { throw new RuntimeException(ix); } } - + if (state.get().equals(AsyncState.DISPATCHED)) { + complete(); + } } else { throw new IllegalStateException("Dispatch not allowed. Invalid state:"+state.get()); } @@ -237,7 +239,7 @@ public class AsyncContextImpl implements AsyncContext { } public boolean isStarted() { - return (state.get()!=AsyncState.NOT_STARTED); + return (state.get() == AsyncState.STARTED); } public void setStarted(Context context) {