Allow variable size of AJP message via packetSize=n in <Connector/>.
authorjfclere <jfclere@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 25 Oct 2006 10:18:02 +0000 (10:18 +0000)
committerjfclere <jfclere@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 25 Oct 2006 10:18:02 +0000 (10:18 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@467599 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/jk/common/ChannelSocket.java
java/org/apache/jk/common/JkInputStream.java
java/org/apache/jk/core/JkHandler.java
java/org/apache/jk/core/MsgContext.java

index 8bca7b2..592757d 100644 (file)
@@ -654,7 +654,7 @@ public class ChannelSocket extends JkHandler
             log.debug("Accepting ajp connections on " + port);
         while( running ) {
            try{
-                MsgContext ep=createMsgContext();
+                MsgContext ep=createMsgContext(packetSize);
                 ep.setSource(this);
                 ep.setWorkerEnv( wEnv );
                 this.accept(ep);
index f56e26c..7202605 100644 (file)
@@ -39,8 +39,8 @@ public class JkInputStream implements InputBuffer, OutputBuffer {
     private static org.apache.juli.logging.Log log=
         org.apache.juli.logging.LogFactory.getLog( JkInputStream.class );
 
-    private Msg bodyMsg = new MsgAjp();
-    private Msg outputMsg = new MsgAjp();
+    private Msg bodyMsg;
+    private Msg outputMsg;
     private MsgContext mc;
 
     
@@ -62,8 +62,16 @@ public class JkInputStream implements InputBuffer, OutputBuffer {
         }
     }
 
-    public JkInputStream(MsgContext context) {
+    public JkInputStream(MsgContext context, int bsize) {
         mc = context;
+        bodyMsg = new MsgAjp(bsize);
+        outputMsg = new MsgAjp(bsize);
+    }
+    /**
+     * @deprecated
+     */
+    public JkInputStream(MsgContext context) {
+        this(context, 8*1024);
     }
 
     // -------------------- Jk specific methods --------------------
index 1cadbc6..cdbe7e9 100644 (file)
@@ -111,9 +111,13 @@ public class JkHandler implements MBeanRegistration, NotificationListener {
     }
 
     public MsgContext createMsgContext() {
-        return new MsgContext();
+        return new MsgContext(8*1024);
     }
     
+    public MsgContext createMsgContext(int bsize) {
+        return new MsgContext(bsize);
+    }
+
     public int invoke(Msg msg, MsgContext mc )  throws IOException {
         return OK;
     }
index bd9e8d4..aa6d935 100644 (file)
@@ -53,7 +53,7 @@ public class MsgContext implements ActionHook {
     private Object notes[]=new Object[32];
     private JkHandler next;
     private JkChannel source;
-    private JkInputStream jkIS = new JkInputStream(this);
+    private JkInputStream jkIS;
     private C2BConverter c2b;
     private Request req;
     private WorkerEnv wEnv;
@@ -80,12 +80,19 @@ public class MsgContext implements ActionHook {
     public static final int JK_STATUS_CLOSED=2;
     public static final int JK_STATUS_ERROR=3;
 
-    public MsgContext() {
+    public MsgContext(int bsize) {
         try {
             c2b = new C2BConverter("iso-8859-1");
         } catch(IOException iex) {
             log.warn("Can't happen", iex);
         }
+        jkIS = new JkInputStream(this, bsize);
+    }
+    /**
+     * @deprecated
+     */
+    public MsgContext() {
+        this(8*1024);
     }
     
     public final Object getNote( int id ) {