tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@locus.apache.org
Subject cvs commit: jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup Catalina.java
Date Sun, 02 Jul 2000 18:07:06 GMT
remm        00/07/02 11:07:05

  Modified:    proposals/catalina build.xml
               proposals/catalina/src/conf server.xml
               proposals/catalina/src/share/org/apache/tomcat/connector/http
                        HttpConnector.java HttpResponseStream.java
                        LocalStrings.properties
               proposals/catalina/src/share/org/apache/tomcat/startup
                        Catalina.java
  Log:
  - The HTTP connector now uses Tomcat 3.x server socket
    factories, including SSLSocketFactory, so that SSL is now supported
    under Catalina.
    I tested SSL functionality with IE 5.01, and it works fine :-)
  
  Revision  Changes    Path
  1.21      +5 -0      jakarta-tomcat/proposals/catalina/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/build.xml,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- build.xml	2000/06/12 20:18:37	1.20
  +++ build.xml	2000/07/02 18:06:48	1.21
  @@ -77,6 +77,11 @@
       <copydir src="${tomcat.build}/classes/org/apache/tomcat/util/xml"
               dest="${catalina.build}/classes/org/apache/tomcat/util/xml"/>
   
  +    <!-- Catalina has a dependency on org.apache.tomcat.net -->
  +    <mkdir   dir="${catalina.build}/classes/org/apache/tomcat/net"/>
  +    <copydir src="${tomcat.build}/classes/org/apache/tomcat/net"
  +            dest="${catalina.build}/classes/org/apache/tomcat/net"/>
  +
       <!-- Copy the Tomcat standard web applications -->
       <mkdir   dir="${catalina.build}/webapps"/>
       <copydir src="${tomcat.build}/webapps"
  
  
  
  1.36      +27 -4     jakarta-tomcat/proposals/catalina/src/conf/server.xml
  
  Index: server.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/conf/server.xml,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- server.xml	2000/06/22 00:19:01	1.35
  +++ server.xml	2000/07/02 18:06:51	1.36
  @@ -8,13 +8,36 @@
   
     <Connector className="org.apache.tomcat.connector.http.HttpConnector"
                port="8080" minProcessors="5" maxProcessors="75"
  -	     acceptCount="10" debug="0"/>
  +             acceptCount="10" debug="0"/>
   
  -<!--
  +  <!--
  +            Uncomment this for SSL support. 
  +            You _need_ to set up a server certificate if you want this
  +            to work, and you need JSSE.
  +            1. Add JSSE jars to CLASSPATH 
  +            2. Edit java.home/jre/lib/security/java.security
  +               Add:
  +               security.provider.2=com.sun.net.ssl.internal.ssl.Provider
  +            3. Do: keytool -genkey -alias tomcat -keyalg RSA
  +               RSA is essential to work with Netscape and IIS.
  +               Use "changeit" as password. ( or add keypass attribute )
  +               You don't need to sign the certificate.
  +  
  +            You can set parameter keystore and keypass if you want 
  +            to change the default ( user.home/.keystore with changeit )
  +  -->
  +  <!--
  +  <Connector className="org.apache.tomcat.connector.http.HttpConnector"
  +             port="443" minProcessors="5" maxProcessors="75"
  +	     acceptCount="10" debug="99" 
  +             socketFactory="org.apache.tomcat.net.SSLSocketFactory" />
  +  -->
  +
  +  <!--
     <Connector className="org.apache.tomcat.connector.test.HttpConnector"
                port="8080" minProcessors="5" maxProcessors="75"
  -	     acceptCount="10" debug="0"/>
  --->
  +             acceptCount="10" debug="0"/>
  +  -->
   
   
     <!-- Define the top level container in our container hierarchy -->
  
  
  
  1.8       +87 -9     jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpConnector.java
  
  Index: HttpConnector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpConnector.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- HttpConnector.java	2000/05/22 04:57:23	1.7
  +++ HttpConnector.java	2000/07/02 18:07:00	1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpConnector.java,v
1.7 2000/05/22 04:57:23 remm Exp $
  - * $Revision: 1.7 $
  - * $Date: 2000/05/22 04:57:23 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpConnector.java,v
