Author: markt
Date: Tue Aug 31 22:07:58 2010
New Revision: 991359

URL: http://svn.apache.org/viewvc?rev=991359&view=rev
Log:
Re-factoring. Reduce code duplication. More still to be done.

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
    tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
    tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
    tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Protocol.java?rev=991359&r1=991358&r2=991359&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Protocol.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Protocol.java Tue 
Aug 31 22:07:58 2010
@@ -45,7 +45,7 @@ public abstract class AbstractHttp11Prot
     protected ObjectName tpOname = null;
     protected ObjectName rgOname = null;
 
-    protected AbstractEndpoint endpoint=null;
+    protected AbstractEndpoint endpoint = null;
     
     protected SSLImplementation sslImplementation = null;
     
@@ -75,6 +75,8 @@ public abstract class AbstractHttp11Prot
 
     @Override
     public Object getAttribute(String key) {
+        if (getLog().isTraceEnabled())
+            getLog().trace(sm.getString("http11protocol.getattribute", key));
         return attributes.get(key);
     }
 
@@ -159,6 +161,10 @@ public abstract class AbstractHttp11Prot
     public boolean isSSLEnabled() { return endpoint.isSSLEnabled();}
     public void setSSLEnabled(boolean SSLEnabled) { 
endpoint.setSSLEnabled(SSLEnabled);}    
     
+    /**
+     * This field indicates if the protocol is secure from the perspective of
+     * the client (= https is used).
+     */
     private boolean secure;
     public boolean getSecure() { return secure; }
     public void setSecure(boolean b) { 
@@ -169,7 +175,7 @@ public abstract class AbstractHttp11Prot
     /**
      * Processor cache.
      */
-    private int processorCache = 200;
+    private int processorCache;
     public int getProcessorCache() { return this.processorCache; }
     public void setProcessorCache(int processorCache) { this.processorCache = 
processorCache; }
 
@@ -203,7 +209,11 @@ public abstract class AbstractHttp11Prot
             setMaxKeepAliveRequests(1);
         }
     }
-    
+
+    /**
+     * The number of seconds Tomcat will wait for a subsequent request
+     * before closing the connection.
+     */
     public void setKeepAliveTimeout(int keepAliveTimeout) {
         endpoint.setKeepAliveTimeout(keepAliveTimeout);
     }
@@ -375,7 +385,4 @@ public abstract class AbstractHttp11Prot
     public void postDeregister() {
         // NOOP
     }
-
-
-    
 }

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java?rev=991359&r1=991358&r2=991359&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java Tue Aug 
31 22:07:58 2010
@@ -17,23 +17,14 @@
 
 package org.apache.coyote.http11;
 
-import java.net.InetAddress;
-import java.net.URLEncoder;
-import java.util.HashMap;
-import java.util.Iterator;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.Executor;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
-import javax.management.MBeanRegistration;
-import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
 import org.apache.coyote.ActionCode;
-import org.apache.coyote.Adapter;
-import org.apache.coyote.ProtocolHandler;
 import org.apache.coyote.RequestGroupInfo;
 import org.apache.coyote.RequestInfo;
 import org.apache.juli.logging.Log;
@@ -53,10 +44,13 @@ import org.apache.tomcat.util.res.String
  * @author Remy Maucherat
  * @author Costin Manolache
  */
