Pull up common endpoint code in Processor constructors
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 19 Jun 2011 15:00:40 +0000 (15:00 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 19 Jun 2011 15:00:40 +0000 (15:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1137375 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/coyote/AbstractProcessor.java
java/org/apache/coyote/ajp/AbstractAjpProcessor.java
java/org/apache/coyote/http11/AbstractHttp11Processor.java
java/org/apache/coyote/http11/Http11AprProcessor.java
java/org/apache/coyote/http11/Http11NioProcessor.java
java/org/apache/coyote/http11/Http11Processor.java

index 54b136d..14e2ab1 100644 (file)
@@ -21,15 +21,23 @@ import java.util.concurrent.Executor;
 import org.apache.tomcat.util.net.AbstractEndpoint;
 
 /**
- * Provides attributes common to all support protocols (currently HTTP and AJP).
- * TODO: There are more attributes that can be pulled up
+ * Provides functionality and attributes common to all supported protocols
+ * (currently HTTP and AJP).
  */
 public abstract class AbstractProcessor implements ActionHook, Processor {
 
+    protected AbstractEndpoint endpoint;
+    protected Request request = null;
+    protected Response response = null;
+
+    
+    public AbstractProcessor(AbstractEndpoint endpoint) {
+        this.endpoint = endpoint;
+    }
+
     /**
      * The endpoint receiving connections that are handled by this processor.
      */
-    protected AbstractEndpoint endpoint;
     protected AbstractEndpoint getEndpoint() {
         return endpoint;
     }
@@ -38,18 +46,11 @@ public abstract class AbstractProcessor implements ActionHook, Processor {
     /**
      * The request associated with this processor.
      */
-    protected Request request = null;
     public Request getRequest() {
         return request;
     }
 
 
-    /**
-     * The response associated with this processor.
-     */
-    protected Response response = null;
-
-
     /*
      * Expose selected endpoint attributes through the processor
      */
index 17061c1..28c5db9 100644 (file)
@@ -224,8 +224,10 @@ public abstract class AbstractAjpProcessor extends AbstractProcessor {
     // ------------------------------------------------------------ Constructor
     
     public AbstractAjpProcessor(int packetSize, AbstractEndpoint endpoint) {
+        
+        super(endpoint);
+
         this.packetSize = packetSize;
-        this.endpoint = endpoint;
 
         request = new Request();
         request.setInputBuffer(new SocketInputBuffer());
index 677b711..ed3c8df 100644 (file)
@@ -43,6 +43,7 @@ import org.apache.tomcat.util.buf.HexUtils;
 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;
 
@@ -224,6 +225,11 @@ public abstract class AbstractHttp11Processor extends AbstractProcessor {
     protected AsyncStateMachine asyncStateMachine = new AsyncStateMachine(this);
 
 
+    public AbstractHttp11Processor(AbstractEndpoint endpoint) {
+        super(endpoint);
+    }
+
+
     /**
      * Set compression level.
      */
index 9926574..1c5ef3f 100644 (file)
@@ -68,7 +68,7 @@ public class Http11AprProcessor extends AbstractHttp11Processor {
     public Http11AprProcessor(int headerBufferSize, AprEndpoint endpoint,
             int maxTrailerSize) {
 
-        this.endpoint = endpoint;
+        super(endpoint);
         
         request = new Request();
         inputBuffer = new InternalAprInputBuffer(request, headerBufferSize);
index 4695103..7811cc0 100644 (file)
@@ -72,7 +72,7 @@ public class Http11NioProcessor extends AbstractHttp11Processor {
     public Http11NioProcessor(int maxHttpHeaderSize, NioEndpoint endpoint,
             int maxTrailerSize) {
 
-        this.endpoint = endpoint;
+        super(endpoint);
 
         request = new Request();
         inputBuffer = new InternalNioInputBuffer(request, maxHttpHeaderSize);
index 067f1bb..22b78cb 100644 (file)
@@ -63,7 +63,7 @@ public class Http11Processor extends AbstractHttp11Processor {
     public Http11Processor(int headerBufferSize, JIoEndpoint endpoint,
             int maxTrailerSize) {
 
-        this.endpoint = endpoint;
+        super(endpoint);
         
         request = new Request();
         inputBuffer = new InternalInputBuffer(request, headerBufferSize);