tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1137381 - in /tomcat/trunk/java/org/apache/coyote: ./ ajp/ http11/
Date Sun, 19 Jun 2011 15:50:17 GMT
Author: markt
Date: Sun Jun 19 15:50:17 2011
New Revision: 1137381

URL: http://svn.apache.org/viewvc?rev=1137381&view=rev
Log:
Pull up more common code in Processor constructors

Modified:
    tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java
    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
    tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
    tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
    tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
    tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java

Modified: tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java?rev=1137381&r1=1137380&r2=1137381&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java Sun Jun 19 15:50:17 2011
@@ -26,15 +26,26 @@ import org.apache.tomcat.util.net.Abstra
  */
 public abstract class AbstractProcessor implements ActionHook, Processor {
 
-    protected AbstractEndpoint endpoint;
-    protected Request request = null;
-    protected Response response = null;
+    protected Adapter adapter;
+    protected final AsyncStateMachine asyncStateMachine;
+    protected final AbstractEndpoint endpoint;
+    protected final Request request;
+    protected final Response response;
 
     
     public AbstractProcessor(AbstractEndpoint endpoint) {
         this.endpoint = endpoint;
+        asyncStateMachine = new AsyncStateMachine(this);
+        
+        request = new Request();
+
+        response = new Response();
+        response.setHook(this);
+        request.setResponse(response);
+
     }
 
+
     /**
      * The endpoint receiving connections that are handled by this processor.
      */
@@ -51,6 +62,27 @@ public abstract class AbstractProcessor 
     }
 
 
+    /**
+     * Set the associated adapter.
+     *
+     * @param adapter the new adapter
+     */
+    public void setAdapter(Adapter adapter) {
+        this.adapter = adapter;
+    }
+
+
+    /**
+     * Get the associated adapter.
+     *
+     * @return the associated adapter
+     */
+    public Adapter getAdapter() {
+        return adapter;
+    }
+
+
+
     /*
      * Expose selected endpoint attributes through the processor
      */

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=1137381&r1=1137380&r2=1137381&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Sun Jun 19 15:50:17
2011
@@ -28,13 +28,10 @@ import java.util.concurrent.atomic.Atomi
 
 import org.apache.coyote.AbstractProcessor;
 import org.apache.coyote.ActionCode;
-import org.apache.coyote.Adapter;
 import org.apache.coyote.AsyncContextCallback;
-import org.apache.coyote.AsyncStateMachine;
 import org.apache.coyote.InputBuffer;
 import org.apache.coyote.Request;
 import org.apache.coyote.RequestInfo;
-import org.apache.coyote.Response;
 import org.apache.juli.logging.Log;
 import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.buf.ByteChunk;
@@ -118,12 +115,6 @@ public abstract class AbstractAjpProcess
 
 
     /**
-     * Associated adapter.
-     */
-    protected Adapter adapter = null;
-
-
-    /**
      * AJP packet size.
      */
     protected int packetSize;
@@ -210,12 +201,6 @@ public abstract class AbstractAjpProcess
     
     
     /**
-     * Track changes in state for async requests.
-     */
-    protected AsyncStateMachine asyncStateMachine = new AsyncStateMachine(this);
-
-
-    /**
      * Bytes written to client for the current request
      */
     protected long byteCount = 0;
@@ -229,12 +214,8 @@ public abstract class AbstractAjpProcess
 
         this.packetSize = packetSize;
 
-        request = new Request();
         request.setInputBuffer(new SocketInputBuffer());
         
-        response = new Response();
-        request.setResponse(response);
-
         requestHeaderMessage = new AjpMessage(packetSize);
         responseHeaderMessage = new AjpMessage(packetSize);
         bodyMessage = new AjpMessage(packetSize);
@@ -509,29 +490,6 @@ public abstract class AbstractAjpProcess
        byteCount = 0;
    }
    
-   // ------------------------------------------------------ Connector Methods
-
-
-   /**
-    * Set the associated adapter.
-    *
-    * @param adapter the new adapter
-    */
-   public void setAdapter(Adapter adapter) {
-       this.adapter = adapter;
-   }
-
-
-   /**
-    * Get the associated adapter.
-    *
-    * @return the associated adapter
-    */
-   public Adapter getAdapter() {
-       return adapter;
-   }
-   
-   
    // ------------------------------------------------------ Protected Methods
 
 

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=1137381&r1=1137380&r2=1137381&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Sun Jun 19 15:50:17 2011
@@ -70,7 +70,6 @@ public class AjpAprProcessor extends Abs
 
         super(packetSize, endpoint);
 
-        response.setHook(this);
         response.setOutputBuffer(new SocketOutputBuffer());
 
         // Set the get body message buffer

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=1137381&r1=1137380&r2=1137381&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java Sun Jun 19 15:50:17 2011
@@ -63,7 +63,6 @@ public class AjpNioProcessor extends Abs
 
         super(packetSize, endpoint);
 
-        response.setHook(this);
         response.setOutputBuffer(new SocketOutputBuffer());
 
         pool = endpoint.getSelectorPool();

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=1137381&r1=1137380&r2=1137381&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Sun Jun 19 15:50:17 2011
@@ -69,7 +69,6 @@ public class AjpProcessor extends Abstra
 
         super(packetSize, endpoint);
 