-public class Http11AprProtocol implements ProtocolHandler, MBeanRegistration {
+public class Http11AprProtocol extends AbstractHttp11Protocol {
 
     private static final Log log = LogFactory.getLog(Http11AprProtocol.class);
 
+    @Override
+    protected Log getLog() { return log; }
+
     /**
      * The string manager for this package.
      */
@@ -64,50 +58,20 @@ public class Http11AprProtocol implement
         StringManager.getManager(Constants.Package);
 
     public Http11AprProtocol() {
+        endpoint = new AprEndpoint();
+        cHandler = new Http11ConnectionHandler(this);
         setSoLinger(Constants.DEFAULT_CONNECTION_LINGER);
         setSoTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
-        //setServerSoTimeout(Constants.DEFAULT_SERVER_SOCKET_TIMEOUT);
         setTcpNoDelay(Constants.DEFAULT_TCP_NO_DELAY);
+        setProcessorCache(-1);
     }
 
-    /** Pass config info
-     */
-    @Override
-    public void setAttribute( String name, Object value ) {
-        if( log.isTraceEnabled())
-            log.trace(sm.getString("http11protocol.setattribute", name, 
value));
-
-        attributes.put(name, value);
-    }
-
-    @Override
-    public Object getAttribute( String key ) {
-        if( log.isTraceEnabled())
-            log.trace(sm.getString("http11protocol.getattribute", key));
-        return attributes.get(key);
-    }
-
-    @Override
-    public Iterator<String> getAttributeNames() {
-        return attributes.keySet().iterator();
-    }
-
-    /**
-     * The adapter, used to call the connector.
-     */
-    protected Adapter adapter;
-    @Override
-    public void setAdapter(Adapter adapter) { this.adapter = adapter; }
-    @Override
-    public Adapter getAdapter() { return adapter; }
-
-
     /** Start the protocol
      */
     @Override
     public void init() throws Exception {
         endpoint.setName(getName());
-        endpoint.setHandler(cHandler);
+        ((AprEndpoint)endpoint).setHandler(cHandler);
 
         try {
             endpoint.init();
@@ -120,9 +84,6 @@ public class Http11AprProtocol implement
 
     }
 
-    ObjectName tpOname;
-    ObjectName rgOname;
-
     @Override
     public void start() throws Exception {
         if( this.domain != null ) {
@@ -151,332 +112,132 @@ public class Http11AprProtocol implement
     }
 
     @Override
-    public void pause() throws Exception {
-        try {
-            endpoint.pause();
-        } catch (Exception ex) {
-            log.error(sm.getString("http11protocol.endpoint.pauseerror"), ex);
-            throw ex;
-        }
-        if(log.isInfoEnabled())
-            log.info(sm.getString("http11protocol.pause", getName()));
-    }
-
-    @Override
-    public void resume() throws Exception {
-        try {
-            endpoint.resume();
-        } catch (Exception ex) {
-            log.error(sm.getString("http11protocol.endpoint.resumeerror"), ex);
-            throw ex;
-        }
-        if(log.isInfoEnabled())
-            log.info(sm.getString("http11protocol.resume", getName()));
-    }
-
-    @Override
     public void destroy() throws Exception {
-        if(log.isInfoEnabled())
-            log.info(sm.getString("http11protocol.stop", getName()));
-        endpoint.destroy();
         cHandler.recycledProcessors.clear();
-        if( tpOname!=null )
-            Registry.getRegistry(null, null).unregisterComponent(tpOname);
-        if( rgOname != null )
-            Registry.getRegistry(null, null).unregisterComponent(rgOname);
-    }
-
-    public String getName() {
-        String encodedAddr = "";
-        if (getAddress() != null) {
-            encodedAddr = "" + getAddress();
-            if (encodedAddr.startsWith("/"))
-                encodedAddr = encodedAddr.substring(1);
-            encodedAddr = URLEncoder.encode(encodedAddr) + "-";
-        }
-        return ("http-" + encodedAddr + endpoint.getPort());
+        super.destroy();
     }
 
-    protected AprEndpoint endpoint=new AprEndpoint();
-
-    protected HashMap<String, Object> attributes = new HashMap<String, 
Object>();
-
-    private Http11ConnectionHandler cHandler = new 
Http11ConnectionHandler(this);
-
-    /**
-     * Processor cache.
-     */
-    protected int processorCache = -1;
-    public int getProcessorCache() { return this.processorCache; }
-    public void setProcessorCache(int processorCache) { this.processorCache = 
processorCache; }
-
-    @Override
-    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); }
-
-    public int getThreadPriority() { return endpoint.getThreadPriority(); }
-    public void setThreadPriority(int threadPriority) { 
endpoint.setThreadPriority(threadPriority); }
-
-    public int getBacklog() { return endpoint.getBacklog(); }
-    public void setBacklog(int backlog) { endpoint.setBacklog(backlog); }
-
-    public int getPort() { return endpoint.getPort(); }
-    public void setPort(int port) { endpoint.setPort(port); }
-
-    public InetAddress getAddress() { return endpoint.getAddress(); }
-    public void setAddress(InetAddress ia) { endpoint.setAddress(ia); }
-
-    public boolean getTcpNoDelay() { return endpoint.getTcpNoDelay(); }
-    public void setTcpNoDelay(boolean tcpNoDelay) { 
endpoint.setTcpNoDelay(tcpNoDelay); }
-
-    public int getSoLinger() { return endpoint.getSoLinger(); }
-    public void setSoLinger(int soLinger) { endpoint.setSoLinger(soLinger); }
-
-    public int getSoTimeout() { return endpoint.getSoTimeout(); }
-    public void setSoTimeout(int soTimeout) { 
endpoint.setSoTimeout(soTimeout); }
-
-    /**
-     * The number of seconds Tomcat will wait for a subsequent request
-     * before closing the connection.
-     */
-    public int getKeepAliveTimeout() { return endpoint.getKeepAliveTimeout(); }
-    public void setKeepAliveTimeout(int timeout) { 
endpoint.setKeepAliveTimeout(timeout); }
-
-    public boolean getUseSendfile() { return endpoint.getUseSendfile(); }
-    public void setUseSendfile(boolean useSendfile) { 
endpoint.setUseSendfile(useSendfile); }
-
-    public int getPollTime() { return endpoint.getPollTime(); }
-    public void setPollTime(int pollTime) { endpoint.setPollTime(pollTime); }
-
-    public void setPollerSize(int pollerSize) { 
endpoint.setPollerSize(pollerSize); }
-    public int getPollerSize() { return endpoint.getPollerSize(); }
-
-    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(); }
-
-    public boolean getDeferAccept() { return endpoint.getDeferAccept(); }
-    public void setDeferAccept(boolean deferAccept) { 
endpoint.setDeferAccept(deferAccept); }
-
-    protected int socketBuffer = 9000;
-    public int getSocketBuffer() { return socketBuffer; }
-    public void setSocketBuffer(int socketBuffer) { this.socketBuffer = 
socketBuffer; }
-
-    /**
-     * Maximum size of the post which will be saved when processing certain
-     * requests, such as a POST.
-     */
-    protected int maxSavePostSize = 4 * 1024;
-    public int getMaxSavePostSize() { return maxSavePostSize; }
-    public void setMaxSavePostSize(int valueI) { maxSavePostSize = valueI; }
-
-    // HTTP
-    /**
-     * Maximum size of the HTTP message header.
-     */
-    protected int maxHttpHeaderSize = 8 * 1024;
-    public int getMaxHttpHeaderSize() { return maxHttpHeaderSize; }
-    public void setMaxHttpHeaderSize(int valueI) { maxHttpHeaderSize = valueI; 
}
-
-
-    // HTTP
-    /**
-     * If true, the regular socket timeout will be used for the full duration
-     * of the connection.
-     */
-    protected boolean disableUploadTimeout = true;
-    public boolean getDisableUploadTimeout() { return disableUploadTimeout; }
-    public void setDisableUploadTimeout(boolean isDisabled) { 
disableUploadTimeout = isDisabled; }
+    private Http11ConnectionHandler cHandler;
 
-    // HTTP
-    /**
-     * Integrated compression support.
-     */
-    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; }
+    public boolean getUseSendfile() { return 
((AprEndpoint)endpoint).getUseSendfile(); }
+    public void setUseSendfile(boolean useSendfile) { 
((AprEndpoint)endpoint).setUseSendfile(useSendfile); }
 
