You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@locus.apache.org on 2000/05/02 01:13:44 UTC

cvs commit: jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session StandardManager.java

craigmcc    00/05/01 16:13:44

  Modified:    proposals/catalina build.xml
               proposals/catalina/src/conf server.xml
               proposals/catalina/src/share/org/apache/tomcat/connector/test
                        HttpProcessor.java LocalStrings.properties
               proposals/catalina/src/share/org/apache/tomcat/core
                        ContainerBase.java StandardEngine.java
                        StandardHost.java
               proposals/catalina/src/share/org/apache/tomcat/session
                        StandardManager.java
  Added:       proposals/catalina README
  Log:
  Add a README file describing how to build and test Catalina.
  
  Add the ability to optionally copy the Watchdog test applications into
  the Catalina build directory so they can be run against Catalina.
  
  Fix miscellaneous bugs in the connector and container classes that caused
  the Watchdog servlet tests to hang part way through.  There are still some
  race conditions in the connector code, but that's not a high priority IMHO
  because this is a placeholder for a real HTTP/1.1 connector anyway.
  
  At present, Catalina completes the Watchdog servlet tests with only 9
  fails out of 208 tests.  Not bad for brand new code the very first time
  that the test suite runs all the way through :-).
  
  NOTE:  JSP has not been tested at all at this point.  There are likely to
  be problems if there are any dependencies on Tomcat 3.1 internals within
  the org.apache.jasper.* hierarchy.
  
  Revision  Changes    Path
  1.10      +12 -6     jakarta-tomcat/proposals/catalina/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/build.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- build.xml	2000/04/29 05:59:51	1.9
  +++ build.xml	2000/05/01 23:13:41	1.10
  @@ -7,6 +7,7 @@
     <property name="catalina.home"  value="../../../dist/catalina"/>
     <property name="servlet.jar"    value="../../../jakarta-servletapi/lib/servlet.jar"/>
     <property name="tomcat.build"   value="../../../build/tomcat"/>
  +  <property name="watchdog.build" value="../../../build/watchdog"/>
   
     <!-- Create directories -->
     <target name="prepare">
  @@ -40,13 +41,18 @@
        excludes="**/CVS/**"/>
     </target>
   
  -  <!-- Clean and recopy the web applications from Tomcat -->
  -  <target name="webapps">
  -    <deltree dir="${catalina.build}/webapps"/>
  -    <mkdir   dir="${catalina.build}/webapps"/>
  -    <copydir src="${tomcat.build}/webapps" dest="${catalina.build}/webapps"/>
  +  <!-- Copy the web applications from Tomcat -->
  +  <target name="tomcat">
  +    <copydir src="${tomcat.build}/webapps"
  +            dest="${catalina.build}/webapps"/>
     </target>
   
  +  <!-- Copy the web applications from Watchdog -->
  +  <target name="watchdog">
  +    <copydir src="${watchdog.build}/webapps"
  +            dest="${catalina.build}/webapps"/>
  +  </target>
  +
     <!-- Compile the distribution directory -->
     <target name="dist" depends="main">
       <mkdir dir="${catalina.home}"/>
  @@ -64,6 +70,6 @@
     </target>
   
     <!-- Clean up and compile everything -->
  -  <target name="all" depends="clean,dist.clean,main,webapps,dist"/>
  +  <target name="all" depends="clean,dist.clean,main,tomcat,dist"/>
   
   </project>
  
  
  
  1.1                  jakarta-tomcat/proposals/catalina/README
  
  Index: README
  ===================================================================
  			Catalina Servlet Container
  			==========================
  
  
  This subdirectory contains code for the Catalina container that will (when
  complete) be proposed as a replacement for the org.apache.tomcat.core classes
  (and their related classes) in Tomcat 3.x.
  
  
  Installing and Building Catalina
  ================================
  
  In order to successfully build Catalina, you will need to do the following.  In
  the instructions below, $JAKARTA_HOME is assumed to be the directory into which
  you are installing all of the required distributions.
  
  * Download and install a version 1.1 or later Java Development Kit
    implementation for your operating system platform.  Set a "JAVA_HOME"
    environment variable to point at the directory where your JDK is installed,
    and add "$JAVA_HOME/bin" to your PATH.  Configure the CLASSPATH environment
    variable as well, if required.
  
  * Download and install the Java API for XML Parsing implementation (current
    version number is 1.0) from <http://java.sun.com/xml>.  Make sure that the
    "jaxp.jar" and "parser.jar" files are on your class path.  (NOTE:  In the
    future it will be possible to use any JAXP-compliant parser).
  
  * Download and install the Ant distribution (subproject "jakarta-ant") into
    a directory named "$JAKARTA_HOME/jakarta-ant".  If you have downloaded the
    source distribution, you will need to build the executable version by
    executing the following commands:
  
  	cd $JAKARTA_HOME/jakarta-ant
  	./bootstrap.sh		<-- Unix
  	bootstrap		<-- Windows
  
    This should result in the creation of a file "ant.jar" in the "lib"
    subdirectory, which will be used when building Watchdog.
  
  * Download and install the Servletapi distribution (subproject
    "jakarta-servletapi") into a subdirectory named
    "$JAKARTA_HOME/jakarta-servletapi".  If you have downloaded the source
    distribution, you will need to build the executable version by
    executing the following commands:
  
  	cd $JAKARTA_HOME/jakarta-servletapi
  	./build.sh dist		<-- Unix
  	build dist		<-- Windows
  
    This should result in the creation of a file "servlet.jar" in the "lib"
    subdirectory, which will be used when building Watchdog.
  
  * Download the source distribution of Tomcat (subpackage "jakarta-tomcat"),
    or check it out via anonymous CVS, into a subdirectory named
    "$JAKARTA_HOME/jakarta-tomcat".  You will need to build the "unpacked"
    version of Tomcat to make shared classes available to Catalina:
  
  	cd $JAKARTA_HOME/jakarta-tomcat
  	./build.sh		<-- Unix
  	build			<-- Windows
  
  * Download the source distribution of Watchdog (subpackage "jakarta-watchdog"),
    or check it out via anonymous CVS, into a directory named
    "$JAKARTA_HOME/jakarta-watchdog".  You will need to build the "unpacked"
    version of Watchdog to make the test classes available to Catalina.
  
  	cd $JAKARTA_HOME/jakarta-watchdog
  	./build.sh		<-- Unix
  	build			<-- Windows
  
  * Now you can build the "unpacked" version of Catalina as follows:
  
  	cd $JAKARTA_HOME/jakarta-tomcat/proposals/catalina
  	./build.sh all		<-- Unix
  	build all		<-- Windows
  
  
  Running the Build
  =================
  
  You can start and stop the unpacked version of Catalina as follows:
  
  * If you are planning to run the Watchdog test suite against Catalina,
    you must install the corresponding web applications prior to startup:
  
  	cd $JAKARTA_HOME/jakarta-tomcat/proposals/catalina
  	./build.sh watchdog	<-- Unix
  	build watchdog		<-- Windows
  
  * To execute the "unpacked" version of Catalina:
  
  	cd $JAKARTA_HOME/build/catalina
  	./bin/catalina.sh start	<-- Unix
  	bin\catalina start	<-- Windows
  
  * To access the default context and examples (copied from Tomcat), access the
    following URL with your browser:
  
  	http://localhost:8080
  
  * To run the Watchdog tests against Catalina:
  
  	cd $JAKARTA_HOME/build/watchdog/bin
  	./watchdog.sh servlet	<-- Unix
  	watchdog servlet	<-- Windows
  
    (JSP integration has not yet been tested)
  
  * To shut down the "unpacked" version of Catalina:
  
  	cd $JAKARTA_HOME/build/catalina
  	./bin/catalina.sh stop	<-- Unix
  	bin\catalina stop	<-- Windows
  
  At present, there is no "distribution" build of Catalina, because it is not
  yet ready to be tested by casual users.
  
  
  Reporting Bugs
  ==============
  
  If you encounter any bugs in Catalina, or wish to contribute a patch, or
  wish to suggest any functionality improvements, please report them to our
  bug tracking system, at:
  
  	http://jakarta.apache.org/bugs
  
  against product "Tomcat" and component "Catalina".
  
  
  
  Before Committing Changes
  =========================
  
  Before committing any changes to the Tomcat CVS repository, you MUST do a
  "build clean" followed by a "build dist" to ensure that the build process runs
  cleanly, and you must ensure that the tests run correctly.
  
  
  
  
  
  1.13      +21 -3     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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- server.xml	2000/04/30 01:23:19	1.12
  +++ server.xml	2000/05/01 23:13:41	1.13
  @@ -8,7 +8,7 @@
   
     <Connector className="org.apache.tomcat.connector.test.HttpConnector"
                port="8080" acceptCount="10"
  -	     minProcessors="2" maxProcessors="20"/>
  +	     minProcessors="20" maxProcessors="60"/>
   
     <!-- Define the top level container in our container hierarchy -->
   
  @@ -38,7 +38,7 @@
                 directory="logs" prefix="localhost_log." suffix=".txt"
                 timestamp="true"/>
   
  -      <!-- Root Context -->
  +      <!-- Tomcat Root Context -->
         <Context path="" docBase="webapps/ROOT" debug="0">
           <Listener className="org.apache.tomcat.startup.ContextConfig"
   	          debug="0"/>
  @@ -47,13 +47,31 @@
   		 pathname="sessions/localhost_ROOT.sessions"/>
         </Context>
   
  -      <!-- Examples Context -->
  +      <!-- Tomcat Examples Context -->
         <Context path="/examples" docBase="webapps/examples" debug="0">
           <Listener className="org.apache.tomcat.startup.ContextConfig"
   	          debug="0"/>
           <Manager className="org.apache.tomcat.session.StandardManager"
   	         checkInterval="15" maxActiveSessions="100"
                    pathname="sessions/localhost_examples.sessions"/>
  +      </Context>
  +
  +      <!-- Watchdog JSP Tests Context -->
  +      <Context path="/jsp-tests" docBase="webapps/jsp-tests" debug="0">
  +        <Listener className="org.apache.tomcat.startup.ContextConfig"
  +	          debug="0"/>
  +        <Logger className="org.apache.tomcat.logger.FileLogger"
  +                directory="logs" prefix="localhost_jsp-tests_log."
  +                suffix=".txt" timestamp="true"/>
  +      </Context>
  +
  +      <!-- Watchdog Servlet Tests Context -->
  +      <Context path="/servlet-tests" docBase="webapps/servlet-tests" debug="0">
  +        <Listener className="org.apache.tomcat.startup.ContextConfig"
  +	          debug="0"/>
  +        <Logger className="org.apache.tomcat.logger.FileLogger"
  +                directory="logs" prefix="localhost_servlet-tests_log."
  +                suffix=".txt" timestamp="true"/>
         </Context>
   
       </Host>
  
  
  
  1.5       +7 -4      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpProcessor.java
  
  Index: HttpProcessor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpProcessor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- HttpProcessor.java	2000/04/30 21:32:07	1.4
  +++ HttpProcessor.java	2000/05/01 23:13:42	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpProcessor.java,v 1.4 2000/04/30 21:32:07 craigmcc Exp $
  - * $Revision: 1.4 $
  - * $Date: 2000/04/30 21:32:07 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpProcessor.java,v 1.5 2000/05/01 23:13:42 craigmcc Exp $
  + * $Revision: 1.5 $
  + * $Date: 2000/05/01 23:13:42 $
    *
    * ====================================================================
    *
  @@ -98,7 +98,7 @@
    * the request.  When the processor is completed, it will recycle itself.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.4 $ $Date: 2000/04/30 21:32:07 $
  + * @version $Revision: 1.5 $ $Date: 2000/05/01 23:13:42 $
    */
   
   final class HttpProcessor
  @@ -377,6 +377,9 @@
   
   	// Parse the incoming request line
   	String line = read();
  +	if (line == null)
  +	    throw new ServletException
  +		(sm.getString("httpProcessor.parseRequest.read"));
   	StringTokenizer st = new StringTokenizer(line);
   
   	String method = null;
  
  
  
  1.3       +1 -0      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/LocalStrings.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LocalStrings.properties	2000/04/27 05:55:14	1.2
  +++ LocalStrings.properties	2000/05/01 23:13:42	1.3
  @@ -6,6 +6,7 @@
   httpProcessor.parseHeaders.colon=Invalid HTTP header format
   httpProcessor.parseHeaders.portNumber=Invalid TCP/IP port number in 'Host' header
   httpProcessor.parseRequest.method=Missing HTTP request method
  +httpProcessor.parseRequest.read=Missing HTTP request line
   httpProcessor.parseRequest.uri=Missing HTTP request URI
   httpProcessor.start=HTTP processor has already been started
   httpProcessor.stop=HTTP processor has already been stopped
  
  
  
  1.16      +6 -4      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ContainerBase.java
  
  Index: ContainerBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ContainerBase.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ContainerBase.java	2000/04/29 23:20:32	1.15
  +++ ContainerBase.java	2000/05/01 23:13:42	1.16
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ContainerBase.java,v 1.15 2000/04/29 23:20:32 craigmcc Exp $
  - * $Revision: 1.15 $
  - * $Date: 2000/04/29 23:20:32 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ContainerBase.java,v 1.16 2000/05/01 23:13:42 craigmcc Exp $
  + * $Revision: 1.16 $
  + * $Date: 2000/05/01 23:13:42 $
    *
    * ====================================================================
    *
  @@ -149,7 +149,7 @@
    * class comments of the implementation class.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.15 $ $Date: 2000/04/29 23:20:32 $
  + * @version $Revision: 1.16 $ $Date: 2000/05/01 23:13:42 $
    */
   
   public abstract class ContainerBase
  @@ -799,6 +799,8 @@
        */
       public Container findChild(String name) {
   
  +	if (name == null)
  +	    return (null);
   	return ((Container) children.get(name));
   
       }
  
  
  
  1.7       +8 -5      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardEngine.java
  
  Index: StandardEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardEngine.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StandardEngine.java	2000/04/29 05:59:54	1.6
  +++ StandardEngine.java	2000/05/01 23:13:43	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardEngine.java,v 1.6 2000/04/29 05:59:54 craigmcc Exp $
  - * $Revision: 1.6 $
  - * $Date: 2000/04/29 05:59:54 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardEngine.java,v 1.7 2000/05/01 23:13:43 craigmcc Exp $
  + * $Revision: 1.7 $
  + * $Date: 2000/05/01 23:13:43 $
    *
    * ====================================================================
    *
  @@ -67,6 +67,7 @@
   
   import java.io.IOException;
   import javax.servlet.ServletException;
  +import javax.servlet.ServletRequest;
   import javax.servlet.http.HttpServletResponse;
   import org.apache.tomcat.Container;
   import org.apache.tomcat.Engine;
  @@ -81,7 +82,7 @@
    * fully qualified host name of that virtual host.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.6 $ $Date: 2000/04/29 05:59:54 $
  + * @version $Revision: 1.7 $ $Date: 2000/05/01 23:13:43 $
    */
   
   public final class StandardEngine
  @@ -190,9 +191,11 @@
       public Host map(Request request, boolean update) {
   
   	// Extract the requested server name
  -	String server = request.getRequest().getServerName().toLowerCase();
  +	String server = request.getRequest().getServerName();
   	if (server == null)
   	    server = defaultHost;
  +	else
  +	    server = server.toLowerCase();
   	if (server == null)
   	    return (null);
   	if (debug > 0)
  
  
  
  1.9       +6 -4      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardHost.java
  
  Index: StandardHost.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardHost.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StandardHost.java	2000/04/29 05:59:54	1.8
  +++ StandardHost.java	2000/05/01 23:13:43	1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardHost.java,v 1.8 2000/04/29 05:59:54 craigmcc Exp $
  - * $Revision: 1.8 $
  - * $Date: 2000/04/29 05:59:54 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardHost.java,v 1.9 2000/05/01 23:13:43 craigmcc Exp $
  + * $Revision: 1.9 $
  + * $Date: 2000/05/01 23:13:43 $
    *
    * ====================================================================
    *
  @@ -84,7 +84,7 @@
    * requests directed to a particular web application.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.8 $ $Date: 2000/04/29 05:59:54 $
  + * @version $Revision: 1.9 $ $Date: 2000/05/01 23:13:43 $
    */
   
   public final class StandardHost
  @@ -328,6 +328,8 @@
   
   	if (debug > 0)
   	    log("Mapping request URI '" + uri + "'");
  +	if (uri == null)
  +	    return (null);
   
   	// Match on the longest possible context path prefix
   	if (debug > 1)
  
  
  
  1.10      +5 -5      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/StandardManager.java
  
  Index: StandardManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/StandardManager.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- StandardManager.java	2000/04/29 18:24:28	1.9
  +++ StandardManager.java	2000/05/01 23:13:43	1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/StandardManager.java,v 1.9 2000/04/29 18:24:28 craigmcc Exp $
  - * $Revision: 1.9 $
  - * $Date: 2000/04/29 18:24:28 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/StandardManager.java,v 1.10 2000/05/01 23:13:43 craigmcc Exp $
  + * $Revision: 1.10 $
  + * $Date: 2000/05/01 23:13:43 $
    *
    * ====================================================================
    *
  @@ -104,7 +104,7 @@
    * <code>stop()</code> methods of this class at the correct times.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.9 $ $Date: 2000/04/29 18:24:28 $
  + * @version $Revision: 1.10 $ $Date: 2000/05/01 23:13:43 $
    */
   
   public final class StandardManager
  @@ -458,7 +458,7 @@
   	if (event.getPropertyName().equals("sessionTimeout")) {
   	    try {
   		setMaxInactiveInterval
  -		    (Integer.parseInt((String) event.getNewValue()));
  +		    ( ((Integer) event.getNewValue()).intValue() );
   	    } catch (NumberFormatException e) {
   		log(sm.getString("standardManager.sessionTimeout",
   				 event.getNewValue().toString()));