tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From billbar...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteConnector.java
Date Thu, 22 May 2003 03:43:37 GMT
billbarker    2003/05/21 20:43:37

  Modified:    catalina/src/share/org/apache/coyote/tomcat5
                        CoyoteConnector.java
  Log:
  Initial version of the proposal to pass-through all attributes to the protocolHandler, and
let it deal.
  
  Now, only explictly configured attributes are passed through to the Protocol.  It is the
Protocol's responsibility to have the correct default attributes configured.  This way, the
HTTP/1.1 connector can default the value of "connectionTimeout" to one value, and the Jk-Coyote
connector can default it to another.
  
  For now, I'm leaving the getters and setters for all of the different attributes, so that
they can still be seen from the JMX consol.  In the transistion, some of the values shown
may be wrong because of the paragraph above.
  
  For now, I'm leaving in the SSL SocketFactory support (for backwards compatibility).  It
should be deprecated.  You can configure SSL support without it by e.g. specifying "property[keystore]=/path/to/my/.keystore"
on the connector.
  
  Revision  Changes    Path
  1.9       +68 -31    jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- CoyoteConnector.java	14 May 2003 17:49:32 -0000	1.8
  +++ CoyoteConnector.java	22 May 2003 03:43:37 -0000	1.9
  @@ -61,6 +61,8 @@
   package org.apache.coyote.tomcat5;
   
   import java.util.Vector;
  +import java.util.HashMap;
  +import java.util.Iterator;
   import java.lang.reflect.Method;
   
   import javax.management.ObjectName;
  @@ -115,6 +117,11 @@
   
   
       /**
  +     * Holder for our configured properties.
  +     */
  +    private HashMap properties = new HashMap();
  +
  +    /**
        * The <code>Service</code> we are associated with (if any).
        */
       private Service service = null;
  @@ -373,6 +380,26 @@
   
       // ------------------------------------------------------------- Properties
   
  +    /**
  +     * Return a configured property.
  +     */
  +    public Object getProperty(String name) {
  +        return properties.get(name);
  +    }
  +
  +    /**
  +     * Set a configured property.
  +     */
  +    public void setProperty(String name, Object value) {
  +        properties.put(name, value);
  +    }
  +
  +    /** 
  +     * remove a configured property.
  +     */
  +    public void removeProperty(String name) {
  +        properties.remove(name);
  +    }
   
       /**
        * Return the <code>Service</code> with which we are associated (if any).
  @@ -392,6 +419,7 @@
       public void setService(Service service) {
   
           this.service = service;
  +        setProperty("service", service);
   
       }
   
  @@ -415,6 +443,7 @@
       public void setCompression(String compression) {
   
           this.compression = compression;
  +        setProperty("compression", compression);
   
       }
   
  @@ -437,6 +466,7 @@
       public void setConnectionLinger(int connectionLinger) {
   
           this.connectionLinger = connectionLinger;
  +        setProperty("soLinger", String.valueOf(connectionLinger));
   
       }
   
  @@ -459,6 +489,7 @@
       public void setConnectionTimeout(int connectionTimeout) {
   
           this.connectionTimeout = connectionTimeout;
  +        setProperty("soTimeout", String.valueOf(connectionTimeout));
   
       }
   
  @@ -481,6 +512,7 @@
       public void setConnectionUploadTimeout(int connectionUploadTimeout) {
   
           this.connectionUploadTimeout = connectionUploadTimeout;
  +        setProperty("timeout", String.valueOf(connectionUploadTimeout));
   
       }
   
  @@ -503,6 +535,7 @@
       public void setServerSocketTimeout(int serverSocketTimeout) {
   
           this.serverSocketTimeout = serverSocketTimeout;
  +        setProperty("serverSoTimeout", String.valueOf(serverSocketTimeout));
   
       }
   
  @@ -525,6 +558,7 @@
       public void setAcceptCount(int count) {
   
           this.acceptCount = count;
  +        setProperty("backlog", String.valueOf(count));
   
       }
   
  @@ -547,6 +581,7 @@
       public void setAddress(String address) {
   
           this.address = address;
  +        setProperty("address", address);
   
       }
   
  @@ -579,6 +614,7 @@
       public void setBufferSize(int bufferSize) {
   
           this.bufferSize = bufferSize;
  +        setProperty("bufferSize", String.valueOf(bufferSize));
   
       }
   
  @@ -660,6 +696,7 @@
       public void setEnableLookups(boolean enableLookups) {
   
           this.enableLookups = enableLookups;
  +        setProperty("enableLookups", String.valueOf(enableLookups));
   
       }
   
  @@ -729,6 +766,7 @@
       public void setMinProcessors(int minProcessors) {
   
           this.minProcessors = minProcessors;
  +        setProperty("minProcessors", String.valueOf(minProcessors));
   
       }
   
  @@ -751,6 +789,7 @@
       public void setMaxProcessors(int maxProcessors) {
   
           this.maxProcessors = maxProcessors;
  +        setProperty("maxProcessors", String.valueOf(maxProcessors));
   
       }
   
  @@ -773,6 +812,7 @@
       public void setPort(int port) {
   
           this.port = port;
  +        setProperty("port", String.valueOf(port));
   
       }
   
  @@ -829,8 +869,10 @@
   
           if(proxyName != null && proxyName.length() > 0) {
               this.proxyName = proxyName;
  +            setProperty("proxyName", proxyName);
           } else {
               this.proxyName = null;
  +            removeProperty("proxyName");
           }
   
       }
  @@ -854,6 +896,7 @@
       public void setProxyPort(int proxyPort) {
   
           this.proxyPort = proxyPort;
  +        setProperty("proxyPort", String.valueOf(proxyPort));
   
       }
   
  @@ -878,6 +921,7 @@
       public void setRedirectPort(int redirectPort) {
   
           this.redirectPort = redirectPort;
  +        setProperty("redirectPort", String.valueOf(redirectPort));
   
       }
   
  @@ -897,6 +941,7 @@
        */
       public void setDisableUploadTimeout( boolean isDisabled ) {
           disableUploadTimeout = isDisabled;
  +        setProperty("disableUploadTimeout", String.valueOf(isDisabled));
       }
   
   
  @@ -912,7 +957,7 @@
        */
       public void setKeepAlive(boolean keepAlive) {
           if (!keepAlive) {
  -            maxKeepAliveRequests = 1;
  +            setMaxKeepAliveRequests(1);
           }
       }
   
  @@ -929,6 +974,7 @@
        */
       public void setMaxKeepAliveRequests(int mkar) {
           maxKeepAliveRequests = mkar;
  +        setProperty("maxKeepAliveRequests", String.valueOf(mkar));
       }
   
        /**
  @@ -981,6 +1027,7 @@
       public void setScheme(String scheme) {
   
           this.scheme = scheme;
  +        setProperty("scheme", scheme);
   
       }
   
  @@ -1005,6 +1052,7 @@
       public void setSecure(boolean secure) {
   
           this.secure = secure;
  +        setProperty("secure", String.valueOf(secure));
   
       }
   
  @@ -1014,6 +1062,7 @@
   
       public void setTomcatAuthentication(boolean tomcatAuthentication) {
           this.tomcatAuthentication = tomcatAuthentication;
  +        setProperty("tomcatAuthentication", String.valueOf(tomcatAuthentication));
       }
       
   
  @@ -1036,6 +1085,7 @@
       public void setTcpNoDelay(boolean tcpNoDelay) {
   
           this.tcpNoDelay = tcpNoDelay;
  +        setProperty("tcpNoDelay", String.valueOf(tcpNoDelay));
   
       }
   
  @@ -1058,6 +1108,7 @@
        public void setURIEncoding(String URIEncoding) {
   
            this.URIEncoding = URIEncoding;
  +         setProperty("uRIEncoding", URIEncoding);
   
        }
   
  @@ -1214,36 +1265,8 @@
           IntrospectionUtils.setProperty(protocolHandler, "jkHome",
                                          System.getProperty("catalina.base"));
   
  -        // Set attributes
  -        IntrospectionUtils.setProperty(protocolHandler, "port", "" + port);
  -        IntrospectionUtils.setProperty(protocolHandler, "maxThreads",
  -                                       "" + maxProcessors);
  -        IntrospectionUtils.setProperty(protocolHandler, "backlog",
  -                                       "" + acceptCount);
  -        IntrospectionUtils.setProperty(protocolHandler, "tcpNoDelay",
  -                                       "" + tcpNoDelay);
  -        IntrospectionUtils.setProperty(protocolHandler, "soLinger",
  -                                       "" + connectionLinger);
  -        IntrospectionUtils.setProperty(protocolHandler, "soTimeout",
  -                                       "" + connectionTimeout);
  -        IntrospectionUtils.setProperty(protocolHandler, "timeout",
  -                                       "" + connectionUploadTimeout);
  -        IntrospectionUtils.setProperty(protocolHandler, "serverSoTimeout",
  -                                       "" + serverSocketTimeout);
  -        IntrospectionUtils.setProperty(protocolHandler, "disableUploadTimeout",
  -                                       "" + disableUploadTimeout);
  -        IntrospectionUtils.setProperty(protocolHandler, "maxKeepAliveRequests",
  -                                       "" + maxKeepAliveRequests);
  -        IntrospectionUtils.setProperty(protocolHandler, "tomcatAuthentication",
  -                                       "" + tomcatAuthentication);
  -        IntrospectionUtils.setProperty(protocolHandler, "compression",
  -                                       compression);
  -        if (address != null) {
  -            IntrospectionUtils.setProperty(protocolHandler, "address",
  -                                           address);
  -        }
  -
           // Configure secure socket factory
  +        // XXX For backwards compatibility only.
           if (factory instanceof CoyoteServerSocketFactory) {
               IntrospectionUtils.setProperty(protocolHandler, "secure",
                                              "" + true);
  @@ -1275,6 +1298,16 @@
               IntrospectionUtils.setProperty(protocolHandler, "secure",
                                              "" + false);
           }
  +        /* Set the configured properties.  This only sets the ones that were
  +           explicitly configured.  Default values are the responsibility of
  +           the protocolHandler. */
  +        Iterator keys = properties.keySet().iterator();
  +        while( keys.hasNext() ) {
  +            String name = (String)keys.next();
  +            String value = properties.get(name).toString(); 
  +            IntrospectionUtils.setProperty(protocolHandler, name, value);
  +        }
  +        
   
           try {
               protocolHandler.init();
  @@ -1390,6 +1423,7 @@
       }
   
       public void setClientAuth(boolean clientAuth) {
  +        setProperty("clientauth", String.valueOf(clientAuth));
           ServerSocketFactory factory= this.getFactory();
           if( ! (factory instanceof CoyoteServerSocketFactory) )
               return;
  @@ -1407,11 +1441,13 @@
       }
   
       public void setKeystoreFile(String keystoreFile) {
  +        setProperty("keystore", keystoreFile);
           ServerSocketFactory factory= this.getFactory();
           if( ! (factory instanceof CoyoteServerSocketFactory) )
               return;
           CoyoteServerSocketFactory coyoteFactory=(CoyoteServerSocketFactory)factory;
           coyoteFactory.setKeystoreFile(keystoreFile);
  +        
       }
   
       /**
  @@ -1430,6 +1466,7 @@
        * Set keystorePass
        */
       public void setKeystorePass(String keystorePass) {
  +        setProperty("keypass", keystorePass);
           ServerSocketFactory factory = getFactory();
           if( factory instanceof CoyoteServerSocketFactory ) {
               ((CoyoteServerSocketFactory)factory).setKeystorePass(keystorePass);
  
  
  

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


Mime
View raw message