1.8 2000/07/02 18:07:00 remm Exp $
  + * $Revision: 1.8 $
  + * $Date: 2000/07/02 18:07:00 $
    *
    * ====================================================================
    *
  @@ -71,6 +71,8 @@
   import java.net.Socket;
   import java.util.Stack;
   import java.util.Vector;
  +import java.util.Hashtable;
  +import java.util.Enumeration;
   import org.apache.tomcat.Connector;
   import org.apache.tomcat.Container;
   import org.apache.tomcat.HttpRequest;
  @@ -84,14 +86,15 @@
   import org.apache.tomcat.Response;
   import org.apache.tomcat.util.LifecycleSupport;
   import org.apache.tomcat.util.StringManager;
  +import org.apache.tomcat.net.ServerSocketFactory;
   
   
   /**
  - * Simple implementation of an HTTP/1.0 Connector, for testing and debugging
  - * purposes.  Not intended to be the final solution.
  + * Implementation of an HTTP/1.1 connector.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.7 $ $Date: 2000/05/22 04:57:23 $
  + * @author Remy Maucherat
  + * @version $Revision: 1.8 $ $Date: 2000/07/02 18:07:00 $
    */
   
   
  @@ -103,6 +106,18 @@
   
   
       /**
  +     * Server socket factory class name.
  +     */
  +    private String socketFactoryClassName;
  +
  +
  +    /**
  +     * Server socket factory parameter.
  +     */
  +    private Hashtable parameters = new Hashtable();
  +
  +
  +    /**
        * The accept count for this Connector.
        */
       private int acceptCount = 10;
  @@ -230,6 +245,16 @@
   
   
       /**
  +     * Set the server socket factory class name.
  +     */
  +    public void setSocketFactory(String className) {
  +        
  +        socketFactoryClassName = className;
  +        
  +    }
  +
  +
  +    /**
        * Return the accept count for this Connector.
        */
       public int getAcceptCount() {
  @@ -437,6 +462,19 @@
       }
   
   
  +    /**
  +     * Set a server factory parameter.
  +     * 
  +     * @param name Name of the parameter
  +     * @param value Value of the parameter
  +     */
  +    public void setParameter(String name, String value) {
  +        
  +        parameters.put(name, value);
  +        
  +    }
  +
  +
       // --------------------------------------------------------- Public Methods
   
   
  @@ -569,10 +607,39 @@
        */
       private ServerSocket open() throws IOException {
   
  +        // First, load the server socket factory
  +        Class socketFactoryClass = null;
  +        ServerSocketFactory socketFactory = null;
  +
  +        if (socketFactoryClassName == null) {
  +            socketFactory = ServerSocketFactory.getDefault();
  +        } else {
  +            try {
  +                socketFactoryClass = Class.forName(socketFactoryClassName);
  +                socketFactory = 
  +                    (ServerSocketFactory) socketFactoryClass.newInstance();
  +                // Set the factory attributes
  +                Enumeration parametersNames = parameters.keys();
  +                while (parametersNames.hasMoreElements()) {
  +                    String key = (String) parametersNames.nextElement();
  +                    Object value = parameters.get(key);
  +                    socketFactory.setAttribute(key, value);
  +                }
  +            } catch (Exception e) {
  +                log(sm.getString("httpConnector.failedSocketFactoryLoading"));
  +                return new ServerSocket(port, acceptCount);
  +            }
  +        }
  +
   	// If no address is specified, open a connection on all addresses
           if (address == null) {
   	    log(sm.getString("httpConnector.allAddresses"));
  -	    return new ServerSocket(port, acceptCount);
  +            try {
  +                return socketFactory.createSocket(port, acceptCount);
  +            } catch(InstantiationException e) {
  +                log(sm.getString("httpConnector.failedToCreateSocket"));
  +                return new ServerSocket(port, acceptCount);
  +            }
   	}
   
   	// Open a server socket on the specified address
  @@ -584,10 +651,21 @@
   	}
   	if (i < addresses.length) {
   	    log(sm.getString("httpConnector.anAddress", address));
  -	    return new ServerSocket(port, acceptCount, addresses[i]);
  +            try {
  +                return socketFactory.createSocket(port, acceptCount, 
  +                                                  addresses[i]);
  +            } catch(InstantiationException e) {
  +                log(sm.getString("httpConnector.failedToCreateSocket"));
  +                return new ServerSocket(port, acceptCount, addresses[i]);
  +            }
   	} else {
   	    log(sm.getString("httpConnector.noAddress", address));
  -	    return new ServerSocket(port, acceptCount);
  +            try {
  +                return socketFactory.createSocket(port, acceptCount);
  +            } catch (InstantiationException e) {
  +                log(sm.getString("httpConnector.failedToCreateSocket"));
  +                return new ServerSocket(port, acceptCount);
  +            }
   	}
   
       }
  
  
  
  1.4       +4 -4      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpResponseStream.java
  
  Index: HttpResponseStream.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpResponseStream.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HttpResponseStream.java	2000/06/04 23:18:47	1.3
  +++ HttpResponseStream.java	2000/07/02 18:07:02	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpResponseStream.java,v