-        response.setHook(this);
         response.setOutputBuffer(new SocketOutputBuffer());
 
         // Set the get body message buffer

Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1137381&r1=1137380&r2=1137381&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Sun Jun 19 15:50:17
2011
@@ -23,9 +23,7 @@ import java.util.regex.Pattern;
 
 import org.apache.coyote.AbstractProcessor;
 import org.apache.coyote.ActionCode;
-import org.apache.coyote.Adapter;
 import org.apache.coyote.AsyncContextCallback;
-import org.apache.coyote.AsyncStateMachine;
 import org.apache.coyote.http11.filters.BufferedInputFilter;
 import org.apache.coyote.http11.filters.ChunkedInputFilter;
 import org.apache.coyote.http11.filters.ChunkedOutputFilter;
@@ -62,11 +60,6 @@ public abstract class AbstractHttp11Proc
      * are skipped when looking for pluggable filters. 
      */
     private int pluggableFilterIndex = Integer.MAX_VALUE;
-    
-    /**
-     * Associated adapter.
-     */
-    protected Adapter adapter = null;
 
 
     /**
@@ -219,12 +212,6 @@ public abstract class AbstractHttp11Proc
     protected String server = null;
 
     
-    /**
-     * Track changes in state for async requests.
-     */
-    protected AsyncStateMachine asyncStateMachine = new AsyncStateMachine(this);
-
-
     public AbstractHttp11Processor(AbstractEndpoint endpoint) {
         super(endpoint);
     }
@@ -500,26 +487,6 @@ public abstract class AbstractHttp11Proc
 
 
     /**
-     * Set the associated adapter.
-     *
-     * @param adapter the new adapter
-     */
-    public void setAdapter(Adapter adapter) {
-        this.adapter = adapter;
-    }
-
-
-    /**
-     * Get the associated adapter.
-     *
-     * @return the associated adapter
-     */
-    public Adapter getAdapter() {
-        return adapter;
-    }
-
-
-    /**
      * Check if the resource could be compressed, if the client supports it.
      */
     private boolean isCompressable() {

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=1137381&r1=1137380&r2=1137381&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java Sun Jun 19 15:50:17
2011
@@ -25,9 +25,7 @@ import java.security.cert.X509Certificat
 import java.util.Locale;
 
 import org.apache.coyote.ActionCode;
-import org.apache.coyote.Request;
 import org.apache.coyote.RequestInfo;
-import org.apache.coyote.Response;
 import org.apache.coyote.http11.filters.BufferedInputFilter;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -70,15 +68,11 @@ public class Http11AprProcessor extends 
 
         super(endpoint);
         
-        request = new Request();
         inputBuffer = new InternalAprInputBuffer(request, headerBufferSize);
         request.setInputBuffer(inputBuffer);
 
-        response = new Response();
-        response.setHook(this);
         outputBuffer = new InternalAprOutputBuffer(response, headerBufferSize);
         response.setOutputBuffer(outputBuffer);
-        request.setResponse(response);
 
         initializeFilters(maxTrailerSize);
 

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=1137381&r1=1137380&r2=1137381&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Sun Jun 19 15:50:17
2011
@@ -25,9 +25,7 @@ import java.util.Locale;
 import javax.net.ssl.SSLEngine;
 
 import org.apache.coyote.ActionCode;
-import org.apache.coyote.Request;
 import org.apache.coyote.RequestInfo;
-import org.apache.coyote.Response;
 import org.apache.coyote.http11.filters.BufferedInputFilter;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -74,15 +72,11 @@ public class Http11NioProcessor extends 
 
         super(endpoint);
 
-        request = new Request();
         inputBuffer = new InternalNioInputBuffer(request, maxHttpHeaderSize);
         request.setInputBuffer(inputBuffer);
 
-        response = new Response();
-        response.setHook(this);
         outputBuffer = new InternalNioOutputBuffer(response, maxHttpHeaderSize);
         response.setOutputBuffer(outputBuffer);
-        request.setResponse(response);
 
         initializeFilters(maxTrailerSize);
 

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java?rev=1137381&r1=1137380&r2=1137381&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java Sun Jun 19 15:50:17 2011
@@ -25,9 +25,7 @@ import java.net.Socket;
 import java.util.Locale;
 
 import org.apache.coyote.ActionCode;
-import org.apache.coyote.Request;
 import org.apache.coyote.RequestInfo;
-import org.apache.coyote.Response;
 import org.apache.coyote.http11.filters.BufferedInputFilter;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -65,15 +63,11 @@ public class Http11Processor extends Abs
 
         super(endpoint);
         
-        request = new Request();
         inputBuffer = new InternalInputBuffer(request, headerBufferSize);
         request.setInputBuffer(inputBuffer);
 
-        response = new Response();
-        response.setHook(this);
         outputBuffer = new InternalOutputBuffer(response, headerBufferSize);
         response.setOutputBuffer(outputBuffer);
-        request.setResponse(response);
 
         initializeFilters(maxTrailerSize);
 



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


Mime
View raw message