-    
-    // 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; }
-    public void setCompressionMinSize(int valueI) { compressionMinSize = 
valueI; }
+    public int getPollTime() { return ((AprEndpoint)endpoint).getPollTime(); }
+    public void setPollTime(int pollTime) { 
((AprEndpoint)endpoint).setPollTime(pollTime); }
 
+    public void setPollerSize(int pollerSize) { 
((AprEndpoint)endpoint).setPollerSize(pollerSize); }
+    public int getPollerSize() { return 
((AprEndpoint)endpoint).getPollerSize(); }
 
-    // HTTP
-    /**
-     * User agents regular expressions which should be restricted to HTTP/1.0 
support.
-     */
-    protected String restrictedUserAgents = null;
-    public String getRestrictedUserAgents() { return restrictedUserAgents; }
-    public void setRestrictedUserAgents(String valueS) { restrictedUserAgents 
= valueS; }
+    public void setPollerThreadCount(int pollerThreadCount) { 
((AprEndpoint)endpoint).setPollerThreadCount(pollerThreadCount); }
+    public int getPollerThreadCount() { return 
((AprEndpoint)endpoint).getPollerThreadCount(); }
     
+    public int getSendfileSize() { return 
((AprEndpoint)endpoint).getSendfileSize(); }
+    public void setSendfileSize(int sendfileSize) { 
((AprEndpoint)endpoint).setSendfileSize(sendfileSize); }
     
