tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1137385 - in /tomcat/trunk/java/org/apache/coyote/ajp: AbstractAjpProcessor.java AjpAprProcessor.java AjpNioProcessor.java AjpProcessor.java
Date Sun, 19 Jun 2011 16:30:26 GMT
Author: markt
Date: Sun Jun 19 16:30:26 2011
New Revision: 1137385

URL: http://svn.apache.org/viewvc?rev=1137385&view=rev
Log:
Pull up getBody message

Modified:
    tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
    tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
    tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java
    tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java

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=1137385&r1=1137384&r2=1137385&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Sun Jun 19 16:30:26
2011
@@ -115,6 +115,13 @@ public abstract class AbstractAjpProcess
 
 
     /**
+     * GetBody message array. Not static like the other message arrays since the
+     * message varies with packetSize and that can vary per connector.
+     */
+    protected final byte[] getBodyMessageArray;
+
+
+    /**
      * AJP packet size.
      */
     protected int packetSize;
@@ -219,6 +226,18 @@ public abstract class AbstractAjpProcess
         requestHeaderMessage = new AjpMessage(packetSize);
         responseHeaderMessage = new AjpMessage(packetSize);
         bodyMessage = new AjpMessage(packetSize);
+        
+        // Set the getBody message buffer
+        AjpMessage getBodyMessage = new AjpMessage(16);
+        getBodyMessage.reset();
+        getBodyMessage.appendByte(Constants.JK_AJP13_GET_BODY_CHUNK);
+        // Adjust read size if packetSize != default (Constants.MAX_PACKET_SIZE)
+        getBodyMessage.appendInt(Constants.MAX_READ_SIZE + packetSize -
+                Constants.MAX_PACKET_SIZE);
+        getBodyMessage.end();
+        getBodyMessageArray = new byte[getBodyMessage.getLen()];
+        System.arraycopy(getBodyMessage.getBuffer(), 0, getBodyMessageArray, 
+                         0, getBodyMessage.getLen());
     }
 
     

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java?rev=1137385&r1=1137384&r2=1137385&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Sun Jun 19 16:30:26 2011
@@ -72,18 +72,6 @@ public class AjpAprProcessor extends Abs
 
         response.setOutputBuffer(new SocketOutputBuffer());
 
-        // Set the get body message buffer
-        AjpMessage getBodyMessage = new AjpMessage(16);
-        getBodyMessage.reset();
-        getBodyMessage.appendByte(Constants.JK_AJP13_GET_BODY_CHUNK);
-        // Adjust allowed size if packetSize != default (Constants.MAX_PACKET_SIZE)
-        getBodyMessage.appendInt(Constants.MAX_READ_SIZE + packetSize - Constants.MAX_PACKET_SIZE);
-        getBodyMessage.end();
-        getBodyMessageBuffer =
-            ByteBuffer.allocateDirect(getBodyMessage.getLen());
-        getBodyMessageBuffer.put(getBodyMessage.getBuffer(), 0,
-                                 getBodyMessage.getLen());
-
         // Allocate input and output buffers
         inputBuffer = ByteBuffer.allocateDirect(packetSize * 2);
         inputBuffer.limit(0);
@@ -119,12 +107,6 @@ public class AjpAprProcessor extends Abs
     protected ByteBuffer outputBuffer = null;
 
 
-    /**
-     * Direct buffer used for sending right away a get body message.
-     */
-    protected final ByteBuffer getBodyMessageBuffer;
-
-
     // --------------------------------------------------------- Public Methods
 
 
@@ -452,8 +434,8 @@ public class AjpAprProcessor extends Abs
         }
 
         // Request more data immediately
-        Socket.sendb(socket.getSocket().longValue(), getBodyMessageBuffer, 0,
-                getBodyMessageBuffer.position());
+        Socket.send(socket.getSocket().longValue(), getBodyMessageArray, 0,
+                getBodyMessageArray.length);
 
         boolean moreData = receive();
         if( !moreData ) {

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java?rev=1137385&r1=1137384&r2=1137385&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java Sun Jun 19 16:30:26 2011
@@ -67,17 +67,6 @@ public class AjpNioProcessor extends Abs
 
         pool = endpoint.getSelectorPool();
 
-        // Set the get body message buffer
-        AjpMessage getBodyMessage = new AjpMessage(16);
-        getBodyMessage.reset();
-        getBodyMessage.appendByte(Constants.JK_AJP13_GET_BODY_CHUNK);
-        // Adjust allowed size if packetSize != default (Constants.MAX_PACKET_SIZE)
-        getBodyMessage.appendInt(Constants.MAX_READ_SIZE + packetSize - Constants.MAX_PACKET_SIZE);
-        getBodyMessage.end();
-        getBodyMessageArray = new byte[getBodyMessage.getLen()];
-        System.arraycopy(getBodyMessage.getBuffer(), 0, getBodyMessageArray, 
-                         0, getBodyMessage.getLen());
-
         // Cause loading of HexUtils
         HexUtils.load();
 
@@ -102,12 +91,6 @@ public class AjpNioProcessor extends Abs
     protected NioSelectorPool pool;
 
 
-    /**
-     * Direct buffer used for sending right away a get body message.
-     */
-    protected final byte[] getBodyMessageArray;
-
-
     // --------------------------------------------------------- Public Methods
 
 

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=1137385&r1=1137384&r2=1137385&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Sun Jun 19 16:30:26 2011
@@ -71,17 +71,6 @@ public class AjpProcessor extends Abstra
 
         response.setOutputBuffer(new SocketOutputBuffer());
 
-        // Set the get body message buffer
-        AjpMessage getBodyMessage = new AjpMessage(16);
-        getBodyMessage.reset();
-        getBodyMessage.appendByte(Constants.JK_AJP13_GET_BODY_CHUNK);
-        // Adjust allowed size if packetSize != default (Constants.MAX_PACKET_SIZE)
-        getBodyMessage.appendInt(Constants.MAX_READ_SIZE + packetSize - Constants.MAX_PACKET_SIZE);
-        getBodyMessage.end();
-        getBodyMessageArray = new byte[getBodyMessage.getLen()];
-        System.arraycopy(getBodyMessage.getBuffer(), 0, getBodyMessageArray, 
-                         0, getBodyMessage.getLen());
-
         // Cause loading of HexUtils
         HexUtils.load();
 
@@ -112,15 +101,6 @@ public class AjpProcessor extends Abstra
     protected OutputStream output;
     
 
-    /**
-     * Direct buffer used for sending right away a get body message.
-     */
-    protected final byte[] getBodyMessageArray;
-
-
-    // ------------------------------------------------------------- Properties
-
-
     // --------------------------------------------------------- Public Methods
 
 



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


Mime
View raw message