tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1144393 - in /tomcat/trunk/java/org/apache/coyote/ajp: AbstractAjpProcessor.java AbstractAjpProtocol.java LocalStrings.properties
Date Fri, 08 Jul 2011 17:28:26 GMT
Author: markt
Date: Fri Jul  8 17:28:25 2011
New Revision: 1144393

URL: http://svn.apache.org/viewvc?rev=1144393&view=rev
Log:
Align AJP and HTTP prior to pulling up Handler.process

Modified:
    tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
    tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java
    tomcat/trunk/java/org/apache/coyote/ajp/LocalStrings.properties

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java?rev=1144393&r1=1144392&r2=1144393&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Fri Jul  8 17:28:25
2011
@@ -213,6 +213,11 @@ public abstract class AbstractAjpProcess
     protected long byteCount = 0;
 
 
+    /**
+     * AJP does not support comet
+     */
+    protected final boolean comet = false;
+
     // ------------------------------------------------------------ Constructor
 
     public AbstractAjpProcessor(int packetSize, AbstractEndpoint endpoint) {
@@ -497,6 +502,13 @@ public abstract class AbstractAjpProcess
     }
 
 
+    @SuppressWarnings("unused")
+    public SocketState event(SocketStatus status) throws IOException {
+        // Should never reach this code but in case we do...
+        throw new IOException(
+                sm.getString("ajpprocessor.comet.notsupported"));
+    }
+
     /**
      * Recycle the processor, ready for the next request which may be on the
      * same connection or a different connection.

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=1144393&r1=1144392&r2=1144393&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProtocol.java Fri Jul  8 17:28:25 2011
@@ -104,10 +104,14 @@ public abstract class AbstractAjpProtoco
                     processor = createProcessor();
                 }
 
+                initSsl(socket, processor);
+
                 SocketState state = SocketState.CLOSED;
                 do {
                     if (processor.isAsync() || state == SocketState.ASYNC_END) {
                         state = processor.asyncDispatch(status);
+                    } else if (processor.comet) {
+                        state = processor.event(status);
                     } else {
                         state = processor.process(socket);
                     }
@@ -119,9 +123,9 @@ public abstract class AbstractAjpProtoco
 
                 if (state == SocketState.LONG) {
                     // In the middle of processing a request/response. Keep the
-                    // socket associated with the processor.
-                    connections.put(socket, processor);
-                    socket.setAsync(true);
+                    // socket associated with the processor. Exact requirements
+                    // depend on type of long poll
+                    longPoll(socket, processor);
                 } else if (state == SocketState.OPEN){
                     // In keep-alive but between requests. OK to recycle
                     // processor. Continue to poll for the next request.
@@ -155,6 +159,16 @@ public abstract class AbstractAjpProtoco
         }
         
         protected abstract P createProcessor();
+        @SuppressWarnings("unused")
+        protected void initSsl(SocketWrapper<S> socket, P processor) {
+            // NOOP for AJP
+        }
+        protected void longPoll(SocketWrapper<S> socket, P processor) {
+            // Same requirements for all AJP connectors
+            connections.put(socket, processor);
+            socket.setAsync(true);
+            
+        }
         protected abstract void release(SocketWrapper<S> socket, P processor,
                 boolean socketClosing, boolean addToPoller);
     }

Modified: tomcat/trunk/java/org/apache/coyote/ajp/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/LocalStrings.properties?rev=1144393&r1=1144392&r2=1144393&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/LocalStrings.properties Fri Jul  8 17:28:25 2011
@@ -39,6 +39,7 @@ ajpprocessor.request.prepare=Error prepa
 ajpprocessor.request.process=Error processing request
 ajpprocessor.certs.fail=Certificate conversion failed
 ajpprocessor.socket.info=Exception getting socket information
+ajpprocessor.comet.notsupported=The Comet protocol is not supported by this connector
 
 ajpmessage.null=Cannot append null value
 ajpmessage.overflow=Overflow error for buffer adding {0} bytes at position {1}



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


Mime
View raw message