-    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 
-     * connection. The default is the same as for Apache HTTP Server.
-     */
-    protected int maxKeepAliveRequests = 100;
-    public int getMaxKeepAliveRequests() { return maxKeepAliveRequests; }
-    public void setMaxKeepAliveRequests(int mkar) { maxKeepAliveRequests = 
mkar; }
+    public void setSendfileThreadCount(int sendfileThreadCount) { 
((AprEndpoint)endpoint).setSendfileThreadCount(sendfileThreadCount); }
+    public int getSendfileThreadCount() { return 
((AprEndpoint)endpoint).getSendfileThreadCount(); }
 
-    /**
-     * Return the Keep-Alive policy for the connection.
-     */
-    public boolean getKeepAlive() {
-        return ((maxKeepAliveRequests != 0) && (maxKeepAliveRequests != 1));
-    }
-
-    /**
-     * Set the keep-alive policy for this connection.
-     */
-    public void setKeepAlive(boolean keepAlive) {
-        if (!keepAlive) {
-            setMaxKeepAliveRequests(1);
-        }
-    }
-
-    /**
-     * Server header.
-     */
-    protected String server;
-    public void setServer( String server ) { this.server = server; }
-    public String getServer() { return server; }
+    public boolean getDeferAccept() { return 
((AprEndpoint)endpoint).getDeferAccept(); }
+    public void setDeferAccept(boolean deferAccept) { 
((AprEndpoint)endpoint).setDeferAccept(deferAccept); }
 
     /**
      * This timeout represents the socket timeout which will be used while
      * the adapter execution is in progress, unless disableUploadTimeout
      * is set to true. The default is the same as for Apache HTTP Server
      * (300 000 milliseconds).
+     * TODO: Make the timeout attribute names consistent across the connectors
      */
     protected int timeout = 300000;
+    @Override
     public int getTimeout() { return timeout; }
+    @Override
     public void setTimeout(int timeout) { this.timeout = timeout; }
 
-    /**
-     * This field indicates if the protocol is secure from the perspective of
-     * the client (= https is used).
-     */
-    protected boolean secure;
-    public boolean getSecure() { return secure; }
-    public void setSecure(boolean b) { secure = b; }
-
     // --------------------  SSL related properties --------------------
 
     /**
-     * SSL engine.
-     */
-    public boolean isSSLEnabled() { return endpoint.isSSLEnabled(); }
-    public void setSSLEnabled(boolean SSLEnabled) { 
endpoint.setSSLEnabled(SSLEnabled); }
-
-
-    /**
      * SSL protocol.
      */
-    public String getSSLProtocol() { return endpoint.getSSLProtocol(); }
-    public void setSSLProtocol(String SSLProtocol) { 
endpoint.setSSLProtocol(SSLProtocol); }
+    public String getSSLProtocol() { return 
((AprEndpoint)endpoint).getSSLProtocol(); }
+    public void setSSLProtocol(String SSLProtocol) { 
((AprEndpoint)endpoint).setSSLProtocol(SSLProtocol); }
 
 
     /**
      * SSL password (if a cert is encrypted, and no password has been 
provided, a callback
      * will ask for a password).
      */
-    public String getSSLPassword() { return endpoint.getSSLPassword(); }
-    public void setSSLPassword(String SSLPassword) { 
endpoint.setSSLPassword(SSLPassword); }
+    public String getSSLPassword() { return 
((AprEndpoint)endpoint).getSSLPassword(); }
+    public void setSSLPassword(String SSLPassword) { 
((AprEndpoint)endpoint).setSSLPassword(SSLPassword); }
 
 
     /**
      * SSL cipher suite.
      */
-    public String getSSLCipherSuite() { return endpoint.getSSLCipherSuite(); }
-    public void setSSLCipherSuite(String SSLCipherSuite) { 
endpoint.setSSLCipherSuite(SSLCipherSuite); }
+    public String getSSLCipherSuite() { return 
((AprEndpoint)endpoint).getSSLCipherSuite(); }
+    public void setSSLCipherSuite(String SSLCipherSuite) { 
((AprEndpoint)endpoint).setSSLCipherSuite(SSLCipherSuite); }
 
 
     /**
      * SSL certificate file.
      */
