--- /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;
+
+import org.apache.tomcat.util.net.AbstractEndpoint;
+
+public abstract class AbstractProcessor implements ActionHook, Processor {
+
+ protected AbstractEndpoint endpoint;
+
+ protected AbstractEndpoint getEndpoint() {
+ return endpoint;
+ }
+}
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.coyote.AbstractProcessor;
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;
import org.apache.coyote.Request;
import org.apache.coyote.Response;
import org.apache.juli.logging.Log;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.HttpMessages;
import org.apache.tomcat.util.http.MimeHeaders;
-import org.apache.tomcat.util.net.AbstractEndpoint;
import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState;
import org.apache.tomcat.util.net.SSLSupport;
import org.apache.tomcat.util.res.StringManager;
/**
* Base class for AJP Processor implementations.
*/
-public abstract class AbstractAjpProcessor implements ActionHook, Processor {
+public abstract class AbstractAjpProcessor extends AbstractProcessor {
protected abstract Log getLog();
/**
- * Associated endpoint.
- */
- protected AbstractEndpoint endpoint;
-
-
- /**
* Request object.
*/
protected Request request = null;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Pattern;
+import org.apache.coyote.AbstractProcessor;
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;
import org.apache.coyote.Response;
import org.apache.coyote.http11.filters.BufferedInputFilter;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.FastHttpDateFormat;
import org.apache.tomcat.util.http.MimeHeaders;
-import org.apache.tomcat.util.net.AbstractEndpoint;
import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState;
import org.apache.tomcat.util.res.StringManager;
-public abstract class AbstractHttp11Processor implements ActionHook, Processor {
+public abstract class AbstractHttp11Processor extends AbstractProcessor {
protected abstract Log getLog();
}
- abstract AbstractEndpoint getEndpoint();
abstract boolean prepareSendfile(OutputFilter[] outputFilters);
public void endRequest() {
import org.apache.tomcat.util.buf.HexUtils;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.MimeHeaders;
-import org.apache.tomcat.util.net.AbstractEndpoint;
import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState;
import org.apache.tomcat.util.net.AprEndpoint;
import org.apache.tomcat.util.net.SSLSupport;
/**
- * Associated endpoint.
- */
- protected AprEndpoint endpoint;
- @Override
- protected AbstractEndpoint getEndpoint() {
- return endpoint;
- }
-
-
- /**
* When client certificate information is presented in a form other than
* instances of {@link java.security.cert.X509Certificate} it needs to be
* converted before it can be used and this property controls which JSSE
// and the method should return true
openSocket = true;
// Add the socket to the poller
- endpoint.getPoller().add(socketRef);
+ ((AprEndpoint)endpoint).getPoller().add(socketRef);
if (endpoint.isPaused()) {
// 503 - Service unavailable
response.setStatus(503);
if (sendfileData != null && !error) {
sendfileData.socket = socketRef;
sendfileData.keepAlive = keepAlive;
- if (!endpoint.getSendfile().add(sendfileData)) {
+ if (!((AprEndpoint)endpoint).getSendfile().add(sendfileData)) {
openSocket = true;
break;
}
try {
// Configure connection to require a certificate
SSLSocket.setVerify(socketRef, SSL.SSL_CVERIFY_REQUIRE,
- endpoint.getSSLVerifyDepth());
+ ((AprEndpoint)endpoint).getSSLVerifyDepth());
// Renegotiate certificates
if (SSLSocket.renegotiate(socketRef) == 0) {
// Don't look for certs unless we know renegotiation worked.
} else if (actionCode == ActionCode.COMET_END) {
comet = false;
} else if (actionCode == ActionCode.COMET_CLOSE) {
- endpoint.processSocketAsync(this.socket, SocketStatus.OPEN);
+ ((AprEndpoint)endpoint).processSocketAsync(this.socket,
+ SocketStatus.OPEN);
} else if (actionCode == ActionCode.COMET_SETTIMEOUT) {
//no op
} else if (actionCode == ActionCode.ASYNC_COMPLETE) {
if (asyncStateMachine.asyncComplete()) {
- endpoint.processSocketAsync(this.socket, SocketStatus.OPEN);
+ ((AprEndpoint)endpoint).processSocketAsync(this.socket,
+ SocketStatus.OPEN);
}
} else if (actionCode == ActionCode.ASYNC_SETTIMEOUT) {
if (param==null) return;
socket.setTimeout(timeout);
} else if (actionCode == ActionCode.ASYNC_DISPATCH) {
if (asyncStateMachine.asyncDispatch()) {
- endpoint.processSocketAsync(this.socket, SocketStatus.OPEN);
+ ((AprEndpoint)endpoint).processSocketAsync(this.socket,
+ SocketStatus.OPEN);
}
}
import org.apache.tomcat.util.buf.HexUtils;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.MimeHeaders;
-import org.apache.tomcat.util.net.AbstractEndpoint;
import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState;
import org.apache.tomcat.util.net.NioChannel;
import org.apache.tomcat.util.net.NioEndpoint;
protected NioChannel socket = null;
- /**
- * Associated endpoint.
- */
- protected NioEndpoint endpoint;
-
-
- // ------------------------------------------------------------- Properties
-
- /**
- * Expose the endpoint.
- */
- @Override
- protected AbstractEndpoint getEndpoint() {
- return endpoint;
- }
-
-
// --------------------------------------------------------- Public Methods
this.socket = socket;
inputBuffer.setSocket(socket);
outputBuffer.setSocket(socket);
- inputBuffer.setSelectorPool(endpoint.getSelectorPool());
- outputBuffer.setSelectorPool(endpoint.getSelectorPool());
+ inputBuffer.setSelectorPool(((NioEndpoint)endpoint).getSelectorPool());
+ outputBuffer.setSelectorPool(((NioEndpoint)endpoint).getSelectorPool());
// Error flag
error = false;
engine.setNeedClientAuth(true);
try {
sslChannel.rehandshake(endpoint.getSoTimeout());
- sslSupport =
- endpoint.getHandler().getSslImplementation().getSSLSupport(
- engine.getSession());
+ sslSupport = ((NioEndpoint)endpoint).getHandler()
+ .getSslImplementation().getSSLSupport(
+ engine.getSession());
} catch (IOException ioe) {
log.warn(sm.getString("http11processor.socket.sslreneg",ioe));
}
attach.setTimeout(timeout);
} else if (actionCode == ActionCode.ASYNC_COMPLETE) {
if (asyncStateMachine.asyncComplete()) {
- endpoint.processSocket(this.socket, SocketStatus.OPEN, true);
+ ((NioEndpoint)endpoint).processSocket(this.socket,
+ SocketStatus.OPEN, true);
}
} else if (actionCode == ActionCode.ASYNC_SETTIMEOUT) {
if (param==null) return;
attach.setTimeout(timeout);
} else if (actionCode == ActionCode.ASYNC_DISPATCH) {
if (asyncStateMachine.asyncDispatch()) {
- endpoint.processSocket(this.socket, SocketStatus.OPEN, true);
+ ((NioEndpoint)endpoint).processSocket(this.socket,
+ SocketStatus.OPEN, true);
}
}
}
import org.apache.tomcat.util.buf.HexUtils;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.MimeHeaders;
-import org.apache.tomcat.util.net.AbstractEndpoint;
import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState;
import org.apache.tomcat.util.net.JIoEndpoint;
import org.apache.tomcat.util.net.SSLSupport;
/**
- * Associated endpoint.
- */
- protected JIoEndpoint endpoint;
-
-
- /**
* The percentage of threads that have to be in use before keep-alive is
* disabled to aid scalability.
*/
/**
- * Expose the endpoint.
- */
- @Override
- protected AbstractEndpoint getEndpoint() {
- return this.endpoint;
- }
-
- /**
* Set the SSL information for this HTTP connection.
*/
public void setSSLSupport(SSLSupport sslSupport) {
}
} else if (actionCode == ActionCode.ASYNC_COMPLETE) {
if (asyncStateMachine.asyncComplete()) {
- endpoint.processSocketAsync(this.socket, SocketStatus.OPEN);
+ ((JIoEndpoint) endpoint).processSocketAsync(this.socket,
+ SocketStatus.OPEN);
}
} else if (actionCode == ActionCode.ASYNC_SETTIMEOUT) {
if (param == null) return;
socket.setTimeout(timeout);
} else if (actionCode == ActionCode.ASYNC_DISPATCH) {
if (asyncStateMachine.asyncDispatch()) {
- endpoint.processSocketAsync(this.socket, SocketStatus.OPEN);
+ ((JIoEndpoint) endpoint).processSocketAsync(this.socket,
+ SocketStatus.OPEN);
}
}
}