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/04/27 07:55:22 UTC
cvs commit: jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup Catalina.java Constants.java ContextConfig.java LocalStrings.properties
craigmcc 00/04/26 22:55:22
Modified: proposals/catalina build.bat build.sh build.xml
proposals/catalina/src/conf server.xml
proposals/catalina/src/share/org/apache/tomcat/connector/test
HttpConnector.java LocalStrings.properties
proposals/catalina/src/share/org/apache/tomcat/core
ApplicationContext.java ContainerBase.java
RootContext.java
proposals/catalina/src/share/org/apache/tomcat/realm
LocalStrings.properties MemoryRealm.java
proposals/catalina/src/share/org/apache/tomcat/resources
LocalStrings.properties StandardResources.java
proposals/catalina/src/share/org/apache/tomcat/session
LocalStrings.properties StandardManager.java
proposals/catalina/src/share/org/apache/tomcat/startup
Catalina.java Constants.java ContextConfig.java
LocalStrings.properties
Log:
Miscellaneous debugging and enhancements (including the abililty to bind
the test HTTP connector to a particular IP address), accumulated while
listening to the playoff game. Contexts are now configured (except for a
couple of FIXME items) from the default web.xml, followed by the
application-specific web.xml.
NOTE: Build process now requires you to download and build the
"jakarta-servletapi" process parallel to jakarta-ant and jakarta-tomcat,
and to have the JAXP "jaxp.jar" and "parser.jar" files on your class path.
Go Blazers! :-)
Revision Changes Path
1.2 +10 -6 jakarta-tomcat/proposals/catalina/build.bat
Index: build.bat
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/build.bat,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- build.bat 2000/04/18 15:20:47 1.1
+++ build.bat 2000/04/27 05:55:12 1.2
@@ -2,19 +2,21 @@
REM convience bat file to build Catalina
REM You will need to set JAVA_HOME
-SET _ANTHOME=%ANT_HOME%
-if "%ANT_HOME%" == "" SET ANT_HOME=..\..\..\jakarta-ant
+set _ANTHOME=%ANT_HOME%
+if "%ANT_HOME%" == "" set ANT_HOME=..\..\..\jakarta-ant
+set _SERVLETAPIHOME=%SERVLETAPI_HOME%
+if "%SERVLETAPI_HOME%" == "" set SERVLETAPI_HOME=..\..\..\jakarta-servletapi
if "%CLASSPATH%" == "" goto noclasspath
rem else
set _CLASSPATH=%CLASSPATH%
-set CLASSPATH=%CLASSPATH%;%ANT_HOME%/lib/ant.jar;%ANT_HOME%/lib/xml.jar;../../..jakarta-tools\moo.jar;../../../jakarta-tools/projectx-tr2.jar;../../../build/catalina/classes;../../../build/tomcat/classes;%JAVA_HOME%/lib/tools.jar
+set CLASSPATH=%CLASSPATH%;%ANT_HOME%/lib/ant.jar;%SERVLETAPI_HOME%/lib/servlet.jar;../../../build/catalina/classes;../../../build/tomcat/classes;%JAVA_HOME%/lib/tools.jar
goto next
:noclasspath
set _CLASSPATH=
-set CLASSPATH=%ANT_HOME%/lib/ant.jar;%ANT_HOME%\lib\xml.jar;../../../jakarta-tools/moo.jar;../../../jakarta-tools/projectx-tr2.jar;../../../build/catalina/classes;../../../build/tomcat/classes;%JAVA_HOME%/lib/tools.jar
+set CLASSPATH=%ANT_HOME%/lib/ant.jar;%SERVLETAPI_HOME%\lib\servlet.jar;../../../build/catalina/classes;../../../build/tomcat/classes;%JAVA_HOME%/lib/tools.jar
goto next
:next
@@ -26,5 +28,7 @@
rem clean up classpath after
set CLASSPATH=%_CLASSPATH%
set _CLASSPATH=
-SET ANT_HOME=%_ANTHOME%
-SET _ANTHOME=
+set SERVLETAPI_HOME=%_SERVLETAPIHOME%
+set _SERVLETAPIHOME=
+set ANT_HOME=%_ANTHOME%
+set _ANTHOME=
1.3 +2 -2 jakarta-tomcat/proposals/catalina/build.sh
Index: build.sh
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/build.sh,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- build.sh 2000/02/07 06:06:48 1.2
+++ build.sh 2000/04/27 05:55:12 1.3
@@ -1,6 +1,6 @@
#! /bin/sh
-# $Id: build.sh,v 1.2 2000/02/07 06:06:48 craigmcc Exp $
+# $Id: build.sh,v 1.3 2000/04/27 05:55:12 craigmcc Exp $
if [ -z "$JAVA_HOME" ]
then
@@ -16,7 +16,7 @@
JAVACMD=$JAVA_HOME/bin/java
-cp=../../../jakarta-ant/lib/ant.jar:../../../jakarta-tools/moo.jar:../../../jakarta-tools/projectx-tr2.jar:../../../build/catalina/classes:../../../build/tomcat/classes:$JAVA_HOME/lib/tools.jar
+cp=../../../jakarta-ant/lib/ant.jar::../../../jakarta-servletapi/lib/servlet.jar:../../../build/catalina/classes:../../../build/tomcat/classes:$JAVA_HOME/lib/tools.jar
$JAVACMD -classpath $cp:$CLASSPATH org.apache.tools.ant.Main "$@"
1.8 +24 -9 jakarta-tomcat/proposals/catalina/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/build.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- build.xml 2000/04/26 01:03:58 1.7
+++ build.xml 2000/04/27 05:55:12 1.8
@@ -1,10 +1,12 @@
-<project name="Tomcat-Next" default="main" basedir=".">
+<project name="Catalina" default="main" basedir=".">
<!-- Initialize property values -->
<property name="ant.home" value="../../../jakarta-ant"/>
<property name="build.compiler" value="classic"/>
<property name="catalina.build" value="../../../build/catalina"/>
<property name="catalina.home" value="../../../dist/catalina"/>
+ <property name="servlet.jar" value="../../../jakarta-servletapi/lib/servlet.jar"/>
+ <property name="tomcat.build" value="../../../build/tomcat"/>
<!-- Create directories -->
<target name="prepare">
@@ -16,26 +18,39 @@
<mkdir dir="${catalina.build}/src"/>
<mkdir dir="${catalina.build}/lib"/>
<mkdir dir="${catalina.build}/logs"/>
+ <mkdir dir="${catalina.build}/sessions"/>
<mkdir dir="${catalina.build}/webapps"/>
- <mkdir dir="${catalina.build}/webapps/ROOT"/>
- <mkdir dir="${catalina.build}/webapps/ROOT/WEB-INF"/>
- <mkdir dir="${catalina.build}/webapps/ROOT/WEB-INF/classes"/>
</target>
<!-- Copy static files -->
<target name="static" depends="prepare">
- <copyfile src="${ant.home}/lib/xml.jar"
- dest="${catalina.build}/lib/xml.jar"/>
+ <copyfile src="${ant.home}/lib/ant.jar"
+ dest="${catalina.build}/lib/ant.jar"/>
+ <copyfile src="${servlet.jar}" dest="${catalina.build}/lib/servlet.jar"/>
<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"/>
<copydir src="src/conf" dest="${catalina.build}/conf"/>
</target>
- <!-- Compile the build directory -->
+ <!-- Compile the server components -->
<target name="main" depends="prepare,static">
<javac srcdir="src/share" destdir="${catalina.build}/classes"
- classpath="${catalina.build}/lib/xml.jar" debug="on" excludes="**/CVS/**"/>
+ classpath="${servlet.jar}" deprecation="off" debug="on"
+ excludes="**/CVS/**"/>
</target>
+ <!-- Clean and recopy the web applications from Tomcat -->
+ <target name="webapps">
+ <copyfile src="${tomcat.build}/conf/web.xml"
+ dest="${catalina.build}/conf/web.xml"/>
+ <copyfile src="${tomcat.build}/conf/tomcat-users.xml"
+ dest="${catalina.build}/conf/tomcat-users.xml"/>
+ <deltree dir="${catalina.build}/webapps"/>
+ <mkdir dir="${catalina.build}/webapps"/>
+ <copydir src="${tomcat.build}/webapps" dest="${catalina.build}/webapps"/>
+ </target>
+
<!-- Compile the distribution directory -->
<target name="dist" depends="main">
<mkdir dir="${catalina.home}"/>
@@ -53,6 +68,6 @@
</target>
<!-- Clean up and compile everything -->
- <target name="all" depends="clean,dist.clean,main,dist"/>
+ <target name="all" depends="clean,dist.clean,main,webapps,dist"/>
</project>
1.9 +16 -19 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- server.xml 2000/04/26 01:03:58 1.8
+++ server.xml 2000/04/27 05:55:13 1.9
@@ -14,43 +14,40 @@
<Engine name="engine" defaultHost="localhost" unknownHost="localhost">
- <!-- Lifecycle listeners are notified of component start and stop -->
- <!-- <Lifecycle className="....LifecycleListener...." param="value"/> -->
-
- <!-- Logger that receives all log messages for subordinate components
- unless overridden at a lower level -->
+ <!-- Global logger unless overridden at lower levels -->
<Logger className="org.apache.tomcat.logger.FileLogger"
directory="logs" prefix="tomcat_log." suffix=".txt"
timestamp="true"/>
<!-- Because this Realm is here, an instance will be shared globally -->
- <!--
- <Realm className="org.apache.tomcat.realm.JndiRealm"
- param1="value1" /> --> <!-- Parameters to access directory via JNDI -->
+ <Realm className="org.apache.tomcat.realm.MemoryRealm" debug="2"/>
<Host name="localhost">
- <!-- Processes all requests for this virtual host -->
+ <!-- Access log processes all requests for this virtual host -->
<Valve className="org.apache.tomcat.valves.AccessLogValve"
- directory="localhost_logs" prefix="access_log." suffix=""
+ directory="logs" prefix="localhost_access_log." suffix=""
pattern="common"/>
- <!-- Shared by all Contexts related to this virtual host -->
+ <!-- Logger shared by all Contexts related to this virtual host -->
<Logger className="org.apache.tomcat.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
- <!-- Initial context to start playing with -->
+ <!-- Root Context -->
<Context path="/" docBase="webapps/ROOT">
- <Listener className="org.apache.tomcat.startup.ContextConfig"
- debug="1"/>
- <!--
+ <Listener className="org.apache.tomcat.startup.ContextConfig"/>
+ <Manager className="org.apache.tomcat.session.StandardManager"
+ checkInterval="15" maxActiveSessions="100"
+ pathname="sessions/localhost_ROOT.sessions"/>
+ </Context>
+
+ <!-- Examples Context -->
+ <Context path="/examples" docBase="webapps/examples">
+ <Listener className="org.apache.tomcat.startup.ContextConfig"/>
<Manager className="org.apache.tomcat.session.StandardManager"
checkInterval="15" maxActiveSessions="100"
- pathname="localhost_sessions/ROOT.sessions"/>
- -->
- <Resources className="org.apache.tomcat.resources.StandardResources"
- debug="1"/>
+ pathname="sessions/localhost_examples.sessions"/>
</Context>
</Host>
1.4 +74 -7 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpConnector.java
Index: HttpConnector.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpConnector.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- HttpConnector.java 2000/04/26 02:14:49 1.3
+++ HttpConnector.java 2000/04/27 05:55:14 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpConnector.java,v 1.3 2000/04/26 02:14:49 craigmcc Exp $
- * $Revision: 1.3 $
- * $Date: 2000/04/26 02:14:49 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpConnector.java,v 1.4 2000/04/27 05:55:14 craigmcc Exp $
+ * $Revision: 1.4 $
+ * $Date: 2000/04/27 05:55:14 $
*
* ====================================================================
*
@@ -66,6 +66,7 @@
import java.io.IOException;
+import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Stack;
@@ -91,7 +92,7 @@
* purposes. Not intended to be the final solution.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.3 $ $Date: 2000/04/26 02:14:49 $
+ * @version $Revision: 1.4 $ $Date: 2000/04/27 05:55:14 $
*/
@@ -110,6 +111,13 @@
/**
+ * 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;
+
+
+ /**
* The set of processors that have ever been created.
*/
private Vector created = new Vector();
@@ -228,6 +236,28 @@
/**
+ * 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;
+
+ }
+
+
+ /**
* Is this connector available for processing requests?
*/
public boolean isAvailable() {
@@ -438,7 +468,7 @@
/**
- * Log a message on the Logger associated with our Container (if any)
+ * Log a message on the Logger associated with our Container (if any).
*
* @param message Message to be logged
*/
@@ -447,12 +477,14 @@
Logger logger = container.getLogger();
if (logger != null)
logger.log(threadName + " " + message);
+ else
+ System.out.println(threadName + " " + message);
}
/**
- * Log a message on the Logger associated with our Container (if any)
+ * Log a message on the Logger associated with our Container (if any).
*
* @param message Message to be logged
* @param throwable Associated exception
@@ -462,6 +494,10 @@
Logger logger = container.getLogger();
if (logger != null)
logger.log(threadName + " " + message, throwable);
+ else {
+ System.out.println(threadName + " " + message);
+ throwable.printStackTrace(System.out);
+ }
}
@@ -486,6 +522,37 @@
}
+ /**
+ * Open and return the server socket for this Connector. If an IP
+ * address has been specified, the socket will be opened only on that
+ * address; otherwise it will be opened on all addresses.
+ *
+ * @exception IOException if an input/output error occurs
+ */
+ private ServerSocket open() throws IOException {
+
+ // If no address is specified, open a connection on all addresses
+ if (address == null)
+ return new ServerSocket(port, acceptCount);
+
+ // Open a server socket on the specified address
+ InetAddress[] addresses = InetAddress.getAllByName("localhost");
+ int i;
+ for (i = 0; i < addresses.length; i++) {
+ if (addresses[i].getHostAddress().equals(address))
+ break;
+ }
+ if (i < addresses.length) {
+ log(sm.getString("httpConnector.anAddress", address));
+ return new ServerSocket(port, acceptCount, addresses[i]);
+ } else {
+ log(sm.getString("httpConnector.noAddress", address));
+ return new ServerSocket(port, acceptCount);
+ }
+
+ }
+
+
// ---------------------------------------------- Background Thread Methods
@@ -609,7 +676,7 @@
// Establish a server socket on the specified port
try {
- serverSocket = new ServerSocket(port, acceptCount);
+ serverSocket = open();
} catch (IOException e) {
throw new LifecycleException("HttpConnector[" + port + "]", e);
}
1.2 +2 -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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LocalStrings.properties 2000/04/21 19:50:37 1.1
+++ LocalStrings.properties 2000/04/27 05:55:14 1.2
@@ -1,4 +1,6 @@
httpConnector.alreadyStarted=HTTP connector has already been started
+httpConnector.anAddress=Opening server socket on IP address {0}
+httpConnector.noAddress=No host address matching {0}, opening on all addresses
httpConnector.notStarted=HTTP connector has not yet been started
httpProcessor.parseHeaders.contentLength=Invalid 'Content-Length' header
httpProcessor.parseHeaders.colon=Invalid HTTP header format
1.5 +5 -5 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ApplicationContext.java
Index: ApplicationContext.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ApplicationContext.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ApplicationContext.java 2000/04/23 01:42:32 1.4
+++ ApplicationContext.java 2000/04/27 05:55:14 1.5
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ApplicationContext.java,v 1.4 2000/04/23 01:42:32 craigmcc Exp $
- * $Revision: 1.4 $
- * $Date: 2000/04/23 01:42:32 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ApplicationContext.java,v 1.5 2000/04/27 05:55:14 craigmcc Exp $
+ * $Revision: 1.5 $
+ * $Date: 2000/04/27 05:55:14 $
*
* ====================================================================
*
@@ -88,7 +88,7 @@
* associated with each instance of <code>StandardContext</code>.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.4 $ $Date: 2000/04/23 01:42:32 $
+ * @version $Revision: 1.5 $ $Date: 2000/04/27 05:55:14 $
*/
final class ApplicationContext
@@ -378,7 +378,7 @@
/**
- * @deprectated As of Java Servlet API 2.1, with no direct replacement.
+ * @deprecated As of Java Servlet API 2.1, with no direct replacement.
*/
public Enumeration getServlets() {
1.13 +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.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ContainerBase.java 2000/04/26 01:03:59 1.12
+++ ContainerBase.java 2000/04/27 05:55:15 1.13
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ContainerBase.java,v 1.12 2000/04/26 01:03:59 craigmcc Exp $
- * $Revision: 1.12 $
- * $Date: 2000/04/26 01:03:59 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ContainerBase.java,v 1.13 2000/04/27 05:55:15 craigmcc Exp $
+ * $Revision: 1.13 $
+ * $Date: 2000/04/27 05:55:15 $
*
* ====================================================================
*
@@ -149,7 +149,7 @@
* class comments of the implementation class.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.12 $ $Date: 2000/04/26 01:03:59 $
+ * @version $Revision: 1.13 $ $Date: 2000/04/27 05:55:15 $
*/
public abstract class ContainerBase
@@ -675,6 +675,8 @@
log("ContainerBase.setResources: stop: ", e);
}
}
+ if (oldResources != null)
+ oldResources.setContainer(null);
// Start the new component if necessary
if (resources != null)
1.2 +4 -4 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/RootContext.java
Index: RootContext.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/RootContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RootContext.java 2000/01/20 06:34:49 1.1
+++ RootContext.java 2000/04/27 05:55:15 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/RootContext.java,v 1.1 2000/01/20 06:34:49 craigmcc Exp $
- * $Revision: 1.1 $
- * $Date: 2000/01/20 06:34:49 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/RootContext.java,v 1.2 2000/04/27 05:55:15 craigmcc Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/04/27 05:55:15 $
*
* ====================================================================
*
@@ -87,7 +87,7 @@
* allowed by the security configuration of this deployment.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.1 $ $Date: 2000/01/20 06:34:49 $
+ * @version $Revision: 1.2 $ $Date: 2000/04/27 05:55:15 $
*/
final class RootContext
@@ -351,7 +351,7 @@
/**
- * @deprectated As of Java Servlet API 2.1, with no direct replacement.
+ * @deprecated As of Java Servlet API 2.1, with no direct replacement.
*/
public Enumeration getServlets() {
1.2 +8 -1 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/realm/LocalStrings.properties
Index: LocalStrings.properties
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/realm/LocalStrings.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LocalStrings.properties 2000/04/18 20:41:22 1.1
+++ LocalStrings.properties 2000/04/27 05:55:16 1.2
@@ -1,3 +1,10 @@
memoryRealm.alreadyStarted=This Realm has already been started
-memoryRealm.load.exists=Memory realm file {0} does not exist
+memoryRealm.authenticateFailure=Authentication unsuccessful for user {0}
+memoryRealm.authenticateSuccess=Authentication successful for user {0}
+memoryRealm.hasRoleFailure=User {0} does NOT have role {1}
+memoryRealm.hasRoleNone=No user has role {1}
+memoryRealm.hasRoleSuccess=User {0} has role {1}
+memoryRealm.hasRoleUser=User {0} is not in this realm database
+memoryRealm.loadExist=Memory realm file {0} does not exist
+memoryRealm.loadPath=Loading memory realm file {0}
memoryRealm.notStarted=This Realm has not yet been started
1.3 +113 -11 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/realm/MemoryRealm.java
Index: MemoryRealm.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/realm/MemoryRealm.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MemoryRealm.java 2000/04/26 02:14:54 1.2
+++ MemoryRealm.java 2000/04/27 05:55:16 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/realm/MemoryRealm.java,v 1.2 2000/04/26 02:14:54 craigmcc Exp $
- * $Revision: 1.2 $
- * $Date: 2000/04/26 02:14:54 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/realm/MemoryRealm.java,v 1.3 2000/04/27 05:55:16 craigmcc Exp $
+ * $Revision: 1.3 $
+ * $Date: 2000/04/27 05:55:16 $
*
* ====================================================================
*
@@ -77,6 +77,7 @@
import org.apache.tomcat.LifecycleEvent;
import org.apache.tomcat.LifecycleException;
import org.apache.tomcat.LifecycleListener;
+import org.apache.tomcat.Logger;
import org.apache.tomcat.Realm;
import org.apache.tomcat.util.LifecycleSupport;
import org.apache.tomcat.util.StringManager;
@@ -92,7 +93,7 @@
* location) are identical to those currently supported by Tomcat 3.X.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.2 $ $Date: 2000/04/26 02:14:54 $
+ * @version $Revision: 1.3 $ $Date: 2000/04/27 05:55:16 $
*/
public final class MemoryRealm
@@ -109,6 +110,12 @@
/**
+ * The debugging detail level for this component.
+ */
+ private int debug = 0;
+
+
+ /**
* Descriptive information about this Realm implementation.
*/
private static final String info =
@@ -187,6 +194,28 @@
/**
+ * Return the debugging detail level for this component.
+ */
+ public int getDebug() {
+
+ return (this.debug);
+
+ }
+
+
+ /**
+ * Set the debugging detail level for this component.
+ *
+ * @param debug The new debugging detail level
+ */
+ public void setDebug(int debug) {
+
+ this.debug = debug;
+
+ }
+
+
+ /**
* Return descriptive information about this Realm implementation and
* the corresponding version number, in the format
* <code><description>/<version></code>.
@@ -226,10 +255,15 @@
MemoryRealmPrincipal principal =
(MemoryRealmPrincipal) principals.get(username);
if ((principal != null) &&
- (credentials.equals(principal.getPassword())))
+ (credentials.equals(principal.getPassword()))) {
+ if (debug > 1)
+ log(sm.getString("memoryRealm.authenticateSuccess", username));
return (principal);
- else
+ } else {
+ if (debug > 1)
+ log(sm.getString("memoryRealm.authenticateFailure", username));
return (null);
+ }
}
@@ -261,19 +295,32 @@
MemoryRealmPrincipal realPrincipal =
(MemoryRealmPrincipal) principals.get(principal.getName());
- if (realPrincipal == null)
+ if (realPrincipal == null) {
+ if (debug > 1)
+ log(sm.getString("memoryRealm.hasRoleUser",
+ principal.getName()));
return (false);
+ }
String name = realPrincipal.getName();
Vector users = (Vector) roles.get(role);
- if (users == null)
+ if (users == null) {
+ if (debug > 1)
+ log(sm.getString("memoryRealm.hasRoleNone", role));
return (false);
+ }
Enumeration items = users.elements();
while (items.hasMoreElements()) {
MemoryRealmPrincipal item =
(MemoryRealmPrincipal) items.nextElement();
- if (name.equals(item.getName()))
+ if (name.equals(item.getName())) {
+ if (debug > 1)
+ log(sm.getString("memoryRealm.hasRoleSuccess",
+ name, role));
return (true);
+ }
}
+ if (debug > 1)
+ log(sm.getString("memoryRealm.hasRoleFailure", name, role));
return (false);
}
@@ -325,6 +372,60 @@
}
+ // -------------------------------------------------------- Private Methods
+
+
+ /**
+ * Log a message on the Logger associated with our Container (if any)
+ *
+ * @param message Message to be logged
+ */
+ private void log(String message) {
+
+ Logger logger = null;
+ if (container != null)
+ logger = container.getLogger();
+ if (logger != null)
+ logger.log("MemoryRealm[" + container.getName() + "]: "
+ + message);
+ else {
+ String containerName = null;
+ if (container != null)
+ containerName = container.getName();
+ System.out.println("MemoryRealm[" + containerName
+ + "]: " + message);
+ }
+
+ }
+
+
+ /**
+ * Log a message on the Logger associated with our Container (if any)
+ *
+ * @param message Message to be logged
+ * @param throwable Associated exception
+ */
+ private void log(String message, Throwable throwable) {
+
+ Logger logger = null;
+ if (container != null)
+ logger = container.getLogger();
+ if (logger != null)
+ logger.log("MemoryRealm[" + container.getName() + "] "
+ + message, throwable);
+ else {
+ String containerName = null;
+ if (container != null)
+ containerName = container.getName();
+ System.out.println("MemoryRealm[" + containerName
+ + "]: " + message);
+ System.out.println("" + throwable);
+ throwable.printStackTrace(System.out);
+ }
+
+ }
+
+
// ------------------------------------------------------ Lifecycle Methods
@@ -370,13 +471,14 @@
started = true;
// Validate the existence of our database file
- // FIXME - Resolve relative pathname against tomcat home?
File file = new File(pathname);
if (!file.exists())
throw new LifecycleException
- (sm.getString("memoryRealm.load.exist", pathname));
+ (sm.getString("memoryRealm.loadExist", pathname));
// Load the contents of the database file
+ if (debug > 0)
+ log(sm.getString("memoryRealm.loadPath", pathname));
XmlMapper mapper = new XmlMapper();
mapper.addRule("tomcat-users/user", new MemoryRealmUserAction());
try {
1.2 +1 -0 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/resources/LocalStrings.properties
Index: LocalStrings.properties
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/resources/LocalStrings.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LocalStrings.properties 2000/04/26 01:04:00 1.1
+++ LocalStrings.properties 2000/04/27 05:55:17 1.2
@@ -1,4 +1,5 @@
standardResources.alreadyStarted=Resources has already been started
standardResources.directory=File base {0} is not a directory
standardResources.notStarted=Resources has not yet been started
+standardResources.null=Document base cannot be null
standardResources.slash=Document base {0} must not end with a slash
1.2 +10 -15 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/resources/StandardResources.java
Index: StandardResources.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/resources/StandardResources.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StandardResources.java 2000/04/26 01:04:00 1.1
+++ StandardResources.java 2000/04/27 05:55:17 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/resources/StandardResources.java,v 1.1 2000/04/26 01:04:00 craigmcc Exp $
- * $Revision: 1.1 $
- * $Date: 2000/04/26 01:04:00 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/resources/StandardResources.java,v 1.2 2000/04/27 05:55:17 craigmcc Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/04/27 05:55:17 $
*
* ====================================================================
*
@@ -101,7 +101,7 @@
* </ul>
*
* @author Craig R. McClanahan
- * @version $Revision: 1.1 $ $Date: 2000/04/26 01:04:00 $
+ * @version $Revision: 1.2 $ $Date: 2000/04/27 05:55:17 $
*/
public final class StandardResources
@@ -261,27 +261,22 @@
public void setDocBase(String docBase) {
// Validate the format of the proposed document root
- if ((docBase != null) && (docBase.length() > 1) &&
- docBase.endsWith("/"))
+ if (docBase == null)
throw new IllegalArgumentException
+ (sm.getString("standardResources.null"));
+ if ((docBase.length() > 1) && docBase.endsWith("/"))
+ throw new IllegalArgumentException
(sm.getString("standardResources.slash", docBase));
// Change the document root property
String oldDocBase = this.docBase;
this.docBase = docBase.toString();
support.firePropertyChange("docBase", oldDocBase, this.docBase);
- if (debug > 0) {
- String containerName = null;
- if (container != null)
- containerName = container.getName();
- log("Setting container '" + containerName +
- "' docBase to '" + this.docBase + "'");
- }
+ if (debug > 0)
+ log("Setting docBase to '" + this.docBase + "'");
// Calculate the corresponding file base (if any)
fileBase = null;
- if (this.docBase == null)
- return;
int colon = this.docBase.indexOf(":");
if (colon <= 1) // No colon, or Windows drive letter
fileBase = docBase;
1.3 +2 -0 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/LocalStrings.properties
Index: LocalStrings.properties
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/LocalStrings.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LocalStrings.properties 2000/01/29 03:47:30 1.2
+++ LocalStrings.properties 2000/04/27 05:55:18 1.3
@@ -5,7 +5,9 @@
serverSession.value.iae=null value
standardManager.alreadyStarted=Manager has already been started
standardManager.createSession.ise=createSession: Too many active sessions
+standardManager.loading=Loading persisted sessions from {0}
standardManager.notStarted=Manager has not yet been started
+standardManager.unloading=Saving persisted sessions to {0}
standardSession.invalidate.ise=invalidate: Session already invalidated
standardSession.isNew.ise=isNew: Session already invalidated
standardSession.getAttribute.ise=getAttribute: Session already invalidated
1.8 +88 -4 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- StandardManager.java 2000/04/26 02:14:55 1.7
+++ StandardManager.java 2000/04/27 05:55:19 1.8
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/StandardManager.java,v 1.7 2000/04/26 02:14:55 craigmcc Exp $
- * $Revision: 1.7 $
- * $Date: 2000/04/26 02:14:55 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/StandardManager.java,v 1.8 2000/04/27 05:55:19 craigmcc Exp $
+ * $Revision: 1.8 $
+ * $Date: 2000/04/27 05:55:19 $
*
* ====================================================================
*
@@ -79,6 +79,7 @@
import org.apache.tomcat.LifecycleEvent;
import org.apache.tomcat.LifecycleException;
import org.apache.tomcat.LifecycleListener;
+import org.apache.tomcat.Logger;
import org.apache.tomcat.Manager;
import org.apache.tomcat.Request;
import org.apache.tomcat.Session;
@@ -97,7 +98,7 @@
* <code>stop()</code> methods of this class at the correct times.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.7 $ $Date: 2000/04/26 02:14:55 $
+ * @version $Revision: 1.8 $ $Date: 2000/04/27 05:55:19 $
*/
public final class StandardManager
@@ -115,6 +116,12 @@
/**
+ * The debugging detail level for this component.
+ */
+ private int debug = 0;
+
+
+ /**
* The descriptive information about this implementation.
*/
private static final String info = "StandardManager/1.0";
@@ -201,6 +208,28 @@
/**
+ * Return the debugging detail level for this component.
+ */
+ public int getDebug() {
+
+ return (this.debug);
+
+ }
+
+
+ /**
+ * Set the debugging detail level for this component.
+ *
+ * @param debug The new debugging detail level
+ */
+ public void setDebug(int debug) {
+
+ this.debug = debug;
+
+ }
+
+
+ /**
* Return descriptive information about this Manager implementation and
* the corresponding version number, in the format
* <code><description>/<version></code>.
@@ -399,6 +428,8 @@
// Open an input stream to the specified pathname, if any
if (pathname == null)
return;
+ if (debug > 0)
+ log(sm.getString("standardManager.loading", pathname));
FileInputStream fis = null;
ObjectInputStream ois = null;
try {
@@ -462,6 +493,57 @@
/**
+ * Log a message on the Logger associated with our Container (if any)
+ *
+ * @param message Message to be logged
+ */
+ private void log(String message) {
+
+ Logger logger = null;
+ if (container != null)
+ logger = container.getLogger();
+ if (logger != null)
+ logger.log("StandardManager[" + container.getName() + "]: "
+ + message);
+ else {
+ String containerName = null;
+ if (container != null)
+ containerName = container.getName();
+ System.out.println("StandardManager[" + containerName
+ + "]: " + message);
+ }
+
+ }
+
+
+ /**
+ * Log a message on the Logger associated with our Container (if any)
+ *
+ * @param message Message to be logged
+ * @param throwable Associated exception
+ */
+ private void log(String message, Throwable throwable) {
+
+ Logger logger = null;
+ if (container != null)
+ logger = container.getLogger();
+ if (logger != null)
+ logger.log("StandardManager[" + container.getName() + "] "
+ + message, throwable);
+ else {
+ String containerName = null;
+ if (container != null)
+ containerName = container.getName();
+ System.out.println("StandardManager[" + containerName
+ + "]: " + message);
+ System.out.println("" + throwable);
+ throwable.printStackTrace(System.out);
+ }
+
+ }
+
+
+ /**
* Invalidate all sessions that have expired.
*/
private void processExpires() {
@@ -495,6 +577,8 @@
// Open an output stream to the specified pathname, if any
if (pathname == null)
return;
+ if (debug > 0)
+ log(sm.getString("standardManager.unloading", pathname));
FileOutputStream fos = null;
ObjectOutputStream oos = null;
try {
1.6 +14 -10 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Catalina.java 2000/04/26 01:04:00 1.5
+++ Catalina.java 2000/04/27 05:55:20 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/Catalina.java,v 1.5 2000/04/26 01:04:00 craigmcc Exp $
- * $Revision: 1.5 $
- * $Date: 2000/04/26 01:04:00 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/Catalina.java,v 1.6 2000/04/27 05:55:20 craigmcc Exp $
+ * $Revision: 1.6 $
+ * $Date: 2000/04/27 05:55:20 $
*
* ====================================================================
*
@@ -68,6 +68,7 @@
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
+import java.lang.reflect.InvocationTargetException;
import java.net.Socket;
import org.apache.tomcat.Lifecycle;
import org.apache.tomcat.LifecycleException;
@@ -87,7 +88,7 @@
* </u>
*
* @author Craig R. McClanahan
- * @version $Revision: 1.5 $ $Date: 2000/04/26 01:04:00 $
+ * @version $Revision: 1.6 $ $Date: 2000/04/27 05:55:20 $
*/
public final class Catalina {
@@ -135,7 +136,7 @@
if (catalina.arguments(args))
catalina.execute();
} catch (Exception e) {
- e.printStackTrace();
+ e.printStackTrace(System.out);
}
}
@@ -439,9 +440,12 @@
File file = new File(configFile);
try {
mapper.readXml(file, this);
+ } catch (InvocationTargetException e) {
+ System.err.println("Catalina.start: InvocationTargetException");
+ e.getTargetException().printStackTrace(System.out);
} catch (Exception e) {
System.err.println("Catalina.start: " + e);
- e.printStackTrace();
+ e.printStackTrace(System.out);
System.exit(1);
}
@@ -451,7 +455,7 @@
((Lifecycle) server).start();
} catch (LifecycleException e) {
System.err.println("Catalina.start: " + e);
- e.printStackTrace();
+ e.printStackTrace(System.out);
}
}
@@ -465,7 +469,7 @@
((Lifecycle) server).stop();
} catch (LifecycleException e) {
System.err.println("Catalina.stop: " + e);
- e.printStackTrace();
+ e.printStackTrace(System.out);
}
}
@@ -484,7 +488,7 @@
mapper.readXml(file, this);
} catch (Exception e) {
System.err.println("Catalina.stop: " + e);
- e.printStackTrace();
+ e.printStackTrace(System.out);
System.exit(1);
}
@@ -500,7 +504,7 @@
socket.close();
} catch (IOException e) {
System.err.println("Catalina.stop: " + e);
- e.printStackTrace();
+ e.printStackTrace(System.out);
System.exit(1);
}
1.2 +6 -5 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/Constants.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Constants.java 2000/04/25 20:11:30 1.1
+++ Constants.java 2000/04/27 05:55:20 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/Constants.java,v 1.1 2000/04/25 20:11:30 craigmcc Exp $
- * $Revision: 1.1 $
- * $Date: 2000/04/25 20:11:30 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/Constants.java,v 1.2 2000/04/27 05:55:20 craigmcc Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/04/27 05:55:20 $
*
* ====================================================================
*
@@ -69,13 +69,14 @@
* String constants for the startup package.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.1 $ $Date: 2000/04/25 20:11:30 $
+ * @version $Revision: 1.2 $ $Date: 2000/04/27 05:55:20 $
*/
public final class Constants {
public static final String Package = "org.apache.tomcat.startup";
- public static final String WebXmlResource = "/WEB-INF/web.xml";
+ public static final String ApplicationWebXml = "/WEB-INF/web.xml";
+ public static final String DefaultWebXml = "conf/web.xml";
}
1.3 +97 -36 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/ContextConfig.java
Index: ContextConfig.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/ContextConfig.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ContextConfig.java 2000/04/26 01:04:00 1.2
+++ ContextConfig.java 2000/04/27 05:55:20 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/ContextConfig.java,v 1.2 2000/04/26 01:04:00 craigmcc Exp $
- * $Revision: 1.2 $
- * $Date: 2000/04/26 01:04:00 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/ContextConfig.java,v 1.3 2000/04/27 05:55:20 craigmcc Exp $
+ * $Revision: 1.3 $
+ * $Date: 2000/04/27 05:55:20 $
*
* ====================================================================
*
@@ -65,7 +65,11 @@
package org.apache.tomcat.startup;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.InputStream;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
import org.apache.tomcat.Context;
import org.apache.tomcat.Lifecycle;
import org.apache.tomcat.LifecycleEvent;
@@ -74,6 +78,7 @@
import org.apache.tomcat.Resources;
import org.apache.tomcat.Wrapper;
import org.apache.tomcat.resources.StandardResources;
+import org.apache.tomcat.session.StandardManager;
import org.apache.tomcat.util.StringManager;
import org.apache.tomcat.util.xml.SaxContext;
import org.apache.tomcat.util.xml.XmlAction;
@@ -86,7 +91,7 @@
* resource for this web application.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.2 $ $Date: 2000/04/26 01:04:00 $
+ * @version $Revision: 1.3 $ $Date: 2000/04/27 05:55:20 $
*/
public final class ContextConfig
@@ -171,6 +176,43 @@
/**
+ * Process the application configuration file, if it exists.
+ *
+ * @param mapper The XmlMapper to be used
+ */
+ private void applicationConfig(XmlMapper mapper) {
+
+ // Open the application web.xml file, if it exists
+ InputStream stream = null;
+ Resources resources = context.getResources();
+ if (resources != null)
+ stream =
+ resources.getResourceAsStream(Constants.ApplicationWebXml);
+ if (stream == null) {
+ log(sm.getString("contextConfig.applicationMissing"));
+ return;
+ }
+
+ // Process the application web.xml file
+ try {
+ mapper.readXml(stream, context);
+ } catch (InvocationTargetException e) {
+ log(sm.getString("contextConfig.applicationConfig"),
+ e.getTargetException());
+ } catch (Exception e) {
+ log(sm.getString("contextConfig.applicationParse"), e);
+ } finally {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ log(sm.getString("contextConfig.applicationClose"), e);
+ }
+ }
+
+ }
+
+
+ /**
* Create and return an XmlMapper configured to process the web application
* deployment descriptor (web.xml).
*/
@@ -248,10 +290,8 @@
mapper.addRule("web-app/servlet",
mapper.objectCreate(context.getWrapperClass()));
mapper.addRule("web-app/servlet",
- mapper.setParent("setParent"));
- mapper.addRule("web-app/servlet",
mapper.addChild("addChild",
- "org.apache.tomcat.Wrapper"));
+ "org.apache.tomcat.Container"));
mapper.addRule("web-app/servlet/init-param",
mapper.methodSetter("addInitParameter", 2));
mapper.addRule("web-app/servlet/init-param/param-name",
@@ -302,6 +342,42 @@
/**
+ * Process the default configuration file, if it exists.
+ *
+ * @param mapper The XmlMapper to be used
+
+ */
+ private void defaultConfig(XmlMapper mapper) {
+
+ // Open the default web.xml file, if it exists
+ FileInputStream stream = null;
+ try {
+ stream = new FileInputStream(Constants.DefaultWebXml);
+ } catch (FileNotFoundException e) {
+ log(sm.getString("context.Config.defaultMissing"));
+ return;
+ }
+
+ // Process the default web.xml file
+ try {
+ mapper.readXml(stream, context);
+ } catch (InvocationTargetException e) {
+ log(sm.getString("contextConfig.defaultConfig"),
+ e.getTargetException());
+ } catch (Exception e) {
+ log(sm.getString("contextConfig.defaultParse"), e);
+ } finally {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ log(sm.getString("contextConfig.defaultClose"), e);
+ }
+ }
+
+ }
+
+
+ /**
* Log a message on the Logger associated with our Context (if any)
*
* @param message Message to be logged
@@ -352,41 +428,26 @@
if (debug > 0)
log(sm.getString("contextConfig.start"));
+ // Configure a mapper to read a web application deployment descriptor
+ XmlMapper mapper = createMapper();
+
+ // Add missing Manager component if necessary
+ if (context.getManager() == null) {
+ if (debug > 0)
+ log(sm.getString("contextConfig.defaultManager"));
+ context.setManager(new StandardManager());
+ }
+
// Add missing Resources component if necessary
if (context.getResources() == null) {
if (debug > 0)
log(sm.getString("contextConfig.defaultResources"));
- Resources resources = new StandardResources();
- context.setResources(resources);
+ context.setResources(new StandardResources());
}
- // Add missing Manager component if necessary
- ; // FIXME - missing Manager component
-
- // Configure a mapper to read a web application deployment descriptor
- XmlMapper mapper = createMapper();
-
- // Process the "default" web.xml settings first
- ; // FIXME - process "default" web.xml settings
-
- // Process the deployment descriptor for this app second
- Resources resources = context.getResources();
- if (resources == null) {
- log(sm.getString("contextConfig.resources"));
- return;
- }
- InputStream stream =
- resources.getResourceAsStream(Constants.WebXmlResource);
- if (stream == null) {
- log(sm.getString("contextConfig.descriptor"));
- return;
- }
- try {
- mapper.readXml(stream, context);
- } catch (Exception e) {
- log(sm.getString("contextConfig.parserApplication"));
- return;
- }
+ // Process the default and application web.xml files
+ defaultConfig(mapper);
+ applicationConfig(mapper);
}
1.3 +9 -5 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/LocalStrings.properties
Index: LocalStrings.properties
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/LocalStrings.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LocalStrings.properties 2000/04/26 01:04:01 1.2
+++ LocalStrings.properties 2000/04/27 05:55:20 1.3
@@ -1,9 +1,13 @@
+contextConfig.applicationClose=Error closing application web.xml
+contextConfig.applicationConfig=Configuration error in application web.xml
+contextConfig.applicationMissing=Missing application web.xml, using defaults only
+contextConfig.applicationParse=Parse error in application web.xml
contextConfig.cce=Lifecycle event data object {0} is not a Context
-contextConfig.default=Parse error processing default web.xml
+contextConfig.defaultClose=Error closing default web.xml
+contextConfig.defaultConfig=Configuration error in default web.xml
+contextConfig.defaultManager=Configuring default Manager
+contextConfig.defaultMissing=Missing default web.xml, using application web.xml only
+contextConfig.defaultParse=Parse error in default web.xml
contextConfig.defaultResources=Configuring default Resources
-contextConfig.descriptor=No application web.xml, using default web.xml only
-contextConfig.parserApplication=Parse error processing application web.xml
-contextConfig.parserDefault=Parse error processing default web.xml
-contextConfig.resources=No resources available, using default web.xml only
contextConfig.start=ContextConfig: Processing START
contextConfig.stop=ContextConfig: Processing STOP