import org.apache.catalina.Globals;
import org.apache.catalina.connector.Request;
import org.apache.coyote.ActionCode;
+import org.apache.coyote.AsyncContextCallback;
import org.apache.coyote.RequestInfo;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
* @author fhanik
*
*/
-public class AsyncContextImpl implements AsyncContext {
+public class AsyncContextImpl implements AsyncContext, AsyncContextCallback {
private static final Log log = LogFactory.getLog(AsyncContextImpl.class);
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.coyote;
+
+/**
+ * Provides a mechanism for the Coyote connectors to signal to a
+ * {@link javax.servlet.AsyncContext} implementation that an action, such as
+ * firing event listeners needs to be taken. It is implemented in this manner
+ * so that the org.apache.coyote package does not have a dependency on the
+ * org.apache.coyote package.
+ */
+public interface AsyncContextCallback {
+ public void fireOnComplete();
+}
import java.security.AccessController;
import java.security.PrivilegedAction;
-import org.apache.catalina.core.AsyncContextImpl;
import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState;
import org.apache.tomcat.util.res.StringManager;
private volatile AsyncState state = AsyncState.DISPATCHED;
// Need this to fire listener on complete
- private AsyncContextImpl asyncCtxt = null;
+ private AsyncContextCallback asyncCtxt = null;
private Processor processor;
}
- public synchronized void asyncStart(AsyncContextImpl asyncCtxt) {
+ public synchronized void asyncStart(AsyncContextCallback asyncCtxt) {
if (state == AsyncState.DISPATCHED) {
state = AsyncState.STARTING;
this.asyncCtxt = asyncCtxt;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean;
-import org.apache.catalina.core.AsyncContextImpl;
import org.apache.coyote.ActionCode;
import org.apache.coyote.ActionHook;
import org.apache.coyote.Adapter;
+import org.apache.coyote.AsyncContextCallback;
import org.apache.coyote.AsyncStateMachine;
import org.apache.coyote.InputBuffer;
import org.apache.coyote.Processor;
replay = true;
} else if (actionCode == ActionCode.ASYNC_START) {
- asyncStateMachine.asyncStart((AsyncContextImpl) param);
+ asyncStateMachine.asyncStart((AsyncContextCallback) param);
} else if (actionCode == ActionCode.ASYNC_DISPATCHED) {
asyncStateMachine.asyncDispatched();
} else if (actionCode == ActionCode.ASYNC_TIMEOUT) {
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
-import org.apache.catalina.core.AsyncContextImpl;
import org.apache.coyote.ActionCode;
import org.apache.coyote.ActionHook;
import org.apache.coyote.Adapter;
+import org.apache.coyote.AsyncContextCallback;
import org.apache.coyote.AsyncStateMachine;
import org.apache.coyote.Processor;
import org.apache.coyote.Request;
request.getInputBuffer();
internalBuffer.addActiveFilter(savedBody);
} else if (actionCode == ActionCode.ASYNC_START) {
- asyncStateMachine.asyncStart((AsyncContextImpl) param);
+ asyncStateMachine.asyncStart((AsyncContextCallback) param);
} else if (actionCode == ActionCode.ASYNC_DISPATCHED) {
asyncStateMachine.asyncDispatched();
} else if (actionCode == ActionCode.ASYNC_TIMEOUT) {