tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1713255 - in /tomcat/trunk/java/org/apache/coyote: AbstractProtocol.java ajp/AbstractAjpProtocol.java http11/AbstractHttp11Protocol.java
Date Sun, 08 Nov 2015 16:53:21 GMT
Author: markt
Date: Sun Nov  8 16:53:21 2015
New Revision: 1713255

URL: http://svn.apache.org/viewvc?rev=1713255&view=rev
Log:
Move UpgradeProcessor creation from the ConnectionHandler to the
Protocol

Modified:
    tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java
    tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
    tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Protocol.java

Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java?rev=1713255&r1=1713254&r2=1713255&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java Sun Nov  8 16:53:21 2015
@@ -428,6 +428,11 @@ public abstract class AbstractProtocol<S
     protected abstract Processor createProcessor();
 
 
+    protected abstract Processor createUpgradeProcessor(
+            SocketWrapperBase<?> socket, ByteBuffer leftoverInput,
+            UpgradeToken upgradeToken) throws IOException;
+
+
     // ----------------------------------------------------- JMX related methods
 
     protected String domain;
@@ -756,7 +761,7 @@ public abstract class AbstractProtocol<S
                         // Release the Http11 processor to be re-used
                         release(wrapper, processor, false);
                         // Create the upgrade processor
-                        processor = createUpgradeProcessor(
+                        processor = getProtocol().createUpgradeProcessor(
                                 wrapper, leftoverInput, upgradeToken);
                         // Mark the connection as upgraded
                         wrapper.setUpgraded(true);
@@ -933,11 +938,6 @@ public abstract class AbstractProtocol<S
         }
 
 
-        protected abstract Processor createUpgradeProcessor(
-                SocketWrapperBase<?> socket, ByteBuffer leftoverInput,
-                UpgradeToken upgradeToken) throws IOException;
-
-
         protected void register(Processor processor) {
             if (getProtocol().getDomain() != null) {
                 synchronized (this) {

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java?rev=1713255&r1=1713254&r2=1713255&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java Sun Nov  8 16:53:21 2015
@@ -169,6 +169,14 @@ public abstract class AbstractAjpProtoco
     }
 
 
+    @Override
+    protected Processor createUpgradeProcessor(SocketWrapperBase<?> socket,
+            ByteBuffer leftoverInput, UpgradeToken upgradeToken) {
+        // TODO should fail - throw IOE
+        return null;
+    }
+
+
     protected static class AjpConnectionHandler<S>
             extends AbstractConnectionHandler<S,AjpProcessor> {
 
@@ -182,13 +190,5 @@ public abstract class AbstractAjpProtoco
         protected AbstractAjpProtocol<S> getProtocol() {
             return proto;
         }
-
-
-        @Override
-        protected AjpProcessor createUpgradeProcessor(SocketWrapperBase<?> socket,
-                ByteBuffer leftoverInput, UpgradeToken upgradeToken) {
-            // TODO should fail - throw IOE
-            return null;
-        }
     }
 }

Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Protocol.java?rev=1713255&r1=1713254&r2=1713255&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Protocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Protocol.java Sun Nov  8 16:53:21
2015
@@ -638,6 +638,20 @@ public abstract class AbstractHttp11Prot
     }
 
 
+    @Override
+    protected Processor createUpgradeProcessor(
+            SocketWrapperBase<?> socket, ByteBuffer leftoverInput,
+            UpgradeToken upgradeToken)
+            throws IOException {
+        HttpUpgradeHandler httpUpgradeHandler = upgradeToken.getHttpUpgradeHandler();
+        if (httpUpgradeHandler instanceof InternalHttpUpgradeHandler) {
+            return new UpgradeProcessorInternal(socket, leftoverInput, upgradeToken);
+        } else {
+            return new UpgradeProcessorExternal(socket, leftoverInput, upgradeToken);
+        }
+    }
+
+
     protected static class Http11ConnectionHandler<S>
             extends AbstractConnectionHandler<S,Http11Processor> {
 
@@ -653,19 +667,5 @@ public abstract class AbstractHttp11Prot
         protected AbstractHttp11Protocol<S> getProtocol() {
             return proto;
         }
-
-
-        @Override
-        protected Processor createUpgradeProcessor(
-                SocketWrapperBase<?> socket, ByteBuffer leftoverInput,
-                UpgradeToken upgradeToken)
-                throws IOException {
-            HttpUpgradeHandler httpUpgradeHandler = upgradeToken.getHttpUpgradeHandler();
-            if (httpUpgradeHandler instanceof InternalHttpUpgradeHandler) {
-                return new UpgradeProcessorInternal(socket, leftoverInput, upgradeToken);
-            } else {
-                return new UpgradeProcessorExternal(socket, leftoverInput, upgradeToken);
-            }
-        }
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message