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/07/15 05:15:43 UTC
cvs commit: jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup Bootstrap.java Catalina.java
craigmcc 00/07/14 20:15:43
Modified: proposals/catalina build.xml
proposals/catalina/src/bin catalina.bat catalina.sh
cpappend.bat
proposals/catalina/src/share/org/apache/tomcat/loader
FileClassLoader.java
proposals/catalina/src/share/org/apache/tomcat/session
StandardManager.java
proposals/catalina/src/share/org/apache/tomcat/startup
Catalina.java
Added: proposals/catalina/src/share/org/apache/tomcat/startup
Bootstrap.java
Log:
Rearrange the runtime environment of Catalina to enhance security. Now,
there is a bootstrap loader (in $CATALINA_HOME/bin/bootstrap.jar) that
creates a special class loader with only internal server classes, and uses
it to load the remainder of Catalina. The key side effect of this is that
Catalina internal classes, and the libraries they depend on (such as the
XML parser used to read web.xml) are no longer visible on the system class
path.
The runtime organization of $CATALINA_HOME is now:
bin/ Startup scripts and the bootstrap.jar file
classes/ Unpacked compiled classes (build target only)
conf/ Configuration files
lib/ "Shared extension" libraries placed on the
system classpath for access by all applications
logs/ Log files
server/ Internal libraries that comprise Catalina and
the libraries it depends on (not visible on the
system class path
webapps/ Web applications home
work/ Work directories home
An application can access classes from the following locations (in order):
* The WEB-INF/classes directory for that application
* JAR files in the WEB-INF/lib directory for that application
* JAR files in the $CATALINA_HOME/lib directory
NOTE: Any classpath specified in the shell environment is ignored.
Anomalies and things that need attention:
* Had to disable session persistence across server restarts. Need to
do this in a manner that does not require the actual session
implementation class (org.apache.tomcat.session.StandardSession)
to be serialized, because it is no longer visible.
* The "servlet.jar" file is in the lib/ directory, and is thus
potentially overrideable by classes in the WAR. This is prevented
by configuring the application class loader to always go to the
parent (system) class loader to load "javax.servlet.*" classes.
* The "jasper.jar" file is in the lib/ directory, and is thus
potentially overrideable by classes in the WAR. This needs to be
prevented in the same manner as "servlet.jar" above.
* Catalina has no current support for a security manager or the other
Java2 security features yet. This support needs to be integrated,
so that web applications can be installed to run under a configurable
security policy.
* It is time to write a "security policy" document describing what we
think Catalina does to prevent malicious application code from causing
problems, so that the policies can be validated and tested.
Revision Changes Path
1.24 +61 -34 jakarta-tomcat/proposals/catalina/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/build.xml,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- build.xml 2000/07/11 00:46:46 1.23
+++ build.xml 2000/07/15 03:15:29 1.24
@@ -1,6 +1,7 @@
<project name="Catalina" default="main" basedir=".">
- <!-- Initialize property values -->
+
+ <!-- ===================== Initialize Property Values =================== -->
<property name="ant.home" value="../../../jakarta-ant"/>
<property name="build.compiler" value="classic"/>
<property name="catalina.build" value="../../../build/catalina"/>
@@ -9,11 +10,10 @@
<property name="regexp.jar" value="../../../jakarta-regexp/bin/jakarta-regexp-1.1.jar"/>
<property name="servlet.jar" value="../../../jakarta-servletapi/lib/servlet.jar"/>
<property name="tomcat.build" value="../../../build/tomcat"/>
- <property name="upload.dest" value="craigmcc@jakarta.apache.org:/www/jakarta.apache.org/builds/catalina/nightly"/>
- <property name="upload.home" value="../../../upload/catalina"/>
<property name="watchdog.build" value="../../../build/watchdog"/>
+
- <!-- Create directories -->
+ <!-- ===================== Create Directories =========================== -->
<target name="prepare">
<mkdir dir="${catalina.build}"/>
<mkdir dir="${catalina.build}/bin"/>
@@ -21,40 +21,66 @@
<mkdir dir="${catalina.build}/conf"/>
<mkdir dir="${catalina.build}/lib"/>
<mkdir dir="${catalina.build}/logs"/>
- <mkdir dir="${catalina.build}/sessions"/>
+ <mkdir dir="${catalina.build}/server"/>
</target>
- <!-- Copy static files -->
+
+ <!-- ===================== Copy Static Files ============================ -->
<target name="static" depends="prepare">
- <copyfile src="${ant.home}/lib/ant.jar"
- dest="${catalina.build}/lib/ant.jar"/>
- <copyfile src="${jaxp.home}/jaxp.jar"
- dest="${catalina.build}/lib/jaxp.jar"/>
- <copyfile src="${jaxp.home}/parser.jar"
- dest="${catalina.build}/lib/parser.jar"/>
- <copyfile src="${regexp.jar}" dest="${catalina.build}/lib/regexp.jar"/>
- <copyfile src="${servlet.jar}" dest="${catalina.build}/lib/servlet.jar"/>
+
+ <!-- Executable Commands -->
<copydir src="src/bin" dest="${catalina.build}/bin"/>
<fixcrlf srcdir="${catalina.build}/bin" includes="*.sh" cr="remove"/>
<fixcrlf srcdir="${catalina.build}/bin" includes="*.bat" cr="add"/>
<chmod perm="+x" file="${catalina.build}/bin/catalina.sh"/>
<chmod perm="+x" file="${catalina.build}/bin/startup.sh"/>
<chmod perm="+x" file="${catalina.build}/bin/shutdown.sh"/>
+
+ <!-- Configuration Files -->
<copydir src="src/conf" dest="${catalina.build}/conf"/>
+
+ <!-- Shared Extensions -->
+ <copyfile src="${servlet.jar}"
+ dest="${catalina.build}/lib/servlet.jar"/>
+
+ <!-- Server Components -->
+ <copyfile src="${jaxp.home}/jaxp.jar"
+ dest="${catalina.build}/server/jaxp.jar"/>
+ <copyfile src="${jaxp.home}/parser.jar"
+ dest="${catalina.build}/server/parser.jar"/>
+ <copyfile src="${regexp.jar}"
+ dest="${catalina.build}/server/regexp.jar"/>
+
</target>
+
- <!-- Compile the server components -->
+ <!-- ======================== Compile Server Components ================= -->
<target name="main" depends="prepare,static">
+
+ <!-- Compile internal server components -->
<javac srcdir="src/share" destdir="${catalina.build}/classes"
classpath="${regexp.jar}:${servlet.jar}"
deprecation="off" debug="on" optimize="off"
excludes="**/CVS/**"/>
+
+ <!-- Copy static resource files -->
<copydir src="src/share" dest="${catalina.build}/classes">
<include name="**/*.properties"/>
</copydir>
+
+ <!-- Construct bootstrap JAR file -->
+ <jar jarfile="${catalina.build}/bin/bootstrap.jar"
+ basedir="${catalina.build}/classes"
+ includes="org/apache/tomcat/startup/Bootstrap.class,org/apache/tomcat/loader/*"/>
+
+ <!-- Construct Jasper JAR file as a shared extension -->
+ <jar jarfile="${catalina.build}/lib/jasper.jar"
+ basedir="${tomcat.build}/classes"
+ includes="org/apache/jasper/**"/>
+
</target>
- <!-- Copy the JSP compiler and web applications from Tomcat -->
+ <!-- ======================== Copy Tomcat Components ==================== -->
<target name="tomcat">
<!-- Copy the entire Jasper environment -->
@@ -89,7 +115,8 @@
</target>
- <!-- Create Catalina Javadocs in the root application -->
+
+ <!-- =================== Create Catalina Javadocs ======================= -->
<target name="javadoc" depends="tomcat">
<mkdir dir="${catalina.build}/webapps/ROOT/javadoc"/>
<javadoc packagenames="org.apache.tomcat.*"
@@ -105,13 +132,14 @@
</target>
- <!-- Copy the web applications from Watchdog -->
+ <!-- ===================== Copy Watchdog Applications =================== -->
<target name="watchdog">
<copydir src="${watchdog.build}/webapps"
dest="${catalina.build}/webapps"/>
</target>
+
- <!-- Compile the Catalina distribution -->
+ <!-- ==================== Construct Distribution Directory ============== -->
<target name="dist" depends="main,tomcat">
<!-- Create distribution directories -->
@@ -122,18 +150,16 @@
<mkdir dir="${catalina.dist}/etc" />
<mkdir dir="${catalina.dist}/lib" />
<mkdir dir="${catalina.dist}/logs" />
- <mkdir dir="${catalina.dist}/sessions" />
+ <mkdir dir="${catalina.dist}/server" />
<mkdir dir="${catalina.dist}/src" />
<mkdir dir="${catalina.dist}/webapps" />
- <!-- Create or copy the library JAR files -->
- <jar jarfile="${catalina.dist}/lib/webserver.jar"
+ <!-- Create or copy the library and server JAR files -->
+ <jar jarfile="${catalina.dist}/server/webserver.jar"
basedir="${catalina.build}/classes"
includes="org/apache/tomcat/**"/>
- <jar jarfile="${catalina.dist}/lib/jasper.jar"
- basedir="${tomcat.build}/classes"
- includes="org/apache/jasper/**"/>
- <copydir src="${catalina.build}/lib" dest="${catalina.dist}/lib"/>
+ <copydir src="${catalina.build}/lib" dest="${catalina.dist}/lib"/>
+ <copydir src="${catalina.build}/server" dest="${catalina.dist}/server"/>
<!-- Create the web application archives -->
<!-- Skip JAR-ing for now to work around startup problem
@@ -153,11 +179,11 @@
<!-- Copy other relevant files -->
<copydir src="${catalina.build}/bin" dest="${catalina.dist}/bin" />
- <fixcrlf srcdir="${catalina.build}/bin" includes="*.sh" cr="remove"/>
- <fixcrlf srcdir="${catalina.build}/bin" includes="*.bat" cr="add"/>
- <chmod perm="+x" file="${catalina.dist}/bin/catalina.sh"/>
- <chmod perm="+x" file="${catalina.dist}/bin/startup.sh"/>
- <chmod perm="+x" file="${catalina.dist}/bin/shutdown.sh"/>
+ <fixcrlf srcdir="${catalina.dist}/bin" includes="*.sh" cr="remove"/>
+ <fixcrlf srcdir="${catalina.dist}/bin" includes="*.bat" cr="add"/>
+ <chmod perm="+x" file="${catalina.dist}/bin/catalina.sh"/>
+ <chmod perm="+x" file="${catalina.dist}/bin/startup.sh"/>
+ <chmod perm="+x" file="${catalina.dist}/bin/shutdown.sh"/>
<copydir src="${catalina.build}/conf" dest="${catalina.dist}/conf" />
<copydir src="." dest="${catalina.dist}/etc">
<include name="build.*"/>
@@ -170,18 +196,19 @@
</copydir>
</target>
+
- <!-- Clean up the build directory -->
+ <!-- ======================= Clean Build Directory ====================== -->
<target name="clean">
<deltree dir="${catalina.build}"/>
</target>
- <!-- Clean up the distribution directory -->
+ <!-- ==================== Clean Distribution Directory ================== -->
<target name="dist.clean">
<deltree dir="${catalina.dist}"/>
</target>
- <!-- Clean up and compile everything -->
+ <!-- ======================= Rebuild Everything ========================= -->
<target name="all" depends="clean,dist.clean,main,tomcat"/>
</project>
1.13 +21 -16 jakarta-tomcat/proposals/catalina/src/bin/catalina.bat
Index: catalina.bat
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/bin/catalina.bat,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- catalina.bat 2000/06/14 23:54:04 1.12
+++ catalina.bat 2000/07/15 03:15:33 1.13
@@ -6,21 +6,21 @@
rem
rem CATALINA_HOME (Optional) May point at your Catalina "build" directory.
rem If not present, the current working directory is assumed.
+rem
rem CATALINA_OPTS (Optional) Java runtime options used when the "start",
rem "stop", or "run" command is executed.
-rem CLASSPATH Must contain the "jaxp.jar" and "parser.jar" files from
-rem the JAXP Reference Implementation, version 1.0, or these
-rem files must be in your Java2 extensions directory.
+rem
rem JAVA_HOME Must point at your Java Development Kit installation.
rem
-rem $Id: catalina.bat,v 1.12 2000/06/14 23:54:04 craigmcc Exp $
+rem $Id: catalina.bat,v 1.13 2000/07/15 03:15:33 craigmcc Exp $
rem ---------------------------------------------------------------------------
rem ----- Save Environment Variables That May Change --------------------------
+set _BP=%BP%
set _CATALINA_HOME=%CATALINA_HOME%
-set _CP=%CP%
+set _CLASSPATH=%CLASSPATH%
rem ----- Verify and Set Required Environment Variables -----------------------
@@ -35,15 +35,18 @@
:gotCatalinaHome
+rem ----- Set Up The Bootstrap Classpath --------------------------------------
+
+set BP=%CATALINA_HOME%\bin\bootstrap.jar;%JAVA_HOME%\jre\lib\i18n.jar;%JAVA_HOME%\jre\lib\rt.jar;%JAVA_HOME%\lib\tools.jar
+
+echo Using BOOT PATH: %BP%
+
+
rem ----- Set Up The Runtime Classpath ----------------------------------------
-set CP=%CATALINA_HOME%\classes
+set CLASSPATH=%CATALINA_HOME%\dummy
for %%i in (%CATALINA_HOME%\lib\*.jar) do call %CATALINA_HOME%\bin\cpappend.bat %%i
-if "%CLASSPATH%" == "" goto noClasspath
-set CP=%CP%;%CLASSPATH%
-:noClasspath
-set CP=%CP%;%JAVA_HOME%\lib\tools.jar
-echo Using CLASSPATH: %CP%
+echo Using CLASSPATH: %CLASSPATH%
rem ----- Execute The Requested Command ---------------------------------------
@@ -66,16 +69,16 @@
goto finish
:doRun
-java %CATALINA_OPTS% -classpath %CP% -Dcatalina.home=%CATALINA_HOME% org.apache.tomcat.startup.Catalina %2 %3 %4 %5 %6 %7 %8 %9 start
+java %CATALINA_OPTS% -Xbootclasspath:%BP% -Dcatalina.home=%CATALINA_HOME% org.apache.tomcat.startup.Bootstrap %2 %3 %4 %5 %6 %7 %8 %9 start
goto cleanup
:doStart
-start java %CATALINA_OPTS% -classpath %CP% -Dcatalina.home=%CATALINA_HOME% org.apache.tomcat.startup.Catalina %2 %3 %4 %5 %6 %7 %8 %9 start
+start java %CATALINA_OPTS% -Xbootclasspath:%BP% -Dcatalina.home=%CATALINA_HOME% org.apache.tomcat.startup.Bootstrap %2 %3 %4 %5 %6 %7 %8 %9 start
goto cleanup
:doStop
-java %CATALINA_OPTS% -classpath %CP% -Dcatalina.home=%CATALINA_HOME% org.apache.tomcat.startup.Catalina %2 %3 %4 %5 %6 %7 %8 %9 stop
+java %CATALINA_OPTS% -Xbootclasspath:%BP% -Dcatalina.home=%CATALINA_HOME% org.apache.tomcat.startup.Bootstrap %2 %3 %4 %5 %6 %7 %8 %9 stop
goto cleanup
@@ -83,8 +86,10 @@
rem ----- Restore Environment Variables ---------------------------------------
:cleanup
+set BP=%_BP%
+set _BP=
set CATALINA_HOME=%_CATALINA_HOME%
set _CATALINA_HOME=
-set CP=%_CP%
-set _CP=
+set CLASSPATH=%_CLASSPATH%
+set _CLASSPATH=
:finish
1.11 +34 -18 jakarta-tomcat/proposals/catalina/src/bin/catalina.sh
Index: catalina.sh
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/bin/catalina.sh,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- catalina.sh 2000/06/23 17:52:37 1.10
+++ catalina.sh 2000/07/15 03:15:33 1.11
@@ -6,14 +6,13 @@
#
# CATALINA_HOME (Optional) May point at your Catalina "build" directory.
# If not present, the current working directory is assumed.
+#
# CATALINA_OPTS (Optional) Java runtime options used when the "start",
# "stop", or "run" command is executed.
-# CLASSPATH Must contain the "jaxp.jar" and "parser.jar" files from
-# the JAXP Reference Implementation, version 1.0, or these
-# files must be in your Java2 extensions directory.
+#
# JAVA_HOME Must point at your Java Development Kit installation.
#
-# $Id: catalina.sh,v 1.10 2000/06/23 17:52:37 craigmcc Exp $
+# $Id: catalina.sh,v 1.11 2000/07/15 03:15:33 craigmcc Exp $
# -----------------------------------------------------------------------------
@@ -31,19 +30,32 @@
echo You must set JAVA_HOME to point at your Java Development Kit installation
exit 1
fi
+
+# ----- Set Up The Bootstrap Classpath ----------------------------------------
+
+BP=$CATALINA_HOME/bin/bootstrap.jar
+
+if [ -f $JAVA_HOME/jre/lib/i18n.jar ] ; then
+ BP=$BP:$JAVA_HOME/jre/lib/i18n.jar
+fi
-# ----- Set Up The Runtime Classpath
+if [ -f $JAVA_HOME/jre/lib/rt.jar ] ; then
+ BP=$BP:$JAVA_HOME/jre/lib/rt.jar
+fi
-CP=$CATALINA_HOME/classes
if [ -f $JAVA_HOME/lib/tools.jar ] ; then
- CP=$CP:$JAVA_HOME/lib/tools.jar
+ BP=$BP:$JAVA_HOME/lib/tools.jar
fi
-for i in $CATALINA_HOME/lib/* ; do
+
+echo Using BOOT PATH: $BP
+
+
+# ----- Set Up The System Classpath -------------------------------------------
+
+CP=$CATALINA_HOME/dummy
+for i in $CATALINA_HOME/lib/*.jar ; do
CP=$CP:$i
done
-if [ "$CLASSPATH" != "" ] ; then
- CP=$CP:$CLASSPATH
-fi
echo Using CLASSPATH: $CP
@@ -55,8 +67,9 @@
pushd $CATALINA_HOME
jdb \
-sourcepath ../../jakarta-tomcat/proposals/catalina:../../jakarta-tomcat \
+ -Xbootclasspath:$BP \
-classpath $CP -Dcatalina.home=$CATALINA_HOME \
- org.apache.tomcat.startup.Catalina "$@" start
+ org.apache.tomcat.startup.Bootstrap "$@" start
popd
elif [ "$1" = "env" ] ; then
@@ -67,22 +80,25 @@
elif [ "$1" = "run" ] ; then
shift
- java $CATALINA_OPTS -classpath $CP -Dcatalina.home=$CATALINA_HOME \
- org.apache.tomcat.startup.Catalina "$@" start
+ java $CATALINA_OPTS -Xbootclasspath:$BP -classpath $CP \
+ -Dcatalina.home=$CATALINA_HOME \
+ org.apache.tomcat.startup.Bootstrap "$@" start
elif [ "$1" = "start" ] ; then
shift
touch $CATALINA_HOME/logs/catalina.out
- java $CATALINA_OPTS -classpath $CP -Dcatalina.home=$CATALINA_HOME \
- org.apache.tomcat.startup.Catalina "$@" start \
+ java $CATALINA_OPTS -Xbootclasspath:$BP -classpath $CP \
+ -Dcatalina.home=$CATALINA_HOME \
+ org.apache.tomcat.startup.Bootstrap "$@" start \
>> $CATALINA_HOME/logs/catalina.out 2>&1 &
elif [ "$1" = "stop" ] ; then
shift
- java $CATALINA_OPTS -classpath $CP -Dcatalina.home=$CATALINA_HOME \
- org.apache.tomcat.startup.Catalina "$@" stop
+ java $CATALINA_OPTS -Xbootclasspath:$BP -classpath $CP \
+ -Dcatalina.home=$CATALINA_HOME \
+ org.apache.tomcat.startup.Bootstrap "$@" stop
else
1.2 +1 -1 jakarta-tomcat/proposals/catalina/src/bin/cpappend.bat
Index: cpappend.bat
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/bin/cpappend.bat,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- cpappend.bat 2000/06/11 01:16:37 1.1
+++ cpappend.bat 2000/07/15 03:15:33 1.2
@@ -1 +1 @@
-set CP=%CP%;%1
+set CLASSPATH=%CLASSPATH%;%1
1.11 +8 -16 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/loader/FileClassLoader.java
Index: FileClassLoader.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/loader/FileClassLoader.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- FileClassLoader.java 2000/07/12 19:53:26 1.10
+++ FileClassLoader.java 2000/07/15 03:15:36 1.11
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/loader/FileClassLoader.java,v 1.10 2000/07/12 19:53:26 craigmcc Exp $
- * $Revision: 1.10 $
- * $Date: 2000/07/12 19:53:26 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/loader/FileClassLoader.java,v 1.11 2000/07/15 03:15:36 craigmcc Exp $
+ * $Revision: 1.11 $
+ * $Date: 2000/07/15 03:15:36 $
*
* ====================================================================
*
@@ -78,7 +78,6 @@
import java.util.jar.JarEntry;
import java.util.jar.JarException;
import java.util.jar.JarFile;
-import org.apache.tomcat.util.StringManager;
/**
@@ -102,7 +101,7 @@
* and <code>minSize</code> properties.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.10 $ $Date: 2000/07/12 19:53:26 $
+ * @version $Revision: 1.11 $ $Date: 2000/07/15 03:15:36 $
*/
public final class FileClassLoader
@@ -248,13 +247,6 @@
/**
- * The string manager for this package.
- */
- private static final StringManager sm =
- StringManager.getManager(Constants.Package);
-
-
- /**
* The set of class and resource name prefixes that should be allowed,
* but only from the underlying system class loader.
*/
@@ -395,13 +387,13 @@
if (debug >= 1)
log(" Repository does not exist");
throw new IllegalArgumentException
- (sm.getString("fileClassLoader.exists", repository));
+ ("Repository '" + repository + "' does not exist");
}
if (!file.canRead()) {
if (debug >= 1)
log(" Repository cannot be read");
throw new IllegalArgumentException
- (sm.getString("fileClassLoader.canRead", repository));
+ ("Repository '" + repository + "' cannot be read");
}
// Add this repository to the appropriate arrays
@@ -431,7 +423,7 @@
if (debug >= 1)
log(" Problem with this ZIP/JAR file", t);
throw new IllegalArgumentException
- (sm.getString("fileClassLoader.jarFile", repository));
+ ("Cannot read JAR file '" + repository + "'");
}
if (debug >= 1)
log(" Repository is a ZIP/JAR file");
@@ -952,7 +944,7 @@
// if (debug >= 2)
// log(" Rejecting restricted class " + name);
throw new ClassNotFoundException
- (sm.getString("fileClassLoader.restricted", name));
+ ("Cannot load restricted class '" + name + "'");
}
// Has this class already been loaded?
1.19 +6 -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.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- StandardManager.java 2000/07/12 04:43:15 1.18
+++ StandardManager.java 2000/07/15 03:15:37 1.19
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/StandardManager.java,v 1.18 2000/07/12 04:43:15 craigmcc Exp $
- * $Revision: 1.18 $
- * $Date: 2000/07/12 04:43:15 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/StandardManager.java,v 1.19 2000/07/15 03:15:37 craigmcc Exp $
+ * $Revision: 1.19 $
+ * $Date: 2000/07/15 03:15:37 $
*
* ====================================================================
*
@@ -105,7 +105,7 @@
* <code>stop()</code> methods of this class at the correct times.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.18 $ $Date: 2000/07/12 04:43:15 $
+ * @version $Revision: 1.19 $ $Date: 2000/07/15 03:15:37 $
*/
public final class StandardManager
@@ -154,7 +154,8 @@
* temporary working directory provided by our context, available via
* the <code>javax.servlet.context.tempdir</code> context attribute.
*/
- private String pathname = "sessions.ser";
+ // private String pathname = "sessions.ser";
+ private String pathname = null;
/**
1.12 +18 -7 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.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Catalina.java 2000/07/02 18:07:03 1.11
+++ Catalina.java 2000/07/15 03:15:41 1.12
@@ -1,7 +1,7 @@
/*
- * $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 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/Catalina.java,v 1.12 2000/07/15 03:15:41 craigmcc Exp $
+ * $Revision: 1.12 $
+ * $Date: 2000/07/15 03:15:41 $
*
* ====================================================================
*
@@ -94,7 +94,7 @@
* </u>
*
* @author Craig R. McClanahan
- * @version $Revision: 1.11 $ $Date: 2000/07/02 18:07:03 $
+ * @version $Revision: 1.12 $ $Date: 2000/07/15 03:15:41 $
*/
public final class Catalina {
@@ -143,10 +143,21 @@
*/
public static void main(String args[]) {
+ (new Catalina()).process(args);
+
+ }
+
+
+ /**
+ * The instance main program.
+ *
+ * @param args Command line arguments
+ */
+ public void process(String args[]) {
+
try {
- Catalina catalina = new Catalina();
- if (catalina.arguments(args))
- catalina.execute();
+ if (arguments(args))
+ execute();
} catch (Exception e) {
e.printStackTrace(System.out);
}
1.1 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/Bootstrap.java
Index: Bootstrap.java
===================================================================
/*
* $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/Bootstrap.java,v 1.1 2000/07/15 03:15:41 craigmcc Exp $
* $Revision: 1.1 $
* $Date: 2000/07/15 03:15:41 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.tomcat.startup;
import java.io.File;
import java.lang.reflect.Method;
import org.apache.tomcat.loader.FileClassLoader;
/**
* Boostrap loader for Catalina. This application constructs a class loader
* for use in loading the Tomcat internal classes (by accumulating all of the
* JAR files found in the "server" directory under "catalina.home"), and
* starts the regular execution of the container. The purpose of this
* roundabout approach is to keep the Catalina internal classes (and any
* other classes they depend on, such as an XML parser) out of the system
* class path and therefore not visible to application level classes.
*
* @author Craig R. McClanahan
* @version $Revision: 1.1 $ $Date: 2000/07/15 03:15:41 $
*/
public final class Bootstrap {
// ----------------------------------------------------------- Main Program
/**
* The main program for the bootstrap.
*
* @param args Command line arguments to be processed
*/
public static void main(String args[]) {
// Construct a new class loader for our internal classes
FileClassLoader loader = new FileClassLoader();
// Add the "classes" subdirectory underneath "catalina.home"
File classes = new File(System.getProperty("catalina.home"),
"classes");
if (classes.exists() && classes.canRead() &&
classes.isDirectory()) {
loader.addRepository(classes.getAbsolutePath());
}
// Add the JAR files in the "server" subdirectory as well
File directory = new File(System.getProperty("catalina.home"),
"server");
if (!directory.exists() || !directory.canRead() ||
!directory.isDirectory()) {
System.out.println("No 'server' directory to be processed");
System.exit(1);
}
String filenames[] = directory.list();
for (int i = 0; i < filenames.length; i++) {
if (!filenames[i].toLowerCase().endsWith(".jar"))
continue;
File file = new File(directory, filenames[i]);
loader.addRepository(file.getAbsolutePath());
}
// Load our startup class and call its process() method
try {
Class startupClass =
loader.loadClass("org.apache.tomcat.startup.Catalina");
Object startupInstance = startupClass.newInstance();
String methodName = "process";
Class paramTypes[] = new Class[1];
paramTypes[0] = args.getClass();
Object paramValues[] = new Object[1];
paramValues[0] = args;
Method method =
startupInstance.getClass().getMethod(methodName, paramTypes);
method.invoke(startupInstance, paramValues);
} catch (Exception e) {
System.out.println("Exception during startup processing");
e.printStackTrace(System.out);
System.exit(2);
}
System.exit(0);
}
}