-    public String getSSLCertificateFile() { return 
endpoint.getSSLCertificateFile(); }
-    public void setSSLCertificateFile(String SSLCertificateFile) { 
endpoint.setSSLCertificateFile(SSLCertificateFile); }
+    public String getSSLCertificateFile() { return 
((AprEndpoint)endpoint).getSSLCertificateFile(); }
+    public void setSSLCertificateFile(String SSLCertificateFile) { 
((AprEndpoint)endpoint).setSSLCertificateFile(SSLCertificateFile); }
 
 
     /**
      * SSL certificate key file.
      */
-    public String getSSLCertificateKeyFile() { return 
endpoint.getSSLCertificateKeyFile(); }
-    public void setSSLCertificateKeyFile(String SSLCertificateKeyFile) { 
endpoint.setSSLCertificateKeyFile(SSLCertificateKeyFile); }
+    public String getSSLCertificateKeyFile() { return 
((AprEndpoint)endpoint).getSSLCertificateKeyFile(); }
+    public void setSSLCertificateKeyFile(String SSLCertificateKeyFile) { 
((AprEndpoint)endpoint).setSSLCertificateKeyFile(SSLCertificateKeyFile); }
 
 
     /**
      * SSL certificate chain file.
      */
-    public String getSSLCertificateChainFile() { return 
endpoint.getSSLCertificateChainFile(); }
-    public void setSSLCertificateChainFile(String SSLCertificateChainFile) { 
endpoint.setSSLCertificateChainFile(SSLCertificateChainFile); }
+    public String getSSLCertificateChainFile() { return 
((AprEndpoint)endpoint).getSSLCertificateChainFile(); }
+    public void setSSLCertificateChainFile(String SSLCertificateChainFile) { 
((AprEndpoint)endpoint).setSSLCertificateChainFile(SSLCertificateChainFile); }
 
 
     /**
      * SSL CA certificate path.
      */
-    public String getSSLCACertificatePath() { return 
endpoint.getSSLCACertificatePath(); }
-    public void setSSLCACertificatePath(String SSLCACertificatePath) { 
endpoint.setSSLCACertificatePath(SSLCACertificatePath); }
+    public String getSSLCACertificatePath() { return 
((AprEndpoint)endpoint).getSSLCACertificatePath(); }
+    public void setSSLCACertificatePath(String SSLCACertificatePath) { 
((AprEndpoint)endpoint).setSSLCACertificatePath(SSLCACertificatePath); }
 
 
     /**
      * SSL CA certificate file.
      */
-    public String getSSLCACertificateFile() { return 
endpoint.getSSLCACertificateFile(); }
-    public void setSSLCACertificateFile(String SSLCACertificateFile) { 
endpoint.setSSLCACertificateFile(SSLCACertificateFile); }
+    public String getSSLCACertificateFile() { return 
((AprEndpoint)endpoint).getSSLCACertificateFile(); }
+    public void setSSLCACertificateFile(String SSLCACertificateFile) { 
((AprEndpoint)endpoint).setSSLCACertificateFile(SSLCACertificateFile); }
 
 
     /**
      * SSL CA revocation path.
      */
-    public String getSSLCARevocationPath() { return 
endpoint.getSSLCARevocationPath(); }
-    public void setSSLCARevocationPath(String SSLCARevocationPath) { 
endpoint.setSSLCARevocationPath(SSLCARevocationPath); }
+    public String getSSLCARevocationPath() { return 
((AprEndpoint)endpoint).getSSLCARevocationPath(); }
+    public void setSSLCARevocationPath(String SSLCARevocationPath) { 
((AprEndpoint)endpoint).setSSLCARevocationPath(SSLCARevocationPath); }
 
 
     /**
      * SSL CA revocation file.
      */
-    public String getSSLCARevocationFile() { return 
endpoint.getSSLCARevocationFile(); }
-    public void setSSLCARevocationFile(String SSLCARevocationFile) { 
endpoint.setSSLCARevocationFile(SSLCARevocationFile); }
+    public String getSSLCARevocationFile() { return 
((AprEndpoint)endpoint).getSSLCARevocationFile(); }
+    public void setSSLCARevocationFile(String SSLCARevocationFile) { 
((AprEndpoint)endpoint).setSSLCARevocationFile(SSLCARevocationFile); }
 
 
     /**
      * SSL verify client.
      */
