Author: markt
Date: Thu Aug 11 19:44:39 2016
New Revision: 1756036

URL: http://svn.apache.org/viewvc?rev=1756036&view=rev
Log:
Clean-up
No functional change

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProtocol.java
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Protocol.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java?rev=1756036&r1=1756035&r2=1756036&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Thu 
Aug 11 19:44:39 2016
@@ -344,13 +344,13 @@ public class AjpAprProcessor implements
      * provider is used to perform the conversion. For example it is used with
      * the AJP connectors, the HTTP APR connector and with the
      * {@link org.apache.catalina.valves.SSLValve}. If not specified, the
-     * default provider will be used. 
+     * default provider will be used.
      */
     protected String clientCertProvider = null;
     public String getClientCertProvider() { return clientCertProvider; }
     public void setClientCertProvider(String s) { this.clientCertProvider = s; 
}
 
-    
+
     // --------------------------------------------------------- Public Methods
 
 
@@ -537,7 +537,7 @@ public class AjpAprProcessor implements
                 // Send explicit flush message
                 if (Socket.sendb(socket, flushMessageBuffer, 0,
                                  flushMessageBuffer.position()) < 0) {
-                    error = true;                    
+                    error = true;
                 }
             } catch (IOException e) {
                 // Set error flag
@@ -677,7 +677,7 @@ public class AjpAprProcessor implements
         // Translate the HTTP method code to a String.
         byte methodCode = requestHeaderMessage.getByte();
         if (methodCode != Constants.SC_M_JK_STORED) {
-            String methodName = Constants.methodTransArray[(int)methodCode - 
1];
+            String methodName = Constants.methodTransArray[methodCode - 1];
             request.method().setString(methodName);
         }
 
@@ -919,7 +919,7 @@ public class AjpAprProcessor implements
      */
     public void parseHost(MessageBytes valueMB) {
 
-        if (valueMB == null || (valueMB != null && valueMB.isNull()) ) {
+        if (valueMB == null || valueMB.isNull()) {
             // HTTP/1.0
             request.setServerPort(request.getLocalPort());
             try {
@@ -993,8 +993,7 @@ public class AjpAprProcessor implements
      * When committing the response, we have to validate the set of headers, as
      * well as setup the response filters.
      */
-    protected void prepareResponse()
-        throws IOException {
+    protected void prepareResponse() throws IOException {
 
         response.setCommitted(true);
 
@@ -1007,7 +1006,7 @@ public class AjpAprProcessor implements
         if (org.apache.coyote.Constants.USE_CUSTOM_STATUS_MSG_IN_HEADER &&
                 HttpMessages.isSafeInHttpHeader(response.getMessage())) {
             message = response.getMessage();
-        } 
+        }
         if (message == null){
             message = HttpMessages.getMessage(response.getStatus());
         }
@@ -1036,7 +1035,7 @@ public class AjpAprProcessor implements
         // Other headers
         int numHeaders = headers.size();
         responseHeaderMessage.appendInt(numHeaders);
-        for (int i = 0; i < numHeaders; i++) {            
+        for (int i = 0; i < numHeaders; i++) {
             MessageBytes hN = headers.getName(i);
             int hC = Constants.getResponseAjpIndex(hN.toString());
             if (hC > 0) {
@@ -1081,7 +1080,7 @@ public class AjpAprProcessor implements
         if (first && request.getContentLengthLong() > 0) {
             receive();
         }
-        
+
         // Add the end message
         if (outputBuffer.position() + endMessageArray.length > 
outputBuffer.capacity()) {
             flush();
@@ -1227,7 +1226,6 @@ public class AjpAprProcessor implements
             boolean useAvailableData)
         throws IOException {
 
-        byte[] buf = message.getBuffer();
         int headerLength = message.getHeaderLength();
 
         if (first) {
@@ -1243,7 +1241,6 @@ public class AjpAprProcessor implements
         inputBuffer.get(message.getBuffer(), headerLength, message.getLen());
 
         return true;
-
     }
 
 

Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java?rev=1756036&r1=1756035&r2=1756036&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java Thu Aug 
11 19:44:39 2016
@@ -18,7 +18,6 @@
 package org.apache.coyote.ajp;
 
 import java.net.InetAddress;
-import java.net.URLEncoder;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.concurrent.ConcurrentLinkedQueue;
@@ -32,7 +31,6 @@ import javax.management.ObjectName;
 
 import org.apache.coyote.AbstractProtocol;
 import org.apache.coyote.ActionCode;
-import org.apache.coyote.ActionHook;
 import org.apache.coyote.Adapter;
 import org.apache.coyote.RequestGroupInfo;
 import org.apache.coyote.RequestInfo;
@@ -54,8 +52,8 @@ import org.apache.tomcat.util.res.String
  */
 public class AjpAprProtocol extends AbstractProtocol
     implements MBeanRegistration {
-    
-    
+
+
     protected static org.apache.juli.logging.Log log =
         org.apache.juli.logging.LogFactory.getLog(AjpAprProtocol.class);
 
@@ -77,13 +75,13 @@ public class AjpAprProtocol extends Abst
         setTcpNoDelay(Constants.DEFAULT_TCP_NO_DELAY);
     }
 
-    
+
     // ----------------------------------------------------- Instance Variables
 
 
     protected ObjectName tpOname;
-    
-    
+
+
     protected ObjectName rgOname;
 
 
@@ -92,6 +90,7 @@ public class AjpAprProtocol extends Abst
      */
     protected AprEndpoint endpoint = new AprEndpoint();
 
+    @Override
     protected final AbstractEndpoint getEndpoint() {
         return endpoint;
     }
@@ -99,15 +98,15 @@ public class AjpAprProtocol extends Abst
     /**
      * Configuration attributes.
      */
-    protected Hashtable attributes = new Hashtable();
+    protected Hashtable<String,Object> attributes = new 
Hashtable<String,Object>();
 
 
     /**
      * Adapter which will process the requests recieved by this endpoint.
      */
     private Adapter adapter;
-    
-    
+
+
     /**
      * Connection handler for AJP.
      */
@@ -117,7 +116,7 @@ public class AjpAprProtocol extends Abst
     // --------------------------------------------------------- Public Methods
 
 
-    /** 
+    /**
      * Pass config info
      */
     public void setAttribute(String name, Object value) {
@@ -135,7 +134,7 @@ public class AjpAprProtocol extends Abst
     }
 
 
-    public Iterator getAttributeNames() {
+    public Iterator<String> getAttributeNames() {
         return attributes.keySet().iterator();
     }
 
@@ -244,7 +243,7 @@ public class AjpAprProtocol extends Abst
 
     public Executor getExecutor() { return endpoint.getExecutor(); }
     public void setExecutor(Executor executor) { 
endpoint.setExecutor(executor); }
-    
+
     public int getMaxThreads() { return endpoint.getMaxThreads(); }
     public void setMaxThreads(int maxThreads) { 
endpoint.setMaxThreads(maxThreads); }
 
@@ -270,7 +269,7 @@ public class AjpAprProtocol extends Abst
     public void setSoTimeout(int soTimeout) { 
endpoint.setSoTimeout(soTimeout); }
 
     /**
-     * Should authentication be done in the native webserver layer, 
+     * Should authentication be done in the native webserver layer,
      * or in the Servlet container ?
      */
     protected boolean tomcatAuthentication = true;
@@ -282,7 +281,7 @@ public class AjpAprProtocol extends Abst
      */
     protected String requiredSecret = null;
     public void setRequiredSecret(String requiredSecret) { this.requiredSecret 
= requiredSecret; }
-    
+
     /**
      * AJP packet size.
      */
@@ -304,6 +303,7 @@ public class AjpAprProtocol extends Abst
     public void setKeepAliveTimeout(int timeout) { 
endpoint.setKeepAliveTimeout(timeout); }
 
     public boolean getUseSendfile() { return endpoint.getUseSendfile(); }
+    @SuppressWarnings("unused")
     public void setUseSendfile(boolean useSendfile) { /* No sendfile for AJP 
*/ }
 
     public int getPollTime() { return endpoint.getPollTime(); }
@@ -312,7 +312,7 @@ public class AjpAprProtocol extends Abst
     public void setPollerSize(int pollerSize) { 
endpoint.setPollerSize(pollerSize); }
     public int getPollerSize() { return endpoint.getPollerSize(); }
 
-    
+
     /**
      * When client certificate information is presented in a form other than
      * instances of {@link java.security.cert.X509Certificate} it needs to be
@@ -320,7 +320,7 @@ public class AjpAprProtocol extends Abst
      * provider is used to perform the conversion. For example it is used with
      * the AJP connectors, the HTTP APR connector and with the
      * {@link org.apache.catalina.valves.SSLValve}. If not specified, the
-     * default provider will be used. 
+     * default provider will be used.
      */
     protected String clientCertProvider = null;
     public String getClientCertProvider() { return clientCertProvider; }
@@ -336,9 +336,11 @@ public class AjpAprProtocol extends Abst
         protected AtomicLong registerCount = new AtomicLong(0);
         protected RequestGroupInfo global = new RequestGroupInfo();
 
-        protected ConcurrentLinkedQueue<AjpAprProcessor> recycledProcessors = 
+        protected ConcurrentLinkedQueue<AjpAprProcessor> recycledProcessors =
             new ConcurrentLinkedQueue<AjpAprProcessor>() {
+            private static final long serialVersionUID = 1L;
             protected AtomicInteger size = new AtomicInteger(0);
+            @Override
             public boolean offer(AjpAprProcessor processor) {
                 boolean offer = (proto.processorCache == -1) ? true : 
(size.get() < proto.processorCache);
                 //avoid over growing our cache or add after we have stopped
@@ -352,7 +354,8 @@ public class AjpAprProtocol extends Abst
                 if (!result) unregister(processor);
                 return result;
             }
-            
+
+            @Override
             public AjpAprProcessor poll() {
                 AjpAprProcessor result = super.poll();
                 if ( result != null ) {
@@ -360,7 +363,8 @@ public class AjpAprProtocol extends Abst
                 }
                 return result;
             }
-            
+
+            @Override
             public void clear() {
                 AjpAprProcessor next = poll();
                 while ( next != null ) {
@@ -380,7 +384,7 @@ public class AjpAprProtocol extends Abst
         public SocketState event(long socket, SocketStatus status) {
             return SocketState.CLOSED;
         }
-        
+
         public SocketState process(long socket) {
             AjpAprProcessor processor = recycledProcessors.poll();
             try {
@@ -389,9 +393,7 @@ public class AjpAprProtocol extends Abst
                     processor = createProcessor();
                 }
 
-                if (processor instanceof ActionHook) {
-                    ((ActionHook) processor).action(ActionCode.ACTION_START, 
null);
-                }
+                processor.action(ActionCode.ACTION_START, null);
 
                 if (processor.process(socket)) {
                     return SocketState.OPEN;
@@ -420,9 +422,7 @@ public class AjpAprProtocol extends Abst
                 AjpAprProtocol.log.error
                     (sm.getString("ajpprotocol.proto.error"), e);
             } finally {
-                if (processor instanceof ActionHook) {
-                    ((ActionHook) processor).action(ActionCode.ACTION_STOP, 
null);
-                }
+                processor.action(ActionCode.ACTION_STOP, null);
                 recycledProcessors.offer(processor);
             }
             return SocketState.CLOSED;
@@ -437,7 +437,7 @@ public class AjpAprProtocol extends Abst
             register(processor);
             return processor;
         }
-        
+
         protected void register(AjpAprProcessor processor) {
             if (proto.getDomain() != null) {
                 synchronized (this) {
@@ -513,6 +513,6 @@ public class AjpAprProtocol extends Abst
 
     public void postDeregister() {
     }
-    
- 
+
+
 }

Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=1756036&r1=1756035&r2=1756036&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Thu Aug 
11 19:44:39 2016
@@ -102,7 +102,7 @@ public class AjpProcessor implements Act
         getBodyMessage.appendInt(Constants.MAX_READ_SIZE + packetSize - 
Constants.MAX_PACKET_SIZE);
         getBodyMessage.end();
         getBodyMessageArray = new byte[getBodyMessage.getLen()];
-        System.arraycopy(getBodyMessage.getBuffer(), 0, getBodyMessageArray, 
+        System.arraycopy(getBodyMessage.getBuffer(), 0, getBodyMessageArray,
                          0, getBodyMessage.getLen());
 
         // Cause loading of HexUtils
@@ -184,18 +184,18 @@ public class AjpProcessor implements Act
      */
     protected Socket socket;
 
-    
+
     /**
      * Input stream.
      */
     protected InputStream input;
-    
-    
+
+
     /**
      * Output stream.
      */
     protected OutputStream output;
-    
+
 
     /**
      * Host name (used to avoid useless B2C conversion on the host name).
@@ -292,7 +292,7 @@ public class AjpProcessor implements Act
         pongMessage.appendByte(Constants.JK_AJP13_CPONG_REPLY);
         pongMessage.end();
         pongMessageArray = new byte[pongMessage.getLen()];
-        System.arraycopy(pongMessage.getBuffer(), 0, pongMessageArray, 
+        System.arraycopy(pongMessage.getBuffer(), 0, pongMessageArray,
                 0, pongMessage.getLen());
 
         // Allocate the end message array
@@ -354,7 +354,7 @@ public class AjpProcessor implements Act
      * provider is used to perform the conversion. For example it is used with
      * the AJP connectors, the HTTP APR connector and with the
      * {@link org.apache.catalina.valves.SSLValve}. If not specified, the
-     * default provider will be used. 
+     * default provider will be used.
      */
     protected String clientCertProvider = null;
     public String getClientCertProvider() { return clientCertProvider; }
@@ -501,7 +501,7 @@ public class AjpProcessor implements Act
         recycle();
         input = null;
         output = null;
-        
+
     }
 
 
@@ -682,7 +682,7 @@ public class AjpProcessor implements Act
         // Translate the HTTP method code to a String.
         byte methodCode = requestHeaderMessage.getByte();
         if (methodCode != Constants.SC_M_JK_STORED) {
-            String methodName = Constants.methodTransArray[(int)methodCode - 
1];
+            String methodName = Constants.methodTransArray[methodCode - 1];
             request.method().setString(methodName);
         }
 
@@ -924,7 +924,7 @@ public class AjpProcessor implements Act
      */
     public void parseHost(MessageBytes valueMB) {
 
-        if (valueMB == null || (valueMB != null && valueMB.isNull()) ) {
+        if (valueMB == null || valueMB.isNull()) {
             // HTTP/1.0
             request.setServerPort(request.getLocalPort());
             try {
@@ -1086,7 +1086,7 @@ public class AjpProcessor implements Act
         if (first && request.getContentLengthLong() > 0) {
             receive();
         }
-        
+
         // Add the end message
         output.write(endMessageArray);
 
@@ -1110,7 +1110,7 @@ public class AjpProcessor implements Act
                 throw new IOException(sm.getString("ajpprotocol.failedread"));
             }
         }
-        
+
         return true;
 
     }

Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProtocol.java?rev=1756036&r1=1756035&r2=1756036&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProtocol.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProtocol.java Thu Aug 11 
19:44:39 2016
@@ -19,7 +19,6 @@ package org.apache.coyote.ajp;
 
 import java.net.InetAddress;
 import java.net.Socket;
-import java.net.URLEncoder;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.concurrent.ConcurrentLinkedQueue;
@@ -33,7 +32,6 @@ import javax.management.ObjectName;
 
 import org.apache.coyote.AbstractProtocol;
 import org.apache.coyote.ActionCode;
-import org.apache.coyote.ActionHook;
 import org.apache.coyote.Adapter;
 import org.apache.coyote.RequestGroupInfo;
 import org.apache.coyote.RequestInfo;
@@ -54,8 +52,8 @@ import org.apache.tomcat.util.res.String
  */
 public class AjpProtocol extends AbstractProtocol
     implements MBeanRegistration {
-    
-    
+
+
     protected static org.apache.juli.logging.Log log =
         org.apache.juli.logging.LogFactory.getLog(AjpProtocol.class);
 
@@ -77,13 +75,13 @@ public class AjpProtocol extends Abstrac
         setTcpNoDelay(Constants.DEFAULT_TCP_NO_DELAY);
     }
 
-    
+
     // ----------------------------------------------------- Instance Variables
 
 
     protected ObjectName tpOname;
-    
-    
+
+
     protected ObjectName rgOname;
 
 
@@ -92,6 +90,7 @@ public class AjpProtocol extends Abstrac
      */
     protected JIoEndpoint endpoint = new JIoEndpoint();
 
+    @Override
     protected final AbstractEndpoint getEndpoint() {
         return endpoint;
     }
@@ -99,15 +98,15 @@ public class AjpProtocol extends Abstrac
     /**
      * Configuration attributes.
      */
-    protected Hashtable attributes = new Hashtable();
+    protected Hashtable<String,Object> attributes = new 
Hashtable<String,Object>();
 
 
     /**
      * Adapter which will process the requests recieved by this endpoint.
      */
     private Adapter adapter;
-    
-    
+
+
     /**
      * Connection handler for AJP.
      */
@@ -117,7 +116,7 @@ public class AjpProtocol extends Abstrac
     // --------------------------------------------------------- Public Methods
 
 
-    /** 
+    /**
      * Pass config info
      */
     public void setAttribute(String name, Object value) {
@@ -135,7 +134,7 @@ public class AjpProtocol extends Abstrac
     }
 
 
-    public Iterator getAttributeNames() {
+    public Iterator<String> getAttributeNames() {
         return attributes.keySet().iterator();
     }
 
@@ -243,7 +242,7 @@ public class AjpProtocol extends Abstrac
 
     public Executor getExecutor() { return endpoint.getExecutor(); }
     public void setExecutor(Executor executor) { 
endpoint.setExecutor(executor); }
-    
+
     public int getMaxThreads() { return endpoint.getMaxThreads(); }
     public void setMaxThreads(int maxThreads) { 
endpoint.setMaxThreads(maxThreads); }
 
@@ -269,7 +268,7 @@ public class AjpProtocol extends Abstrac
     public void setSoTimeout(int soTimeout) { 
endpoint.setSoTimeout(soTimeout); }
 
     /**
-     * Should authentication be done in the native webserver layer, 
+     * Should authentication be done in the native webserver layer,
      * or in the Servlet container ?
      */
     protected boolean tomcatAuthentication = true;
@@ -281,7 +280,7 @@ public class AjpProtocol extends Abstrac
      */
     protected String requiredSecret = null;
     public void setRequiredSecret(String requiredSecret) { this.requiredSecret 
= requiredSecret; }
-    
+
     /**
      * AJP packet size.
      */
@@ -295,7 +294,7 @@ public class AjpProtocol extends Abstrac
         }
     }
 
-    
+
     /**
      * The number of seconds Tomcat will wait for a subsequent request
      * before closing the connection.
@@ -312,7 +311,7 @@ public class AjpProtocol extends Abstrac
      * provider is used to perform the conversion. For example it is used with
      * the AJP connectors, the HTTP APR connector and with the
      * {@link org.apache.catalina.valves.SSLValve}. If not specified, the
-     * default provider will be used. 
+     * default provider will be used.
      */
     protected String clientCertProvider = null;
     public String getClientCertProvider() { return clientCertProvider; }
@@ -328,9 +327,11 @@ public class AjpProtocol extends Abstrac
         protected AtomicLong registerCount = new AtomicLong(0);
         protected RequestGroupInfo global = new RequestGroupInfo();
 
-        protected ConcurrentLinkedQueue<AjpProcessor> recycledProcessors = 
+        protected ConcurrentLinkedQueue<AjpProcessor> recycledProcessors =
             new ConcurrentLinkedQueue<AjpProcessor>() {
+            private static final long serialVersionUID = 1L;
             protected AtomicInteger size = new AtomicInteger(0);
+            @Override
             public boolean offer(AjpProcessor processor) {
                 boolean offer = (proto.processorCache == -1) ? true : 
(size.get() < proto.processorCache);
                 //avoid over growing our cache or add after we have stopped
@@ -344,7 +345,8 @@ public class AjpProtocol extends Abstrac
                 if (!result) unregister(processor);
                 return result;
             }
-            
+
+            @Override
             public AjpProcessor poll() {
                 AjpProcessor result = super.poll();
                 if ( result != null ) {
@@ -352,7 +354,8 @@ public class AjpProtocol extends Abstrac
                 }
                 return result;
             }
-            
+
+            @Override
             public void clear() {
                 AjpProcessor next = poll();
                 while ( next != null ) {
@@ -376,9 +379,7 @@ public class AjpProtocol extends Abstrac
                     processor = createProcessor();
                 }
 
-                if (processor instanceof ActionHook) {
-                    ((ActionHook) processor).action(ActionCode.ACTION_START, 
null);
-                }
+                processor.action(ActionCode.ACTION_START, null);
 
                 processor.process(socket);
                 return false;
@@ -404,9 +405,7 @@ public class AjpProtocol extends Abstrac
                 AjpProtocol.log.error
                     (sm.getString("ajpprotocol.proto.error"), e);
             } finally {
-                if (processor instanceof ActionHook) {
-                    ((ActionHook) processor).action(ActionCode.ACTION_STOP, 
null);
-                }
+                processor.action(ActionCode.ACTION_STOP, null);
                 recycledProcessors.offer(processor);
             }
             return false;
@@ -422,7 +421,7 @@ public class AjpProtocol extends Abstrac
             register(processor);
             return processor;
         }
-        
+
         protected void register(AjpProcessor processor) {
             if (proto.getDomain() != null) {
                 synchronized (this) {
@@ -498,6 +497,6 @@ public class AjpProtocol extends Abstrac
 
     public void postDeregister() {
     }
-    
- 
+
+
 }

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=1756036&r1=1756035&r2=1756036&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 
Thu Aug 11 19:44:39 2016
@@ -80,7 +80,7 @@ public class Http11AprProcessor implemen
 
     /*
      * Tracks how many internal filters are in the filter library so they
-     * are skipped when looking for pluggable filters. 
+     * are skipped when looking for pluggable filters.
      */
     private int pluggableFilterIndex = Integer.MAX_VALUE;
 
@@ -91,7 +91,7 @@ public class Http11AprProcessor implemen
     public Http11AprProcessor(int headerBufferSize, AprEndpoint endpoint) {
 
         this.endpoint = endpoint;
-        
+
         request = new Request();
         inputBuffer = new InternalAprInputBuffer(request, headerBufferSize);
         request.setInputBuffer(inputBuffer);
@@ -101,7 +101,7 @@ public class Http11AprProcessor implemen
         outputBuffer = new InternalAprOutputBuffer(response, headerBufferSize);
         response.setOutputBuffer(outputBuffer);
         request.setResponse(response);
-        
+
         ssl = endpoint.isSSLEnabled();
 
         initializeFilters();
@@ -209,7 +209,7 @@ public class Http11AprProcessor implemen
      * SSL enabled ?
      */
     protected boolean ssl = false;
-    
+
 
     /**
      * Socket associated with the current connection.
@@ -319,7 +319,7 @@ public class Http11AprProcessor implemen
      */
     protected String server = null;
 
-    
+
     /**
      * When client certificate information is presented in a form other than
      * instances of {@link java.security.cert.X509Certificate} it needs to be
@@ -327,7 +327,7 @@ public class Http11AprProcessor implemen
      * provider is used to perform the conversion. For example it is used with
      * the AJP connectors, the HTTP APR connector and with the
      * {@link org.apache.catalina.valves.SSLValve}. If not specified, the
-     * default provider will be used. 
+     * default provider will be used.
      */
     protected String clientCertProvider = null;
 
@@ -486,7 +486,7 @@ public class Http11AprProcessor implemen
      */
     protected void addFilter(String className) {
         try {
-            Class clazz = Class.forName(className);
+            Class<?> clazz = Class.forName(className);
             Object obj = clazz.newInstance();
             if (obj instanceof InputFilter) {
                 inputBuffer.addFilter((InputFilter) obj);
@@ -546,22 +546,6 @@ public class Http11AprProcessor implemen
 
 
     /**
-     * General use method
-     *
-     * @param sArray the StringArray
-     * @param value string
-     */
-    private boolean inStringArray(String sArray[], String value) {
-        for (int i = 0; i < sArray.length; i++) {
-            if (sArray[i].equals(value)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-
-    /**
      * Checks if any entry in the string array starts with the specified value
      *
      * @param sArray the StringArray
@@ -748,9 +732,9 @@ public class Http11AprProcessor implemen
      */
     public SocketState event(SocketStatus status)
         throws IOException {
-        
+
         RequestInfo rp = request.getRequestProcessor();
-        
+
         try {
             rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
             error = !adapter.event(request, response, status);
@@ -763,7 +747,7 @@ public class Http11AprProcessor implemen
             adapter.log(request, response, 0);
             error = true;
         }
-        
+
         rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
 
         if (error) {
@@ -780,7 +764,7 @@ public class Http11AprProcessor implemen
             return SocketState.LONG;
         }
     }
-    
+
     /**
      * Process pipelined HTTP requests using the specified input and output
      * streams.
@@ -812,7 +796,7 @@ public class Http11AprProcessor implemen
 
         int keepAliveLeft = maxKeepAliveRequests;
         long soTimeout = endpoint.getSoTimeout();
-        
+
         boolean keptAlive = false;
         boolean openSocket = false;
 
@@ -900,7 +884,7 @@ public class Http11AprProcessor implemen
             // Finish the handling of the request
             if (!comet) {
                 // If we know we are closing the connection, don't drain input.
-                // This way uploading a 100GB file doesn't tie up the thread 
+                // This way uploading a 100GB file doesn't tie up the thread
                 // if the servlet has rejected it.
                 if(error)
                     inputBuffer.setSwallowInput(false);
@@ -919,7 +903,7 @@ public class Http11AprProcessor implemen
                 inputBuffer.nextRequest();
                 outputBuffer.nextRequest();
             }
-            
+
             // Do sendfile as needed: add socket to sendfile and end
             if (sendfileData != null && !error) {
                 sendfileData.socket = socket;
@@ -940,7 +924,7 @@ public class Http11AprProcessor implemen
                     break;
                 }
             }
-            
+
             rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE);
 
         }
@@ -960,12 +944,12 @@ public class Http11AprProcessor implemen
             recycle();
             return (openSocket) ? SocketState.OPEN : SocketState.CLOSED;
         }
-        
+
     }
 
-    
+
     public void endRequest() {
-        
+
         // Finish the handling of the request
         try {
             inputBuffer.endRequest();
@@ -989,14 +973,14 @@ public class Http11AprProcessor implemen
         }
 
     }
-    
-    
+
+
     public void recycle() {
         inputBuffer.recycle();
         outputBuffer.recycle();
         this.socket = 0;
     }
-    
+
 
     // ----------------------------------------------------- ActionHook Methods
 
@@ -1180,10 +1164,10 @@ public class Http11AprProcessor implemen
                         certs = new X509Certificate[certLength + 1];
                         CertificateFactory cf;
                         if (clientCertProvider == null) {
-                            cf = CertificateFactory.getInstance("X.509"); 
+                            cf = CertificateFactory.getInstance("X.509");
                         } else {
                             cf = CertificateFactory.getInstance("X.509",
-                                    clientCertProvider); 
+                                    clientCertProvider);
                         }
                         certs[0] = (X509Certificate) 
cf.generateCertificate(new ByteArrayInputStream(clientCert));
                         for (int i = 0; i < certLength; i++) {
@@ -1196,9 +1180,7 @@ public class Http11AprProcessor implemen
                     }
                     // User key size
                     sslO = new Integer(SSLSocket.getInfoI(socket, 
SSL.SSL_INFO_CIPHER_USEKEYSIZE));
-                    if (sslO != null) {
-                        request.setAttribute(AprEndpoint.KEY_SIZE_KEY, sslO);
-                    }
+                    request.setAttribute(AprEndpoint.KEY_SIZE_KEY, sslO);
                     // SSL session ID
                     sslO = SSLSocket.getInfoS(socket, SSL.SSL_INFO_SESSION_ID);
                     if (sslO != null) {
@@ -1225,7 +1207,7 @@ public class Http11AprProcessor implemen
                     if (SSLSocket.renegotiate(socket) == 0) {
                         // Don't look for certs unless we know renegotiation 
worked.
                         // Get client certificate and the certificate chain if 
present
-                        // certLength == -1 indicates an error 
+                        // certLength == -1 indicates an error
                         int certLength = 
SSLSocket.getInfoI(socket,SSL.SSL_INFO_CLIENT_CERT_CHAIN);
                         byte[] clientCert = SSLSocket.getInfoB(socket, 
SSL.SSL_INFO_CLIENT_CERT);
                         X509Certificate[] certs = null;
@@ -1249,14 +1231,14 @@ public class Http11AprProcessor implemen
 
         } else if (actionCode == ActionCode.ACTION_REQ_SET_BODY_REPLAY) {
             ByteChunk body = (ByteChunk) param;
-            
+
             InputFilter savedBody = new SavedRequestInputFilter(body);
             savedBody.setRequest(request);
-            
+
             InternalAprInputBuffer internalBuffer = (InternalAprInputBuffer)
                 request.getInputBuffer();
             internalBuffer.addActiveFilter(savedBody);
-            
+
         } else if (actionCode == ActionCode.ACTION_AVAILABLE) {
             request.setAvailable(inputBuffer.available());
         } else if (actionCode == ActionCode.ACTION_COMET_BEGIN) {
@@ -1471,7 +1453,7 @@ public class Http11AprProcessor implemen
         parseHost(valueMB);
 
         if (!contentDelimitation) {
-            // If there's no content length 
+            // If there's no content length
             // (broken HTTP/1.0 or HTTP/1.1), assume
             // the client is not broken and didn't send a body
             inputBuffer.addActiveFilter
@@ -1630,7 +1612,7 @@ public class Http11AprProcessor implemen
         return true;
     }
 
-    
+
     /**
      * When committing the response, we have to validate the set of headers, as
      * well as setup the response filters.
@@ -1677,13 +1659,13 @@ public class Http11AprProcessor implemen
                 contentDelimitation = true;
                 sendfileData = new AprEndpoint.SendfileData();
                 sendfileData.fileName = fileName;
-                sendfileData.start = 
+                sendfileData.start =
                     ((Long) 
request.getAttribute("org.apache.tomcat.sendfile.start")).longValue();
-                sendfileData.end = 
+                sendfileData.end =
                     ((Long) 
request.getAttribute("org.apache.tomcat.sendfile.end")).longValue();
             }
         }
-        
+
         // Check for compression
         boolean isCompressable = false;
         boolean useCompression = false;
@@ -1757,7 +1739,7 @@ public class Http11AprProcessor implemen
             headers.setValue("Date").setString(
                     FastHttpDateFormat.getCurrentDate());
         }
-        
+
         // FIXME: Add transfer encoding header
 
         if ((entityBody) && (!contentDelimitation)) {

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java?rev=1756036&r1=1756035&r2=1756036&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 
Thu Aug 11 19:44:39 2016
@@ -18,7 +18,6 @@
 package org.apache.coyote.http11;
 
 import java.net.InetAddress;
-import java.net.URLEncoder;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -34,7 +33,6 @@ import javax.management.ObjectName;
 
 import org.apache.coyote.AbstractProtocol;
 import org.apache.coyote.ActionCode;
-import org.apache.coyote.ActionHook;
 import org.apache.coyote.Adapter;
 import org.apache.coyote.RequestGroupInfo;
 import org.apache.coyote.RequestInfo;
@@ -57,7 +55,7 @@ import org.apache.tomcat.util.res.String
 public class Http11AprProtocol extends AbstractProtocol
     implements MBeanRegistration {
 
-    protected static org.apache.juli.logging.Log log = 
+    protected static org.apache.juli.logging.Log log =
         org.apache.juli.logging.LogFactory.getLog(Http11AprProtocol.class);
 
     /**
@@ -88,7 +86,7 @@ public class Http11AprProtocol extends A
         return attributes.get(key);
     }
 
-    public Iterator getAttributeNames() {
+    public Iterator<String> getAttributeNames() {
         return attributes.keySet().iterator();
     }
 
@@ -184,6 +182,7 @@ public class Http11AprProtocol extends A
 
     protected AprEndpoint endpoint=new AprEndpoint();
 
+    @Override
     protected final AbstractEndpoint getEndpoint() {
         return endpoint;
     }
@@ -201,7 +200,7 @@ public class Http11AprProtocol extends A
 
     public Executor getExecutor() { return endpoint.getExecutor(); }
     public void setExecutor(Executor executor) { 
endpoint.setExecutor(executor); }
-    
+
     public int getMaxThreads() { return endpoint.getMaxThreads(); }
     public void setMaxThreads(int maxThreads) { 
endpoint.setMaxThreads(maxThreads); }
 
@@ -249,10 +248,10 @@ public class Http11AprProtocol extends A
 
     public void setPollerThreadCount(int pollerThreadCount) { 
endpoint.setPollerThreadCount(pollerThreadCount); }
     public int getPollerThreadCount() { return 
endpoint.getPollerThreadCount(); }
-    
+
     public int getSendfileSize() { return endpoint.getSendfileSize(); }
     public void setSendfileSize(int sendfileSize) { 
endpoint.setSendfileSize(sendfileSize); }
-    
+
     public void setSendfileThreadCount(int sendfileThreadCount) { 
endpoint.setSendfileThreadCount(sendfileThreadCount); }
     public int getSendfileThreadCount() { return 
endpoint.getSendfileThreadCount(); }
 
@@ -296,20 +295,20 @@ public class Http11AprProtocol extends A
     protected String compression = "off";
     public String getCompression() { return compression; }
     public void setCompression(String valueS) { compression = valueS; }
-    
-    
+
+
     // HTTP
     protected String noCompressionUserAgents = null;
     public String getNoCompressionUserAgents() { return 
noCompressionUserAgents; }
     public void setNoCompressionUserAgents(String valueS) { 
noCompressionUserAgents = valueS; }
 
-    
+
     // HTTP
     protected String compressableMimeTypes = "text/html,text/xml,text/plain";
     public String getCompressableMimeType() { return compressableMimeTypes; }
     public void setCompressableMimeType(String valueS) { compressableMimeTypes 
= valueS; }
-    
-    
+
+
     // HTTP
     protected int compressionMinSize = 2048;
     public int getCompressionMinSize() { return compressionMinSize; }
@@ -323,14 +322,14 @@ public class Http11AprProtocol extends A
     protected String restrictedUserAgents = null;
     public String getRestrictedUserAgents() { return restrictedUserAgents; }
     public void setRestrictedUserAgents(String valueS) { restrictedUserAgents 
= valueS; }
-    
-    
+
+
     protected String protocol = null;
     public String getProtocol() { return protocol; }
     public void setProtocol(String protocol) { setSecure(true); this.protocol 
= protocol; }
 
     /**
-     * Maximum number of requests which can be performed over a keepalive 
+     * Maximum number of requests which can be performed over a keepalive
      * connection. The default is the same as for Apache HTTP Server.
      */
     protected int maxKeepAliveRequests = 100;
@@ -416,8 +415,8 @@ public class Http11AprProtocol extends A
      * instead of the default which is to allow the client to choose a
      * preferred cipher.
      */
-    public boolean getSSLHonorCipherOrder() { return 
((AprEndpoint)endpoint).getSSLHonorCipherOrder(); }
-    public void setSSLHonorCipherOrder(boolean SSLHonorCipherOrder) { 
((AprEndpoint)endpoint).setSSLHonorCipherOrder(SSLHonorCipherOrder); }
+    public boolean getSSLHonorCipherOrder() { return 
endpoint.getSSLHonorCipherOrder(); }
+    public void setSSLHonorCipherOrder(boolean SSLHonorCipherOrder) { 
endpoint.setSSLHonorCipherOrder(SSLHonorCipherOrder); }
 
 
     /**
@@ -485,10 +484,10 @@ public class Http11AprProtocol extends A
     /**
      * Disable SSL compression.
      */
-    public boolean getSSLDisableCompression() { return 
((AprEndpoint)endpoint).getSSLDisableCompression(); }
-    public void setSSLDisableCompression(boolean disable) { 
((AprEndpoint)endpoint).setSSLDisableCompression(disable); }
+    public boolean getSSLDisableCompression() { return 
endpoint.getSSLDisableCompression(); }
+    public void setSSLDisableCompression(boolean disable) { 
endpoint.setSSLDisableCompression(disable); }
+
 
-    
     /**
      * When client certificate information is presented in a form other than
      * instances of {@link java.security.cert.X509Certificate} it needs to be
@@ -496,7 +495,7 @@ public class Http11AprProtocol extends A
      * provider is used to perform the conversion. For example it is used with
      * the AJP connectors, the HTTP APR connector and with the
      * {@link org.apache.catalina.valves.SSLValve}. If not specified, the
-     * default provider will be used. 
+     * default provider will be used.
      */
     protected String clientCertProvider = null;
     public String getClientCertProvider() { return clientCertProvider; }
@@ -506,16 +505,18 @@ public class Http11AprProtocol extends A
     // --------------------  Connection handler --------------------
 
     static class Http11ConnectionHandler implements Handler {
-        
+
         protected Http11AprProtocol proto;
         protected AtomicLong registerCount = new AtomicLong(0);
         protected RequestGroupInfo global = new RequestGroupInfo();
-        
+
         protected final Map<Long, Http11AprProcessor> connections =
                 new ConcurrentHashMap<Long, Http11AprProcessor>();
-        protected ConcurrentLinkedQueue<Http11AprProcessor> recycledProcessors 
= 
+        protected ConcurrentLinkedQueue<Http11AprProcessor> recycledProcessors 
=
             new ConcurrentLinkedQueue<Http11AprProcessor>() {
+            private static final long serialVersionUID = 1L;
             protected AtomicInteger size = new AtomicInteger(0);
+            @Override
             public boolean offer(Http11AprProcessor processor) {
                 boolean offer = (proto.processorCache == -1) ? true : 
(size.get() < proto.processorCache);
                 //avoid over growing our cache or add after we have stopped
@@ -529,7 +530,8 @@ public class Http11AprProtocol extends A
                 if (!result) unregister(processor);
                 return result;
             }
-            
+
+            @Override
             public Http11AprProcessor poll() {
                 Http11AprProcessor result = super.poll();
                 if ( result != null ) {
@@ -537,7 +539,8 @@ public class Http11AprProtocol extends A
                 }
                 return result;
             }
-            
+
+            @Override
             public void clear() {
                 Http11AprProcessor next = poll();
                 while ( next != null ) {
@@ -555,9 +558,9 @@ public class Http11AprProtocol extends A
         }
 
         public SocketState event(long socket, SocketStatus status) {
-            Http11AprProcessor result = connections.get(socket);
-            
-            SocketState state = SocketState.CLOSED; 
+            Http11AprProcessor result = connections.get(Long.valueOf(socket));
+
+            SocketState state = SocketState.CLOSED;
             if (result != null) {
                 // Call the appropriate event
                 try {
@@ -584,7 +587,7 @@ public class Http11AprProtocol extends A
                         (sm.getString("http11protocol.proto.error"), e);
                 } finally {
                     if (state != SocketState.LONG) {
-                        connections.remove(socket);
+                        connections.remove(Long.valueOf(socket));
                         recycledProcessors.offer(result);
                         if (state == SocketState.OPEN) {
                             proto.endpoint.getPoller().add(socket);
@@ -596,7 +599,7 @@ public class Http11AprProtocol extends A
             }
             return state;
         }
-        
+
         public SocketState process(long socket) {
             Http11AprProcessor processor = recycledProcessors.poll();
             try {
@@ -604,16 +607,14 @@ public class Http11AprProtocol extends A
                     processor = createProcessor();
                 }
 
-                if (processor instanceof ActionHook) {
-                    ((ActionHook) processor).action(ActionCode.ACTION_START, 
null);
-                }
+                processor.action(ActionCode.ACTION_START, null);
 
                 SocketState state = processor.process(socket);
                 if (state == SocketState.LONG) {
-                    // Associate the connection with the processor. The next 
request 
+                    // Associate the connection with the processor. The next 
request
                     // processed by this thread will use either a new or a 
recycled
                     // processor.
-                    connections.put(socket, processor);
+                    connections.put(Long.valueOf(socket), processor);
                     proto.endpoint.getCometPoller().add(socket);
                 } else {
                     recycledProcessors.offer(processor);
@@ -664,7 +665,7 @@ public class Http11AprProtocol extends A
             register(processor);
             return processor;
         }
-        
+
         protected void register(Http11AprProcessor processor) {
             if (proto.getDomain() != null) {
                 synchronized (this) {

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=1756036&r1=1756035&r2=1756036&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java 
Thu Aug 11 19:44:39 2016
@@ -83,7 +83,7 @@ public class Http11NioProcessor implemen
 
     /*
      * Tracks how many internal filters are in the filter library so they
-     * are skipped when looking for pluggable filters. 
+     * are skipped when looking for pluggable filters.
      */
     private int pluggableFilterIndex = Integer.MAX_VALUE;
 
@@ -96,7 +96,6 @@ public class Http11NioProcessor implemen
         this.endpoint = endpoint;
 
         request = new Request();
-        int readTimeout = endpoint.getSoTimeout();
         inputBuffer = new InternalNioInputBuffer(request, maxHttpHeaderSize);
         request.setInputBuffer(inputBuffer);
 
@@ -180,9 +179,9 @@ public class Http11NioProcessor implemen
      * Comet used.
      */
     protected boolean comet = false;
-    
+
     /**
-     * Closed flag, a Comet async thread can 
+     * Closed flag, a Comet async thread can
      * signal for this Nio processor to be closed and recycled instead
      * of waiting for a timeout.
      * Closed by HttpServletResponse.getWriter().close()
@@ -482,7 +481,7 @@ public class Http11NioProcessor implemen
      */
     protected void addFilter(String className) {
         try {
-            Class clazz = Class.forName(className);
+            Class<?> clazz = Class.forName(className);
             Object obj = clazz.newInstance();
             if (obj instanceof InputFilter) {
                 inputBuffer.addFilter((InputFilter) obj);
@@ -542,22 +541,6 @@ public class Http11NioProcessor implemen
 
 
     /**
-     * General use method
-     *
-     * @param sArray the StringArray
-     * @param value string
-     */
-    private boolean inStringArray(String sArray[], String value) {
-        for (int i = 0; i < sArray.length; i++) {
-            if (sArray[i].equals(value)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-
-    /**
      * Checks if any entry in the string array starts with the specified value
      *
      * @param sArray the StringArray
@@ -811,13 +794,11 @@ public class Http11NioProcessor implemen
         error = false;
         keepAlive = true;
         comet = false;
-        
+
 
         int keepAliveLeft = maxKeepAliveRequests;
         long soTimeout = endpoint.getSoTimeout();
 
-        int limit = 0;
-
         boolean keptAlive = false;
         boolean openSocket = false;
         boolean recycle = true;
@@ -847,7 +828,7 @@ public class Http11NioProcessor implemen
                 }
                 request.setStartTime(System.currentTimeMillis());
                 if (!disableUploadTimeout) { //only for body, not for request 
headers
-                    socket.getIOChannel().socket().setSoTimeout((int)timeout);
+                    socket.getIOChannel().socket().setSoTimeout(timeout);
                 }
             } catch (IOException e) {
                 if (log.isDebugEnabled()) {
@@ -924,7 +905,7 @@ public class Http11NioProcessor implemen
             // Finish the handling of the request
             if (!comet) {
                 // If we know we are closing the connection, don't drain input.
-                // This way uploading a 100GB file doesn't tie up the thread 
+                // This way uploading a 100GB file doesn't tie up the thread
                 // if the servlet has rejected it.
                 if(error)
                     inputBuffer.setSwallowInput(false);
@@ -943,7 +924,7 @@ public class Http11NioProcessor implemen
                 inputBuffer.nextRequest();
                 outputBuffer.nextRequest();
             }
-            
+
             // Do sendfile as needed: add socket to sendfile and end
             if (sendfileData != null && !error) {
                 KeyAttachment ka = (KeyAttachment)socket.getAttachment(false);
@@ -1038,7 +1019,7 @@ public class Http11NioProcessor implemen
                 return;
 
             // Validate and write response headers
-            
+
             try {
                 prepareResponse();
                 outputBuffer.commit();
@@ -1466,7 +1447,7 @@ public class Http11NioProcessor implemen
         parseHost(valueMB);
 
         if (!contentDelimitation) {
-            // If there's no content length 
+            // If there's no content length
             // (broken HTTP/1.0 or HTTP/1.1), assume
             // the client is not broken and didn't send a body
             inputBuffer.addActiveFilter
@@ -1475,7 +1456,7 @@ public class Http11NioProcessor implemen
         }
 
         // Advertise sendfile support through a request attribute
-        if (endpoint.getUseSendfile()) 
+        if (endpoint.getUseSendfile())
             request.setAttribute("org.apache.tomcat.sendfile.support", 
Boolean.TRUE);
         // Advertise comet support through a request attribute
         request.setAttribute("org.apache.tomcat.comet.support", Boolean.TRUE);
@@ -1626,7 +1607,7 @@ public class Http11NioProcessor implemen
         return true;
     }
 
-    
+
     /**
      * When committing the response, we have to validate the set of headers, as
      * well as setup the response filters.
@@ -1662,7 +1643,7 @@ public class Http11NioProcessor implemen
                 (outputFilters[Constants.VOID_FILTER]);
             contentDelimitation = true;
         }
-        
+
         // Sendfile support
         if (this.endpoint.getUseSendfile()) {
             String fileName = (String) 
request.getAttribute("org.apache.tomcat.sendfile.filename");
@@ -1752,7 +1733,7 @@ public class Http11NioProcessor implemen
             headers.setValue("Date").setString(
                     FastHttpDateFormat.getCurrentDate());
         }
-        
+
         // FIXME: Add transfer encoding header
 
         if ((entityBody) && (!contentDelimitation)) {

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=1756036&r1=1756035&r2=1756036&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java 
Thu Aug 11 19:44:39 2016
@@ -17,7 +17,6 @@
 package org.apache.coyote.http11;
 
 import java.net.InetAddress;
-import java.net.URLEncoder;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.Map;
@@ -32,7 +31,6 @@ import javax.management.ObjectName;
 
 import org.apache.coyote.AbstractProtocol;
 import org.apache.coyote.ActionCode;
-import org.apache.coyote.ActionHook;
 import org.apache.coyote.Adapter;
 import org.apache.coyote.RequestGroupInfo;
 import org.apache.coyote.RequestInfo;
@@ -89,7 +87,7 @@ public class Http11NioProtocol extends A
         return attributes.get(key);
     }
 
-    public Iterator getAttributeNames() {
+    public Iterator<String> getAttributeNames() {
         return attributes.keySet().iterator();
     }
 
@@ -210,13 +208,14 @@ public class Http11NioProtocol extends A
     // -------------------- Properties--------------------
     protected NioEndpoint ep=new NioEndpoint();
 
+    @Override
     protected final AbstractEndpoint getEndpoint() {
         return ep;
     }
 
     protected boolean secure = false;
 
-    protected Hashtable attributes = new Hashtable();
+    protected Hashtable<String,Object> attributes = new 
Hashtable<String,Object>();
 
     private int maxKeepAliveRequests=100; // as in Apache HTTPD server
     private int timeout = 300000;   // 5 minutes as in Apache HTTPD server
@@ -534,7 +533,7 @@ public class Http11NioProtocol extends A
 
     public void setOomParachute(int oomParachute) {
         ep.setOomParachute(oomParachute);
-        setAttribute("oomParachute",oomParachute);
+        setAttribute("oomParachute", Integer.valueOf(oomParachute));
     }
 
     // --------------------  SSL related properties --------------------
@@ -616,8 +615,11 @@ public class Http11NioProtocol extends A
 
         protected final Map<NioChannel, Http11NioProcessor> connections =
                 new ConcurrentHashMap<NioChannel, Http11NioProcessor>();
-        protected ConcurrentLinkedQueue<Http11NioProcessor> recycledProcessors 
= new ConcurrentLinkedQueue<Http11NioProcessor>() {
+        protected ConcurrentLinkedQueue<Http11NioProcessor> recycledProcessors 
=
+                new ConcurrentLinkedQueue<Http11NioProcessor>() {
+            private static final long serialVersionUID = 1L;
             protected AtomicInteger size = new AtomicInteger(0);
+            @Override
             public boolean offer(Http11NioProcessor processor) {
                 boolean offer = proto.processorCache==-1?true:size.get() < 
proto.processorCache;
                 //avoid over growing our cache or add after we have stopped
@@ -632,6 +634,7 @@ public class Http11NioProtocol extends A
                 return result;
             }
 
+            @Override
             public Http11NioProcessor poll() {
                 Http11NioProcessor result = super.poll();
                 if ( result != null ) {
@@ -640,6 +643,7 @@ public class Http11NioProtocol extends A
                 return result;
             }
 
+            @Override
             public void clear() {
                 Http11NioProcessor next = poll();
                 while ( next != null ) {
@@ -737,9 +741,7 @@ public class Http11NioProtocol extends A
                     processor = createProcessor();
                 }
 
-                if (processor instanceof ActionHook) {
-                    ((ActionHook) processor).action(ActionCode.ACTION_START, 
null);
-                }
+                processor.action(ActionCode.ACTION_START, null);
 
                 if (proto.ep.isSSLEnabled() && (proto.sslImplementation != 
null)) {
                     if (socket instanceof SecureNioChannel) {

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java?rev=1756036&r1=1756035&r2=1756036&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java Thu 
Aug 11 19:44:39 2016
@@ -71,12 +71,12 @@ public class Http11Processor implements
     protected static StringManager sm =
         StringManager.getManager(Constants.Package);
 
-    protected static boolean isSecurityEnabled = 
+    protected static boolean isSecurityEnabled =
        org.apache.coyote.Constants.IS_SECURITY_ENABLED;
 
     /*
      * Tracks how many internal filters are in the filter library so they
-     * are skipped when looking for pluggable filters. 
+     * are skipped when looking for pluggable filters.
      */
     private int pluggableFilterIndex = Integer.MAX_VALUE;
 
@@ -87,7 +87,7 @@ public class Http11Processor implements
     public Http11Processor(int headerBufferSize, JIoEndpoint endpoint) {
 
         this.endpoint = endpoint;
-        
+
         request = new Request();
         inputBuffer = new InternalInputBuffer(request, headerBufferSize);
         request.setInputBuffer(inputBuffer);
@@ -468,7 +468,7 @@ public class Http11Processor implements
      */
     protected void addFilter(String className) {
         try {
-            Class clazz = Class.forName(className);
+            Class<?> clazz = Class.forName(className);
             Object obj = clazz.newInstance();
             if (obj instanceof InputFilter) {
                 inputBuffer.addFilter((InputFilter) obj);
@@ -528,22 +528,6 @@ public class Http11Processor implements
 
 
     /**
-     * General use method
-     *
-     * @param sArray the StringArray
-     * @param value string
-     */
-    private boolean inStringArray(String sArray[], String value) {
-        for (int i = 0; i < sArray.length; i++) {
-            if (sArray[i].equals(value)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-
-    /**
      * Checks if any entry in the string array starts with the specified value
      *
      * @param sArray the StringArray
@@ -751,7 +735,7 @@ public class Http11Processor implements
      *
      * @param theSocket Socket from which the HTTP requests will be read
      *               and the HTTP responses will be written.
-     *  
+     *
      * @throws IOException error during an I/O operation
      */
     public void process(Socket theSocket)
@@ -789,7 +773,7 @@ public class Http11Processor implements
                 keepAliveLeft = 1;
             }
         }
-        
+
         try {
             socket.setSoTimeout(soTimeout);
         } catch (Throwable t) {
@@ -884,7 +868,7 @@ public class Http11Processor implements
             try {
                 rp.setStage(org.apache.coyote.Constants.STAGE_ENDINPUT);
                 // If we know we are closing the connection, don't drain input.
-                // This way uploading a 100GB file doesn't tie up the thread 
+                // This way uploading a 100GB file doesn't tie up the thread
                 // if the servlet has rejected it.
                 if(error)
                     inputBuffer.setSwallowInput(false);
@@ -895,7 +879,7 @@ public class Http11Processor implements
                 log.error(sm.getString("http11processor.request.finish"), t);
                 // 500 - Internal Server Error
                 response.setStatus(500);
-                // No access logging since after service method 
+                // No access logging since after service method
                 error = true;
             }
             try {
@@ -1130,7 +1114,7 @@ public class Http11Processor implements
             }
         } else if (actionCode == ActionCode.ACTION_REQ_SET_BODY_REPLAY) {
             ByteChunk body = (ByteChunk) param;
-            
+
             InputFilter savedBody = new SavedRequestInputFilter(body);
             savedBody.setRequest(request);
 
@@ -1352,7 +1336,7 @@ public class Http11Processor implements
         parseHost(valueMB);
 
         if (!contentDelimitation) {
-            // If there's no content length 
+            // If there's no content length
             // (broken HTTP/1.0 or HTTP/1.1), assume
             // the client is not broken and didn't send a body
             inputBuffer.addActiveFilter
@@ -1508,7 +1492,7 @@ public class Http11Processor implements
         return true;
     }
 
-    
+
     /**
      * When committing the response, we have to validate the set of headers, as
      * well as setup the response filters.
@@ -1618,7 +1602,7 @@ public class Http11Processor implements
             headers.setValue("Date").setString(
                     FastHttpDateFormat.getCurrentDate());
         }
-        
+
         // FIXME: Add transfer encoding header
 
         if ((entityBody) && (!contentDelimitation)) {

Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Protocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Protocol.java?rev=1756036&r1=1756035&r2=1756036&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Protocol.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Protocol.java Thu 
Aug 11 19:44:39 2016
@@ -32,7 +32,6 @@ import javax.management.ObjectName;
 
 import org.apache.coyote.AbstractProtocol;
 import org.apache.coyote.ActionCode;
-import org.apache.coyote.ActionHook;
 import org.apache.coyote.Adapter;
 import org.apache.coyote.RequestGroupInfo;
 import org.apache.coyote.RequestInfo;
@@ -120,7 +119,7 @@ public class Http11Protocol extends Abst
         return attributes.get(key);
     }
 
-    public Iterator getAttributeNames() {
+    public Iterator<String> getAttributeNames() {
         return attributes.keySet().iterator();
     }
 
@@ -548,7 +547,8 @@ public class Http11Protocol extends Abst
         protected RequestGroupInfo global = new RequestGroupInfo();
 
         protected ConcurrentLinkedQueue<Http11Processor> recycledProcessors =
-            new ConcurrentLinkedQueue<Http11Processor>() {
+                new ConcurrentLinkedQueue<Http11Processor>() {
+            private static final long serialVersionUID = 1L;
             protected AtomicInteger size = new AtomicInteger(0);
             @Override
             public boolean offer(Http11Processor processor) {
@@ -598,9 +598,7 @@ public class Http11Protocol extends Abst
                     processor = createProcessor();
                 }
 
-                if (processor instanceof ActionHook) {
-                    ((ActionHook) processor).action(ActionCode.ACTION_START, 
null);
-                }
+                processor.action(ActionCode.ACTION_START, null);
 
                 if (proto.isSSLEnabled() && (proto.sslImplementation != null)) 
{
                     processor.setSSLSupport
@@ -633,12 +631,7 @@ public class Http11Protocol extends Abst
                 Http11Protocol.log.error
                     (sm.getString("http11protocol.proto.error"), e);
             } finally {
-                //       if(proto.adapter != null) proto.adapter.recycle();
-                //                processor.recycle();
-
-                if (processor instanceof ActionHook) {
-                    ((ActionHook) processor).action(ActionCode.ACTION_STOP, 
null);
-                }
+                processor.action(ActionCode.ACTION_STOP, null);
                 recycledProcessors.offer(processor);
             }
             return false;



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to