1.3 2000/06/04 23:18:47 remm Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/06/04 23:18:47 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpResponseStream.java,v
1.4 2000/07/02 18:07:02 remm Exp $
  + * $Revision: 1.4 $
  + * $Date: 2000/07/02 18:07:02 $
    *
    * ====================================================================
    * 
  @@ -154,7 +154,7 @@
           throws IOException {
           if (useChunking && !writingChunk) {
               writingChunk = true;
  -            print(Integer.toHexString(len) + CRLF);
  +            println(Integer.toHexString(len));
               super.write(b, off, len);
               println();
               writingChunk = false;
  
  
  
  1.7       +2 -0      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/LocalStrings.properties,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- LocalStrings.properties	2000/06/04 23:18:47	1.6
  +++ LocalStrings.properties	2000/07/02 18:07:03	1.7
  @@ -1,5 +1,7 @@
   httpConnector.alreadyStarted=HTTP connector has already been started
   httpConnector.allAddresses=Opening server socket on all host IP addresses
  +httpConnector.failedSocketFactoryLoading=Failed to load socket factory
  +httpConnector.failedToCreateSocket=Socket factory failed to create socket
   httpConnector.anAddress=Opening server socket on host IP address {0}
   httpConnector.noAddress=No host IP address matching {0}, opening on all addresses
   httpConnector.noProcessor=No processor available, rejecting this connection
  
  
  
  1.11      +11 -4     jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/Catalina.java
  
  Index: Catalina.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/Catalina.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Catalina.java	2000/05/20 22:13:33	1.10
  +++ Catalina.java	2000/07/02 18:07:03	1.11
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/Catalina.java,v
1.10 2000/05/20 22:13:33 craigmcc Exp $
  - * $Revision: 1.10 $
  - * $Date: 2000/05/20 22:13:33 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/Catalina.java,v
1.11 2000/07/02 18:07:03 remm Exp $
  + * $Revision: 1.11 $
  + * $Date: 2000/07/02 18:07:03 $
    *
    * ====================================================================
    *
  @@ -94,7 +94,7 @@
    * </u>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.10 $ $Date: 2000/05/20 22:13:33 $
  + * @version $Revision: 1.11 $ $Date: 2000/07/02 18:07:03 $
    */
   
   public final class Catalina {
  @@ -248,6 +248,13 @@
   	mapper.addRule("Server/Connector", mapper.addChild
   		       ("addConnector", "org.apache.tomcat.Connector"));
   
  +	mapper.addRule("Server/Connector/Parameter",
  +                       mapper.methodSetter("setParameter", 2));
  +	mapper.addRule("Server/Connector/Parameter", 
  +                       mapper.methodParam(0, "name"));
  +	mapper.addRule("Server/Connector/Parameter",
  +                       mapper.methodParam(1, "value") );
  +        
   	mapper.addRule("Server/Connector/Listener", mapper.objectCreate
   		       (null, "className"));
   	mapper.addRule("Server/Connector/Listener", mapper.setProperties());
  
  
  

Mime
View raw message