tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup ConnectorCreateRule.java Embedded.java Catalina.java
Date Wed, 29 Sep 2004 09:55:39 GMT
remm        2004/09/29 02:55:39

  Modified:    catalina/src/share/org/apache/catalina/mbeans
                        ConnectorMBean.java MBeanFactory.java
               catalina/src/share/org/apache/catalina/connector
                        Connector.java mbeans-descriptors.xml
               catalina/src/share/org/apache/catalina/startup Embedded.java
                        Catalina.java
  Added:       catalina/src/share/org/apache/catalina/startup
                        ConnectorCreateRule.java
  Log:
  - Refactor connector a little.
  - Remove many fields from Connector.
  - Tie the creation of the Connector to the creation of the protocol handler.
  
  Revision  Changes    Path
  1.9       +37 -118   jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/ConnectorMBean.java
  
  Index: ConnectorMBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/ConnectorMBean.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ConnectorMBean.java	2 Aug 2004 06:13:32 -0000	1.8
  +++ ConnectorMBean.java	29 Sep 2004 09:55:37 -0000	1.9
  @@ -75,48 +75,30 @@
        * @exception ReflectionException if a Java reflection exception
        *  occurs when invoking the getter
        */
  -    public Object getAttribute(String name)
  -        throws AttributeNotFoundException, MBeanException,
  -        ReflectionException {
  -		
  - 	Object attribute = null;
  +    public Object getAttribute(String name) throws AttributeNotFoundException,
  +            MBeanException, ReflectionException {
  +
  +        Object attribute = null;
           // Validate the input parameters
           if (name == null)
  -            throw new RuntimeOperationsException
  -                (new IllegalArgumentException("Attribute name is null"),
  -                 "Attribute name is null");
  -		 
  -        Connector connector = null;
  -	try {
  -	    connector = (Connector) getManagedResource();
  -	} catch (InstanceNotFoundException e) {
  -	    throw new MBeanException(e);
  -	} catch (InvalidTargetObjectTypeException e) {
  -	   throw new MBeanException(e);
  -        } 	    
  -	
  -	if (isProtocolProperty(name)) {
  -                
  -            name = translateAttributeName(name);
  -                
  -            ProtocolHandler protocolHandler = connector.getProtocolHandler();
  -	    /* check the Protocol first, since JkCoyote has an independent
  -             * configure method.
  -             */
  -            try {
  -                if( protocolHandler != null ) {
  -                    attribute = IntrospectionUtils.getAttribute(protocolHandler, name);
  -                } else {
  -                    attribute = connector.getProperty(name);
  -                }
  -            } catch (Exception e) {
  -                throw new MBeanException(e);
  +            throw new RuntimeOperationsException(new IllegalArgumentException(
  +                    "Attribute name is null"), "Attribute name is null");
  +
  +        Object result = null;
  +        try {
  +            Connector connector = (Connector) getManagedResource();
  +            result = IntrospectionUtils.getProperty(connector, name);
  +            // FIXME: I don't understand why this is needed
  +            if (result == null) {
  +                result = IntrospectionUtils.getProperty(connector.getProtocolHandler(),
name);
               }
  -	} else {
  -	    attribute = super.getAttribute(name);
  -	}
  -	
  -        return attribute;
  +        } catch (InstanceNotFoundException e) {
  +            throw new MBeanException(e);
  +        } catch (InvalidTargetObjectTypeException e) {
  +            throw new MBeanException(e);
  +        }
  +
  +        return result;
   
       }
   
  @@ -135,92 +117,29 @@
        *  occurs when invoking the getter
        */
        public void setAttribute(Attribute attribute)
  -        throws AttributeNotFoundException, MBeanException,
  -        ReflectionException {
  +            throws AttributeNotFoundException, MBeanException,
  +            ReflectionException {
   
           // Validate the input parameters
           if (attribute == null)
  -            throw new RuntimeOperationsException
  -                (new IllegalArgumentException("Attribute is null"),
  -                 "Attribute is null");
  +            throw new RuntimeOperationsException(new IllegalArgumentException(
  +                    "Attribute is null"), "Attribute is null");
           String name = attribute.getName();
           Object value = attribute.getValue();
           if (name == null)
  -            throw new RuntimeOperationsException
  -                (new IllegalArgumentException("Attribute name is null"),
  -                 "Attribute name is null"); 
  -		 
  -        Connector connector = null;
  -	try {
  -	    connector = (Connector) getManagedResource();
  -	} catch (InstanceNotFoundException e) {
  -	    throw new MBeanException(e);
  -	} catch (InvalidTargetObjectTypeException e) {
  -	   throw new MBeanException(e);
  -        } 	    
  -	
  -        if (isProtocolProperty(name)) {
  -
  -            name = translateAttributeName(name);
  -            
  -            ProtocolHandler protocolHandler = connector.getProtocolHandler();
  -	    /* check the Protocol first, since JkCoyote has an independent
  -             * configure method.
  -             */
  -            try {
  -                if( protocolHandler != null ) {
  -                    IntrospectionUtils.setAttribute(protocolHandler, name, value);
  -                } else {
  -                    connector.setProperty(name, value);
  -                }
  -            } catch (Exception e) {
  -                throw new MBeanException(e);
  -            }
  +            throw new RuntimeOperationsException(new IllegalArgumentException(
  +                    "Attribute name is null"), "Attribute name is null");
  +
  +        try {
  +            Connector connector = (Connector) getManagedResource();
  +            IntrospectionUtils.setProperty(connector, name, String.valueOf(value));
  +        } catch (InstanceNotFoundException e) {
  +            throw new MBeanException(e);
  +        } catch (InvalidTargetObjectTypeException e) {
  +            throw new MBeanException(e);
  +        }
     
  -	} else {
  -	    super.setAttribute(attribute);
  -	}
  -	
       }
   
   
  -    // ------------------------------------------------------------- Operations
  -    
  -    // ------------------------------------------------------------- Methods
  -
  -    /**
  -     * Test for a property that is really on the Protocol.
  -     */
  -    private boolean isProtocolProperty(String name) {
  -        return ("algorithm").equals(name) || 
  -            ("keystoreType").equals(name) ||
  -            ("maxThreads").equals(name) || 
  -            ("maxSpareThreads").equals(name) ||
  -            ("minSpareThreads").equals(name);
  -    }    
  -
  -    /*
  -     * Translate the attribute name from the legacy Factory names to their
  -     * internal protocol names.
  -     */
  -    private String translateAttributeName(String name) {
  -	if ("clientAuth".equals(name)) {
  -	    return "clientauth";
  -	} else if ("keystoreFile".equals(name)) {
  -	    return "keystore";
  -	} else if ("randomFile".equals(name)) {
  -	    return "randomfile";
  -	} else if ("rootFile".equals(name)) {
  -	    return "rootfile";
  -	} else if ("keystorePass".equals(name)) {
  -	    return "keypass";
  -	} else if ("keystoreType".equals(name)) {
  -	    return "keytype";
  -	} else if ("sslProtocol".equals(name)) {
  -	    return "protocol";
  -	} else if ("sslProtocols".equals(name)) {
  -	    return "protocols";
  -	}
  -	return name;
  -    }
   }
  
  
  
  1.31      +3 -4      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java
  
  Index: MBeanFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- MBeanFactory.java	29 Aug 2004 16:46:11 -0000	1.30
  +++ MBeanFactory.java	29 Sep 2004 09:55:38 -0000	1.31
  @@ -53,7 +53,6 @@
   import org.apache.catalina.valves.RequestDumperValve;
   import org.apache.catalina.valves.ValveBase;
   import org.apache.commons.modeler.BaseModelMBean;
  -import org.apache.commons.modeler.ManagedBean;
   import org.apache.commons.modeler.Registry;
   
   
  @@ -395,7 +394,7 @@
           throws Exception {
           Connector retobj = new Connector();
           if ((address!=null) && (address.length()>0)) {
  -            retobj.setAddress(address);
  +            retobj.setProperty("address", address);
           }
           // Set port number
           retobj.setPort(port);
  @@ -947,7 +946,7 @@
           Connector conns[] = (Connector[]) service.findConnectors();
   
           for (int i = 0; i < conns.length; i++) {
  -            String connAddress = conns[i].getAddress();
  +            String connAddress = String.valueOf(conns[i].getProperty("address"));
               String connPort = ""+conns[i].getPort();
   
               // if (((address.equals("null")) &&
  
  
  
  1.5       +59 -529   jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/Connector.java
  
  Index: Connector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/Connector.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Connector.java	29 Aug 2004 16:46:09 -0000	1.4
  +++ Connector.java	29 Sep 2004 09:55:38 -0000	1.5
  @@ -18,8 +18,6 @@
   package org.apache.catalina.connector;
   
   import java.net.URLEncoder;
  -import java.util.HashMap;
  -import java.util.Iterator;
   
   import javax.management.MBeanRegistration;
   import javax.management.MBeanServer;
  @@ -58,13 +56,31 @@
       private static Log log = LogFactory.getLog(Connector.class);
   
   
  -    // ----------------------------------------------------- Instance Variables
  +    // ------------------------------------------------------------ Constructor
   
   
  -    /**
  -     * Holder for our configured properties.
  -     */
  -    private HashMap properties = new HashMap();
  +    public Connector()
  +        throws Exception {
  +        this(null);
  +    }
  +    
  +    public Connector(String protocol) 
  +        throws Exception {
  +        setProtocol(protocol);
  +        // Instantiate protocol handler
  +        try {
  +            Class clazz = Class.forName(protocolHandlerClassName);
  +            this.protocolHandler = (ProtocolHandler) clazz.newInstance();
  +        } catch (Exception e) {
  +            log.error
  +                (sm.getString
  +                 ("coyoteConnector.protocolHandlerInstantiationFailed", e));
  +        }
  +    }
  +    
  +    
  +    // ----------------------------------------------------- Instance Variables
  +
   
       /**
        * The <code>Service</code> we are associated with (if any).
  @@ -73,43 +89,18 @@
   
   
       /**
  -     * The accept count for this Connector.
  -     */
  -    private int acceptCount = 10;
  -
  -
  -    /**
  -     * The IP address on which to bind, if any.  If <code>null</code>, all
  -     * addresses on the server will be bound.
  -     */
  -    private String address = null;
  -
  -
  -    /**
        * Do we allow TRACE ?
        */
       private boolean allowTrace = false;
   
   
       /**
  -     * The input buffer size we should create on input streams.
  -     */
  -    private int bufferSize = 2048;
  -
  -
  -    /**
        * The Container used for processing requests received by this Connector.
        */
       protected Container container = null;
   
   
       /**
  -     * Compression value.
  -     */
  -    private String compression = "off";
  -
  -
  -    /**
        * The "enable DNS lookups" flag for this Connector.
        */
       private boolean enableLookups = false;
  @@ -118,7 +109,7 @@
       /*
        * Is generation of X-Powered-By response header enabled/disabled?
        */
  -    private boolean xpoweredBy;
  +    private boolean xpoweredBy = false;
   
   
       /**
  @@ -135,53 +126,6 @@
   
   
       /**
  -     * The minimum number of processors to start at initialization time.
  -     */
  -    protected int minProcessors = 5;
  -
  -
  -    /**
  -     * The maximum number of processors allowed, or <0 for unlimited.
  -     */
  -    private int maxProcessors = 20;
  -
  -
  -    /**
  -     * The thread priority for processors.
  -     */
  -    private int threadPriority = Thread.NORM_PRIORITY;
  -
  -
  -    /**
  -     * Linger value on the incoming connection.
  -     * Note : a value inferior to 0 means no linger.
  -     */
  -    private int connectionLinger = Constants.DEFAULT_CONNECTION_LINGER;
  -
  -
  -    /**
  -     * Timeout value on the incoming connection.
  -     * Note : a value of 0 means no timeout.
  -     */
  -    private int connectionTimeout = Constants.DEFAULT_CONNECTION_TIMEOUT;
  -
  -
  -    /**
  -     * Timeout value on the incoming connection during request processing.
  -     * Note : a value of 0 means no timeout.
  -     */
  -    private int connectionUploadTimeout = 
  -        Constants.DEFAULT_CONNECTION_UPLOAD_TIMEOUT;
  -
  -
  -    /**
  -     * Timeout value on the server socket.
  -     * Note : a value of 0 means no timeout.
  -     */
  -    private int serverSocketTimeout = Constants.DEFAULT_SERVER_SOCKET_TIMEOUT;
  -
  -
  -    /**
        * The port number on which we listen for requests.
        */
       private int port = 0;
  @@ -225,11 +169,6 @@
       private boolean secure = false;
   
   
  -    /** For jk, do tomcat authentication if true, trust server if false 
  -     */ 
  -    private boolean tomcatAuthentication = true;
  -
  -
       /**
        * The string manager for this package.
        */
  @@ -238,27 +177,6 @@
   
   
       /**
  -     * Flag to disable setting a seperate time-out for uploads.
  -     * If <code>true</code>, then the <code>timeout</code> parameter
is
  -     * ignored.  If <code>false</code>, then the <code>timeout</code>
  -     * parameter is used to control uploads.
  -     */
  -    private boolean disableUploadTimeout = false;
  -
  -
  -    /**
  -     * Maximum size of a HTTP header. 4KB is the default.
  -     */
  -    private int maxHttpHeaderSize = 4 * 1024;
  -
  -
  -    /**
  -     * Maximum number of Keep-Alive requests to honor per connection.
  -     */
  -    private int maxKeepAliveRequests = 100;
  -
  -
  -    /**
        * Maximum size of a POST which will be automatically parsed by the 
        * container. 2MB by default.
        */
  @@ -290,12 +208,6 @@
   
   
       /**
  -     * Use TCP no delay ?
  -     */
  -    private boolean tcpNoDelay = true;
  -
  -
  -    /**
        * Coyote Protocol handler class name.
        * Defaults to the Coyote HTTP/1.1 protocolHandler.
        */
  @@ -346,23 +258,43 @@
        * Return a configured property.
        */
       public Object getProperty(String name) {
  -        return properties.get(name);
  +        return IntrospectionUtils.getProperty(protocolHandler, name);
  +    }
  +
  +    
  +    /**
  +     * Set a configured property.
  +     */
  +    public void setProperty(String name, String value) {
  +        IntrospectionUtils.setProperty(protocolHandler, name, value);
       }
   
  +    
  +    /**
  +     * Return a configured property.
  +     */
  +    public Object getAttribute(String name) {
  +        return getProperty(name);
  +    }
  +
  +    
       /**
        * Set a configured property.
        */
  -    public void setProperty(String name, Object value) {
  -        properties.put(name, value);
  +    public void setAttribute(String name, Object value) {
  +        setProperty(name, String.valueOf(value));
       }
   
  +    
       /** 
        * remove a configured property.
        */
       public void removeProperty(String name) {
  -        properties.remove(name);
  +        // FIXME !
  +        //protocolHandler.removeAttribute(name);
       }
   
  +    
       /**
        * Return the <code>Service</code> with which we are associated (if any).
        */
  @@ -381,169 +313,7 @@
       public void setService(Service service) {
   
           this.service = service;
  -        setProperty("service", service);
  -
  -    }
  -
  -
  -    /**
  -     * Get the value of compression.
  -     */
  -    public String getCompression() {
  -
  -        return (compression);
  -
  -    }
  -
  -
  -    /**
  -     * Set the value of compression.
  -     *
  -     * @param compression The new compression value, which can be "on", "off"
  -     * or "force"
  -     */
  -    public void setCompression(String compression) {
  -
  -        this.compression = compression;
  -        setProperty("compression", compression);
  -
  -    }
  -
  -
  -    /**
  -     * Return the connection linger for this Connector.
  -     */
  -    public int getConnectionLinger() {
  -
  -        return (connectionLinger);
  -
  -    }
  -
  -
  -    /**
  -     * Set the connection linger for this Connector.
  -     *
  -     * @param connectionLinger The new connection linger
  -     */
  -    public void setConnectionLinger(int connectionLinger) {
  -
  -        this.connectionLinger = connectionLinger;
  -        setProperty("soLinger", String.valueOf(connectionLinger));
  -
  -    }
  -
  -
  -    /**
  -     * Return the connection timeout for this Connector.
  -     */
  -    public int getConnectionTimeout() {
  -
  -        return (connectionTimeout);
  -
  -    }
  -
  -
  -    /**
  -     * Set the connection timeout for this Connector.
  -     *
  -     * @param connectionTimeout The new connection timeout
  -     */
  -    public void setConnectionTimeout(int connectionTimeout) {
  -
  -        this.connectionTimeout = connectionTimeout;
  -        setProperty("soTimeout", String.valueOf(connectionTimeout));
  -
  -    }
  -
  -
  -    /**
  -     * Return the connection upload timeout for this Connector.
  -     */
  -    public int getConnectionUploadTimeout() {
  -
  -        return (connectionUploadTimeout);
  -
  -    }
  -
  -
  -    /**
  -     * Set the connection upload timeout for this Connector.
  -     *
  -     * @param connectionUploadTimeout The new connection upload timeout
  -     */
  -    public void setConnectionUploadTimeout(int connectionUploadTimeout) {
  -
  -        this.connectionUploadTimeout = connectionUploadTimeout;
  -        setProperty("timeout", String.valueOf(connectionUploadTimeout));
  -
  -    }
  -
  -
  -    /**
  -     * Return the server socket timeout for this Connector.
  -     */
  -    public int getServerSocketTimeout() {
  -
  -        return (serverSocketTimeout);
  -
  -    }
  -
  -
  -    /**
  -     * Set the server socket timeout for this Connector.
  -     *
  -     * @param serverSocketTimeout The new server socket timeout
  -     */
  -    public void setServerSocketTimeout(int serverSocketTimeout) {
  -
  -        this.serverSocketTimeout = serverSocketTimeout;
  -        setProperty("serverSoTimeout", String.valueOf(serverSocketTimeout));
  -
  -    }
  -
  -
  -    /**
  -     * Return the accept count for this Connector.
  -     */
  -    public int getAcceptCount() {
  -
  -        return (acceptCount);
  -
  -    }
  -
  -
  -    /**
  -     * Set the accept count for this Connector.
  -     *
  -     * @param count The new accept count
  -     */
  -    public void setAcceptCount(int count) {
  -
  -        this.acceptCount = count;
  -        setProperty("backlog", String.valueOf(count));
  -
  -    }
  -
  -
  -    /**
  -     * Return the bind IP address for this Connector.
  -     */
  -    public String getAddress() {
  -
  -        return (this.address);
  -
  -    }
  -
  -
  -    /**
  -     * Set the bind IP address for this Connector.
  -     *
  -     * @param address The bind IP address
  -     */
  -    public void setAddress(String address) {
  -
  -        this.address = address;
  -        setProperty("address", address);
  +        // FIXME: setProperty("service", service);
   
       }
   
  @@ -581,29 +351,6 @@
   
   
       /**
  -     * Return the input buffer size for this Connector.
  -     */
  -    public int getBufferSize() {
  -
  -        return (this.bufferSize);
  -
  -    }
  -
  -
  -    /**
  -     * Set the input buffer size for this Connector.
  -     *
  -     * @param bufferSize The new input buffer size.
  -     */
  -    public void setBufferSize(int bufferSize) {
  -
  -        this.bufferSize = bufferSize;
  -        setProperty("bufferSize", String.valueOf(bufferSize));
  -
  -    }
  -
  -
  -    /**
        * Return the Container used for processing requests received by this
        * Connector.
        */
  @@ -674,73 +421,6 @@
   
   
       /**
  -     * Return the minimum number of processors to start at initialization.
  -     */
  -    public int getMinProcessors() {
  -
  -        return (minProcessors);
  -
  -    }
  -
  -
  -    /**
  -     * Set the minimum number of processors to start at initialization.
  -     *
  -     * @param minProcessors The new minimum processors
  -     */
  -    public void setMinProcessors(int minProcessors) {
  -
  -        this.minProcessors = minProcessors;
  -        setProperty("minProcessors", String.valueOf(minProcessors));
  -
  -    }
  -
  -
  -    /**
  -     * Return the maximum number of processors allowed, or <0 for unlimited.
  -     */
  -    public int getMaxProcessors() {
  -
  -        return (maxProcessors);
  -
  -    }
  -
  -
  -    /**
  -     * Set the maximum number of processors allowed, or <0 for unlimited.
  -     *
  -     * @param maxProcessors The new maximum processors
  -     */
  -    public void setMaxProcessors(int maxProcessors) {
  -
  -        this.maxProcessors = maxProcessors;
  -        setProperty("maxThreads", String.valueOf(maxProcessors));
  -
  -    }
  -
  -    /**
  -     * Return the processor thread priority. 
  -     *
  -     * @return int
  -     */
  -    public int getThreadPriority() {
  -      return threadPriority;
  -    }
  -
  -    
  -    /**
  -     * Sets the processor thread priority.
  -     *
  -     * @param threadPriority The new priority level
  -     */
  -    public void setThreadPriority(int threadPriority) {
  -      this.threadPriority = threadPriority;
  -      setProperty("threadPriority", String.valueOf(threadPriority));
  -    }  
  -      
  -
  -
  -    /**
        * Return the maximum size of a POST which will be automatically
        * parsed by the container.
        */
  @@ -800,7 +480,7 @@
                      (getProtocolHandlerClassName())) {
               return "AJP/1.3";
           }
  -        return null;
  +        return getProtocolHandlerClassName();
   
       }
   
  @@ -812,14 +492,14 @@
        */
       public void setProtocol(String protocol) {
   
  -        if (protocol.equals("HTTP/1.1")) {
  +        if ("HTTP/1.1".equals(protocol)) {
               setProtocolHandlerClassName
                   ("org.apache.coyote.http11.Http11Protocol");
  -        } else if (protocol.equals("AJP/1.3")) {
  +        } else if ("AJP/1.3".equals(protocol)) {
               setProtocolHandlerClassName
                   ("org.apache.jk.server.JkCoyoteHandler");
  -        } else {
  -            setProtocolHandlerClassName(null);
  +        } else if (protocol != null) {
  +            setProtocolHandlerClassName(protocol);
           }
   
       }
  @@ -933,74 +613,7 @@
   
       }
   
  -    /**
  -     * Return the flag that specifies upload time-out behavior.
  -     */
  -    public boolean getDisableUploadTimeout() {
  -        return disableUploadTimeout;
  -    }
  -
  -    /**
  -     * Set the flag to specify upload time-out behavior.
  -     *
  -     * @param isDisabled If <code>true</code>, then the <code>timeout</code>
  -     * parameter is ignored.  If <code>false</code>, then the
  -     * <code>timeout</code> parameter is used to control uploads.
  -     */
  -    public void setDisableUploadTimeout( boolean isDisabled ) {
  -        disableUploadTimeout = isDisabled;
  -        setProperty("disableUploadTimeout", String.valueOf(isDisabled));
  -    }
  -
  -
  -    /**
  -     * 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);
  -        }
  -    }
  -
  -    /**
  -     * Return the maximum HTTP header size.
  -     */
  -    public int getMaxHttpHeaderSize() {
  -        return maxHttpHeaderSize;
  -    }
  -
  -    /**
  -     * Set the maximum HTTP header size.
  -     */
  -    public void setMaxHttpHeaderSize(int size) {
  -        maxHttpHeaderSize = size;
  -        setProperty("maxHttpHeaderSize", String.valueOf(size));
  -    }
  -
  -    /**
  -     * Return the maximum number of Keep-Alive requests to honor 
  -     * per connection.
  -     */
  -    public int getMaxKeepAliveRequests() {
  -        return maxKeepAliveRequests;
  -    }
  -
  -    /**
  -     * Set the maximum number of Keep-Alive requests to honor per connection.
  -     */
  -    public void setMaxKeepAliveRequests(int mkar) {
  -        maxKeepAliveRequests = mkar;
  -        setProperty("maxKeepAliveRequests", String.valueOf(mkar));
  -    }
  -
  -
  +    
       /**
        * Return the scheme that will be assigned to requests received
        * through this connector.  Default value is "http".
  @@ -1050,40 +663,6 @@
   
       }
   
  -    public boolean getTomcatAuthentication() {
  -        return tomcatAuthentication;
  -    }
  -
  -    public void setTomcatAuthentication(boolean tomcatAuthentication) {
  -        this.tomcatAuthentication = tomcatAuthentication;
  -        setProperty("tomcatAuthentication", String.valueOf(tomcatAuthentication));
  -    }
  -    
  -
  -    /**
  -     * Return the TCP no delay flag value.
  -     */
  -    public boolean getTcpNoDelay() {
  -
  -        return (this.tcpNoDelay);
  -
  -    }
  -
  -
  -    /**
  -     * Set the TCP no delay flag which will be set on the socket after
  -     * accepting a connection.
  -     *
  -     * @param tcpNoDelay The new TCP no delay flag
  -     */
  -    public void setTcpNoDelay(boolean tcpNoDelay) {
  -
  -        this.tcpNoDelay = tcpNoDelay;
  -        setProperty("tcpNoDelay", String.valueOf(tcpNoDelay));
  -
  -    }
  -
  -
        /**
         * Return the character encoding to be used for the URI.
         */
  @@ -1241,10 +820,10 @@
                   // we are loaded directly, via API - and no name was given to us
                   StandardEngine cb=(StandardEngine)container;
                   String encodedAddr = null;
  -                if (getAddress() != null) {
  -                    encodedAddr = URLEncoder.encode(getAddress());
  +                if (getProperty("address") != null) {
  +                    encodedAddr = URLEncoder.encode(getProperty("address").toString());
                   }
  -                String addSuffix=(getAddress()==null) ?"": ",address=" + encodedAddr;
  +                String addSuffix=(getProperty("address")==null) ?"": ",address=" + encodedAddr;
                   oname=new ObjectName(cb.getName() + ":type=Connector,port="+
                           getPort() + addSuffix);
                   Registry.getRegistry(null, null)
  @@ -1258,34 +837,11 @@
   
           // Initializa adapter
           adapter = new CoyoteAdapter(this);
  -
  -        // Instantiate protocol handler
  -        try {
  -            Class clazz = Class.forName(protocolHandlerClassName);
  -            protocolHandler = (ProtocolHandler) clazz.newInstance();
  -        } catch (Exception e) {
  -            throw new LifecycleException
  -                (sm.getString
  -                 ("coyoteConnector.protocolHandlerInstantiationFailed", e));
  -        }
           protocolHandler.setAdapter(adapter);
   
           IntrospectionUtils.setProperty(protocolHandler, "jkHome",
                                          System.getProperty("catalina.base"));
   
  -        /* 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();
  -	    String trnName = translateAttributeName(name);
  -            IntrospectionUtils.setProperty(protocolHandler, trnName, value);
  -        }
  -        
  -
           try {
               protocolHandler.init();
           } catch (Exception e) {
  @@ -1321,32 +877,6 @@
               log.error(sm.getString
                         ("coyoteConnector.protocolHandlerResumeFailed"), e);
           }
  -    }
  -
  -
  -    /*
  -     * Translate the attribute name from the legacy Factory names to their
  -     * internal protocol names.
  -     */
  -    private String translateAttributeName(String name) {
  -	if ("clientAuth".equals(name)) {
  -	    return "clientauth";
  -	} else if ("keystoreFile".equals(name)) {
  -	    return "keystore";
  -	} else if ("randomFile".equals(name)) {
  -	    return "randomfile";
  -	} else if ("rootFile".equals(name)) {
  -	    return "rootfile";
  -	} else if ("keystorePass".equals(name)) {
  -	    return "keypass";
  -	} else if ("keystoreType".equals(name)) {
  -	    return "keytype";
  -	} else if ("sslProtocol".equals(name)) {
  -	    return "protocol";
  -	} else if ("sslProtocols".equals(name)) {
  -	    return "protocols";
  -	}
  -	return name;
       }
   
   
  
  
  
  1.3       +0 -14     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/mbeans-descriptors.xml
  
  Index: mbeans-descriptors.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/mbeans-descriptors.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- mbeans-descriptors.xml	14 Jul 2004 06:19:31 -0000	1.2
  +++ mbeans-descriptors.xml	29 Sep 2004 09:55:38 -0000	1.3
  @@ -93,15 +93,6 @@
             description="Maximum size in bytes of a POST which will be handled by the servlet
API provided features"
                    type="int"/>
   
  -    <attribute   name="maxProcessors"
  -          description="The maximum number of processors allowed (deprecated)"
  -                 type="int"/>
  -
  -    <attribute   name="minProcessors"
  -          description="The minimum number of processors to start at
  -                       initialization time (deprecated)"
  -                 type="int"/>
  -
       <attribute   name="maxSpareThreads"
             description="The maximum number of unused request processing threads"
                    type="int"/>
  @@ -112,11 +103,6 @@
   
       <attribute   name="minSpareThreads"
             description="The number of request processing threads that will be created"
  -                 type="int"/>
  -
  -    <attribute   name="minProcessors"
  -          description="The minimum number of processors to start at
  -                       initialization time"
                    type="int"/>
   
       <attribute   name="port"
  
  
  
  1.24      +10 -17    jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Embedded.java
  
  Index: Embedded.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Embedded.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Embedded.java	17 Sep 2004 15:07:27 -0000	1.23
  +++ Embedded.java	29 Sep 2004 09:55:38 -0000	1.24
  @@ -390,29 +390,22 @@
   
           try {
   
  -            Class clazz = 
  -                Class.forName("org.apache.catalina.connector.Connector");
  -            connector = (Connector) clazz.newInstance();
  -
  -            if (address != null) {
  -                IntrospectionUtils.setProperty(connector, "address", 
  -                                               "" + address);
  -            }
  -            IntrospectionUtils.setProperty(connector, "port", "" + port);
  -
               if (protocol.equals("ajp")) {
  -                IntrospectionUtils.setProperty
  -                    (connector, "protocolHandlerClassName",
  -                     "org.apache.jk.server.JkCoyoteHandler");
  +                connector = new Connector("org.apache.jk.server.JkCoyoteHandler");
               } else if (protocol.equals("memory")) {
  -                IntrospectionUtils.setProperty
  -                    (connector, "protocolHandlerClassName",
  -                     "org.apache.coyote.memory.MemoryProtocolHandler");
  +                connector = new Connector("org.apache.coyote.memory.MemoryProtocolHandler");
               } else if (protocol.equals("https")) {
  +                connector = new Connector();
                   connector.setScheme("https");
                   connector.setSecure(true);
                   // FIXME !!!! SET SSL PROPERTIES
               }
  +
  +            if (address != null) {
  +                IntrospectionUtils.setProperty(connector, "address", 
  +                                               "" + address);
  +            }
  +            IntrospectionUtils.setProperty(connector, "port", "" + port);
   
           } catch (Exception e) {
               log.error("Couldn't create connector.");
  
  
  
  1.34      +3 -4      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Catalina.java
  
  Index: Catalina.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Catalina.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- Catalina.java	16 Sep 2004 23:19:54 -0000	1.33
  +++ Catalina.java	29 Sep 2004 09:55:39 -0000	1.34
  @@ -302,9 +302,8 @@
                               "addLifecycleListener",
                               "org.apache.catalina.LifecycleListener");
   
  -        digester.addObjectCreate("Server/Service/Connector",
  -                                 "org.apache.catalina.connector.Connector",
  -                                 "className");
  +        digester.addRule("Server/Service/Connector",
  +                         new ConnectorCreateRule());
           digester.addRule("Server/Service/Connector", 
                            new SetAllPropertiesRule());
           digester.addSetNext("Server/Service/Connector",
  
  
  
  1.1                  jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ConnectorCreateRule.java
  
  Index: ConnectorCreateRule.java
  ===================================================================
  /* $Id: ConnectorCreateRule.java,v 1.1 2004/09/29 09:55:38 remm Exp $
   *
   * Copyright 2001-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */ 
  
  
  package org.apache.catalina.startup;
  
  
  import org.apache.catalina.connector.Connector;
  import org.apache.tomcat.util.digester.Rule;
  import org.xml.sax.Attributes;
  
  
  /**
   * Rule implementation that creates a connector.
   */
  
  public class ConnectorCreateRule extends Rule {
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Process the beginning of this element.
       *
       * @param attributes The attribute list of this element
       */
      public void begin(Attributes attributes) throws Exception {
          digester.push(new Connector(attributes.getValue("protocol")));
      }
  
  
      /**
       * Process the end of this element.
       */
      public void end() throws Exception {
          Object top = digester.pop();
      }
  
  
  }
  
  
  

---------------------------------------------------------------------
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