-    public String getSSLVerifyClient() { return endpoint.getSSLVerifyClient(); 
}
-    public void setSSLVerifyClient(String SSLVerifyClient) { 
endpoint.setSSLVerifyClient(SSLVerifyClient); }
+    public String getSSLVerifyClient() { return 
((AprEndpoint)endpoint).getSSLVerifyClient(); }
+    public void setSSLVerifyClient(String SSLVerifyClient) { 
((AprEndpoint)endpoint).setSSLVerifyClient(SSLVerifyClient); }
 
 
     /**
      * SSL verify depth.
      */
-    public int getSSLVerifyDepth() { return endpoint.getSSLVerifyDepth(); }
-    public void setSSLVerifyDepth(int SSLVerifyDepth) { 
endpoint.setSSLVerifyDepth(SSLVerifyDepth); }
+    public int getSSLVerifyDepth() { return 
((AprEndpoint)endpoint).getSSLVerifyDepth(); }
+    public void setSSLVerifyDepth(int SSLVerifyDepth) { 
((AprEndpoint)endpoint).setSSLVerifyDepth(SSLVerifyDepth); }
     
     // --------------------  Connection handler --------------------
 
@@ -493,7 +254,7 @@ public class Http11AprProtocol implement
             protected AtomicInteger size = new AtomicInteger(0);
             @Override
             public boolean offer(Http11AprProcessor processor) {
-                boolean offer = (proto.processorCache == -1) ? true : 
(size.get() < proto.processorCache);
+                boolean offer = (proto.getProcessorCache() == -1) ? true : 
(size.get() < proto.getProcessorCache());
                 //avoid over growing our cache or add after we have stopped
                 boolean result = false;
                 if ( offer ) {
@@ -566,10 +327,10 @@ public class Http11AprProtocol implement
                             connections.remove(Long.valueOf(socket));
                             recycledProcessors.offer(result);
                             if (state == SocketState.OPEN) {
-                                proto.endpoint.getPoller().add(socket);
+                                
((AprEndpoint)proto.endpoint).getPoller().add(socket);
                             }
                         } else {
-                            proto.endpoint.getCometPoller().add(socket);
+                            
((AprEndpoint)proto.endpoint).getCometPoller().add(socket);
                         }
                     }
                 } else if (result.async) {
@@ -595,7 +356,7 @@ public class Http11AprProtocol implement
                     // processed by this thread will use either a new or a 
recycled
                     // processor.
                     connections.put(Long.valueOf(socket), processor);
-                    proto.endpoint.getCometPoller().add(socket);
+                    ((AprEndpoint)proto.endpoint).getCometPoller().add(socket);
                 } else {
                     recycledProcessors.offer(processor);
                 }
@@ -660,7 +421,7 @@ public class Http11AprProtocol implement
                         connections.remove(Long.valueOf(socket));
                         recycledProcessors.offer(result);
                         if (state == SocketState.OPEN) {
-                            proto.endpoint.getPoller().add(socket);
+                            
((AprEndpoint)proto.endpoint).getPoller().add(socket);
                         }
                     }
                 }
@@ -669,20 +430,20 @@ public class Http11AprProtocol implement
         }
 
         protected Http11AprProcessor createProcessor() {
-            Http11AprProcessor processor =
-                new Http11AprProcessor(proto.maxHttpHeaderSize, 
proto.endpoint);
+            Http11AprProcessor processor = new Http11AprProcessor(
+                    proto.getMaxHttpHeaderSize(), (AprEndpoint)proto.endpoint);
             processor.setAdapter(proto.adapter);
-            processor.setMaxKeepAliveRequests(proto.maxKeepAliveRequests);
+            processor.setMaxKeepAliveRequests(proto.getMaxKeepAliveRequests());
             processor.setTimeout(proto.timeout);
-            processor.setDisableUploadTimeout(proto.disableUploadTimeout);
-            processor.setCompressionMinSize(proto.compressionMinSize);
-            processor.setCompression(proto.compression);
-            
processor.setNoCompressionUserAgents(proto.noCompressionUserAgents);
-            processor.setCompressableMimeTypes(proto.compressableMimeTypes);
-            processor.setRestrictedUserAgents(proto.restrictedUserAgents);
-            processor.setSocketBuffer(proto.socketBuffer);
-            processor.setMaxSavePostSize(proto.maxSavePostSize);
-            processor.setServer(proto.server);
+            processor.setDisableUploadTimeout(proto.getDisableUploadTimeout());
+            processor.setCompressionMinSize(proto.getCompressionMinSize());
+            processor.setCompression(proto.getCompression());
+            
processor.setNoCompressionUserAgents(proto.getNoCompressionUserAgents());
+            
processor.setCompressableMimeTypes(proto.getCompressableMimeTypes());
+            processor.setRestrictedUserAgents(proto.getRestrictedUserAgents());
+            processor.setSocketBuffer(proto.getSocketBuffer());
+            processor.setMaxSavePostSize(proto.getMaxSavePostSize());
+            processor.setServer(proto.getServer());
             register(processor);
             return processor;
         }
@@ -729,39 +490,4 @@ public class Http11AprProtocol implement
         }
 
     }
-
-    // -------------------- Various implementation classes --------------------
-
-    protected String domain;
-    protected ObjectName oname;
-    protected MBeanServer mserver;
-
-    public ObjectName getObjectName() {
-        return oname;
-    }
-
-    public String getDomain() {
-        return domain;
-    }
-
-    @Override
-    public ObjectName preRegister(MBeanServer server,
-                                  ObjectName name) throws Exception {
-        oname=name;
-        mserver=server;
-        domain=name.getDomain();
-        return name;
-    }
-
-    @Override
-    public void postRegister(Boolean registrationDone) {
-    }
-
-    @Override
-    public void preDeregister() throws Exception {
-    }
-
-    @Override
-    public void postDeregister() {
-    }
 }

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=991359&r1=991358&r2=991359&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java Tue Aug 
31 22:07:58 2010
@@ -60,18 +60,14 @@ public class Http11NioProtocol extends A
         cHandler = new Http11ConnectionHandler( this );
         setSoLinger(Constants.DEFAULT_CONNECTION_LINGER);
         setSoTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
-        //setServerSoTimeout(Constants.DEFAULT_SERVER_SOCKET_TIMEOUT);
         setTcpNoDelay(Constants.DEFAULT_TCP_NO_DELAY);
-        
+        setProcessorCache(200);
     }
 
 
-
     public NioEndpoint getEndpoint() {
         return ((NioEndpoint)endpoint);
     }
-    
-
 
 
     /** Start the protocol

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java?rev=991359&r1=991358&r2=991359&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11Protocol.java Tue Aug 31 
22:07:58 2010
@@ -55,7 +55,7 @@ public class Http11Protocol extends Abst
         = org.apache.juli.logging.LogFactory.getLog(Http11Protocol.class);
     
     @Override
-    public Log getLog() { return log; }
+    protected Log getLog() { return log; }
 
 
     // ------------------------------------------------------------ Constructor
@@ -63,32 +63,23 @@ public class Http11Protocol extends Abst
 
     public Http11Protocol() {
         endpoint = new JIoEndpoint();
+        cHandler = new Http11ConnectionHandler(this);
         setSoLinger(Constants.DEFAULT_CONNECTION_LINGER);
         setSoTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
-        //setServerSoTimeout(Constants.DEFAULT_SERVER_SOCKET_TIMEOUT);
         setTcpNoDelay(Constants.DEFAULT_TCP_NO_DELAY);
-        
+        setProcessorCache(200);
     }
 
     
     // ----------------------------------------------------------------- Fields
 
-
-    protected Http11ConnectionHandler cHandler = new 
Http11ConnectionHandler(this);
+    protected Http11ConnectionHandler cHandler;
 
 
     protected ServerSocketFactory socketFactory = null;
    
 
-
     // ----------------------------------------- ProtocolHandler Implementation
-    // *
-
-
-
-
-
-
 
     @Override
     public void init() throws Exception {

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=991359&r1=991358&r2=991359&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Aug 31 22:07:58 2010
@@ -115,6 +115,10 @@
         not received all at the same time and the socket needs to be returned 
to
         the poller. (markt)
       </fix>
+      <update>
+        Further work to reduce the code duplication in the HTTP connectors.
+        (markt)
+      </update>
     </changelog>
   </subsection>
   <subsection name="Jasper">



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

Reply via email to