Move container, jasper and servletapi tags
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc5.5.x/tags/TOMCAT_5_5_1@802198 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/container/.cvsignore b/container/.cvsignore
new file mode 100644
index 0000000..9d0b71a
--- /dev/null
+++ b/container/.cvsignore
@@ -0,0 +1,2 @@
+build
+dist
diff --git a/container/LICENSE b/container/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/container/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/container/NOTICE b/container/NOTICE
new file mode 100644
index 0000000..3f59805
--- /dev/null
+++ b/container/NOTICE
@@ -0,0 +1,2 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
diff --git a/container/build.xml b/container/build.xml
new file mode 100644
index 0000000..b39d54d
--- /dev/null
+++ b/container/build.xml
@@ -0,0 +1,188 @@
+<project name="Catalina 2.0" default="deploy" basedir=".">
+
+
+ <!-- ===================== Initialize Property Values =================== -->
+
+ <!-- See "build.properties.sample" in the top level directory for all -->
+ <!-- property values you must customize for successful building!!! -->
+ <!--property file="build.properties"/>
+ <property file="${user.home}/build.properties"/-->
+
+ <!-- Build Defaults -->
+ <!--property name="catalina.build" value="${basedir}/catalina/build"/-->
+
+ <!-- Source dependencies -->
+ <property name="api.home"
+ value="${basedir}/../jakarta-servletapi-5"/>
+ <property name="jtc.home"
+ value="${basedir}/../jakarta-tomcat-connectors"/>
+
+
+ <!-- =================== DETECT: Display configuration ================== -->
+ <target name="flags.display"
+ description="Display configuration and conditional compilation flags">
+
+ <ant dir="${basedir}/catalina" target="flags.display"/>
+ <ant dir="${basedir}/webapps/admin" target="flags.display"/>
+
+ </target>
+
+
+ <!-- ===================== DEPLOY: Create Directories =================== -->
+ <target name="deploy-prepare">
+ <mkdir dir="${tomcat.build}"/>
+ </target>
+
+
+ <!-- ====================== DEPLOY: Copy Static Files =================== -->
+ <target name="deploy-static" depends="deploy-prepare"/>
+
+
+ <!-- ====================== DEPLOY: Deploy Components =================== -->
+ <target name="deploy" depends="deploy-static"
+ description="Build and deploy all components">
+ <echo>Target: Catalina - Deploy ...</echo>
+ <ant dir="${basedir}/catalina" target="deploy"/>
+ <echo>Target: Webapps - Deploy ...</echo>
+ <ant dir="${basedir}/webapps" target="deploy"/>
+ </target>
+
+ <!-- ====================== DEPLOY: Deploy Core Components =================== -->
+ <!-- used by gump to build just catalina and not the j-t-connectors -->
+ <target name="deploy-catalina" depends="deploy-static"
+ description="Build and deploy all components">
+ <echo>Target: Catalina - Deploy ...</echo>
+ <ant dir="${basedir}/catalina" target="deploy-catalina"/>
+ <echo>Target: Webapps - Deploy ...</echo>
+ <ant dir="${basedir}/webapps" target="deploy"/>
+ </target>
+
+
+ <!-- ====================== COMBO: Clean All Directories ================ -->
+ <target name="clean"
+ description="Clean all components">
+ <delete dir="${tomcat.build}"/>
+ <echo>Target: Catalina - Clean ...</echo>
+ <ant dir="${basedir}/catalina" target="clean"/>
+ <echo>Target: Webapps - Clean ...</echo>
+ <ant dir="${basedir}/webapps" target="clean"/>
+ <delete dir="${tomcat.dist}"/>
+ </target>
+
+
+ <!-- ======================= COMBO: Build All Components ================ -->
+ <target name="all"
+ description="Clean, build, and deploy all components">
+ <echo>Target: Catalina - All ...</echo>
+ <ant dir="${basedir}/catalina" target="all"/>
+ <echo>Target: Webapps - All ...</echo>
+ <ant dir="${basedir}/webapps" target="all"/>
+ </target>
+
+
+ <!-- ======================= COMBO: Test All Components ================= -->
+ <target name="test"
+ description="Unit tests on all components">
+ <echo>Target: Catalina - Test ...</echo>
+ <ant dir="${basedir}/catalina" target="test"/>
+ <echo>Target: Webapps - Test ...</echo>
+ <ant dir="${basedir}/webapps" target="test"/>
+ </target>
+
+
+ <!-- ====================== DIST: Create Directories ==================== -->
+ <target name="dist-prepare">
+ <mkdir dir="${tomcat.dist}"/>
+ <mkdir dir="${tomcat.dist}/bin"/>
+ <mkdir dir="${tomcat.dist}/common"/>
+ <mkdir dir="${tomcat.dist}/common/classes"/>
+ <mkdir dir="${tomcat.dist}/common/endorsed"/>
+ <mkdir dir="${tomcat.dist}/common/lib"/>
+ <mkdir dir="${tomcat.dist}/conf"/>
+ <mkdir dir="${tomcat.dist}/logs"/>
+ <mkdir dir="${tomcat.dist}/server"/>
+ <mkdir dir="${tomcat.dist}/server/classes"/>
+ <mkdir dir="${tomcat.dist}/server/lib"/>
+ <mkdir dir="${tomcat.dist}/shared/classes"/>
+ <mkdir dir="${tomcat.dist}/shared/lib"/>
+ <mkdir dir="${tomcat.dist}/webapps"/>
+ <mkdir dir="${tomcat.dist}/work"/>
+ <mkdir dir="${tomcat.dist}/temp"/>
+ </target>
+
+
+ <!-- ====================== DIST: Copy Static Files ===================== -->
+ <target name="dist-static" depends="dist-prepare">
+
+ <!-- Copy the top-level documentation files -->
+ <copy todir="${tomcat.dist}">
+ <fileset dir=".">
+ <include name="LICENSE"/>
+ <include name="INSTALLING.txt"/>
+ <include name="BUILDING.txt"/>
+ <include name="README.txt"/>
+ <include name="RELEASE*"/>
+ <include name="RUNNING.txt"/>
+ </fileset>
+ </copy>
+
+ <!-- Copy the contents of each "build" directory -->
+ <copy todir="${tomcat.dist}/bin">
+ <fileset dir="${tomcat.build}/bin" />
+ </copy>
+ <copy todir="${tomcat.dist}/common/classes">
+ <fileset dir="${tomcat.build}/common/classes" />
+ </copy>
+ <copy todir="${tomcat.dist}/common/endorsed">
+ <fileset dir="${tomcat.build}/common/endorsed" />
+ </copy>
+ <copy todir="${tomcat.dist}/common/lib">
+ <fileset dir="${tomcat.build}/common/lib" />
+ </copy>
+ <copy todir="${tomcat.dist}/conf">
+ <fileset dir="${tomcat.build}/conf" />
+ </copy>
+ <copy todir="${tomcat.dist}/server/classes">
+ <fileset dir="${tomcat.build}/server/classes" />
+ </copy>
+ <copy todir="${tomcat.dist}/server/lib">
+ <fileset dir="${tomcat.build}/server/lib" />
+ </copy>
+ <copy todir="${tomcat.dist}/server/webapps">
+ <fileset dir="${tomcat.build}/server/webapps" />
+ </copy>
+ <copy todir="${tomcat.dist}/shared/classes">
+ <fileset dir="${tomcat.build}/shared/classes" />
+ </copy>
+ <copy todir="${tomcat.dist}/shared/lib">
+ <fileset dir="${tomcat.build}/shared/lib" />
+ </copy>
+ <copy todir="${tomcat.dist}/webapps">
+ <fileset dir="${tomcat.build}/webapps" />
+ </copy>
+
+ <!-- Correct permissions and line endings on "bin" scripts -->
+ <fixcrlf srcdir="${tomcat.dist}/bin" includes="*.sh" eol="lf"/>
+ <fixcrlf srcdir="${tomcat.dist}/bin" includes="*.bat" eol="crlf"/>
+ <chmod dir="${tomcat.dist}/bin" includes="*.sh" perm="+x"/>
+
+ </target>
+
+
+ <!-- ====================== DIST: Create Javadoc ======================== -->
+ <target name="dist-javadoc">
+ <ant dir="${basedir}/catalina" target="javadoc"/>
+ <mkdir dir="${tomcat.dist}/webapps/tomcat-docs/catalina/docs/api"/>
+ <copy todir="${tomcat.dist}/webapps/tomcat-docs/catalina/docs/api">
+ <fileset dir="${catalina.build}/javadoc" />
+ </copy>
+ </target>
+
+
+ <!-- ====================== DIST: Create Archives ======================= -->
+ <target name="dist" depends="deploy,dist-static,dist-javadoc"
+ description="Create binary distribution">
+ </target>
+
+
+</project>
diff --git a/container/catalina/.cvsignore b/container/catalina/.cvsignore
new file mode 100644
index 0000000..9d0b71a
--- /dev/null
+++ b/container/catalina/.cvsignore
@@ -0,0 +1,2 @@
+build
+dist
diff --git a/container/catalina/build.xml b/container/catalina/build.xml
new file mode 100644
index 0000000..4187ce9
--- /dev/null
+++ b/container/catalina/build.xml
@@ -0,0 +1,1191 @@
+<project name="Catalina" default="deploy" basedir=".">
+
+
+ <!-- ===================== Initialize Property Values =================== -->
+
+ <!-- See "build.properties.sample" in the top level directory for all -->
+ <!-- property values you must customize for successful building!!! -->
+ <!--property file="build.properties"/>
+ <property file="../build.properties"/>
+ <property file="${user.home}/build.properties"/-->
+
+ <!-- Build Defaults -->
+ <property name="catalina.home" location=".."/>
+ <property name="catalina.build" value="${catalina.home}/catalina/build"/>
+ <property name="classes.dir" value="${catalina.build}/server/classes" />
+ <property name="catalina.deploy" value="${catalina.home}/build"/>
+ <property name="catalina.dist" value="${catalina.home}/dist"/>
+ <property name="test.failonerror" value="true"/>
+ <property name="test.runner" value="junit.textui.TestRunner"/>
+ <property name="test.webapp" value="../webapps/build/ROOT"/>
+ <property name="test.webapp.war" value="${java.io.tmpdir}/webapp.war"/>
+
+ <!-- Source dependencies -->
+ <property name="tomcat-util.home" value="${jtc.home}/util"/>
+ <property name="tomcat-coyote.home" value="${jtc.home}/coyote"/>
+ <property name="tomcat-jk.home" value="${jtc.home}/jk"/>
+ <property name="tomcat-http11.home" value="${jtc.home}/http11"/>
+
+ <!-- Dependent JARs and files -->
+ <property name="ant.jar" value="${ant.home}/lib/ant.jar"/>
+ <property name="servlet-api.jar" value="${api.home}/jsr154/dist/lib/servlet-api.jar"/>
+ <property name="tomcat-util.jar"
+ value="${tomcat-util.home}/build/lib/tomcat-util.jar"/>
+ <property name="tomcat-coyote.jar"
+ value="${tomcat-coyote.home}/build/lib/tomcat-coyote.jar"/>
+ <property name="tomcat-jk2.jar"
+ value="${tomcat-jk.home}/build/lib/tomcat-jk2.jar"/>
+ <property name="tomcat-jni.jar"
+ value="${tomcat-jk.home}/build/lib/tomcat-jni.jar"/>
+ <property name="jk2.properties"
+ value="${tomcat-jk.home}/build/conf/jk2.properties"/>
+ <property name="tomcat-http11.jar"
+ value="${tomcat-http11.home}/build/lib/tomcat-http11.jar"/>
+ <property name="tomcat-dbcp.jar"
+ value="${base.path}/tomcat-deps/naming-factory-dbcp.jar"/>
+ <!-- Construct Catalina classpath -->
+ <path id="catalina.classpath">
+ <pathelement location="${activation.jar}"/>
+ <pathelement location="${ant.jar}"/>
+ <pathelement location="${commons-beanutils.jar}"/>
+ <pathelement location="${commons-collections.jar}"/>
+ <pathelement location="${tomcat-dbcp.jar}"/>
+ <pathelement location="${commons-digester.jar}"/>
+ <pathelement location="${commons-fileupload.jar}"/>
+ <pathelement location="${commons-launcher.jar}"/>
+ <pathelement location="${commons-logging.jar}"/>
+ <pathelement location="${commons-modeler.jar}"/>
+ <pathelement location="${tomcat-util.jar}"/>
+ <pathelement location="${tomcat-coyote.jar}"/>
+ <pathelement location="${jaas.jar}"/>
+ <pathelement location="${javagroups.jar}"/>
+ <pathelement location="${jcert.jar}"/>
+ <pathelement location="${jdbc20ext.jar}"/>
+ <pathelement location="${jmx.jar}"/>
+ <pathelement location="${jndi.jar}"/>
+ <pathelement location="${jnet.jar}"/>
+ <pathelement location="${jsse.jar}"/>
+ <pathelement location="${java.home}/lib/jsse.jar"/>
+ <pathelement location="${jta.jar}"/>
+ <pathelement location="${ldap.jar}"/>
+ <pathelement location="${mail.jar}"/>
+ <pathelement location="${regexp.jar}"/>
+ <pathelement location="${servlet-api.jar}"/>
+ <pathelement location="${xercesImpl.jar}"/>
+ <pathelement location="${xml-apis.jar}"/>
+ <pathelement location="${classes.dir}"/>
+ </path>
+
+ <!-- Construct unit tests classpath -->
+ <path id="test.classpath">
+ <pathelement location="${junit.jar}"/>
+ <pathelement location="${activation.jar}"/>
+ <pathelement location="${ant.jar}"/>
+ <pathelement location="${commons-beanutils.jar}"/>
+ <pathelement location="${commons-collections.jar}"/>
+ <pathelement location="${tomcat-dbcp.jar}"/>
+ <pathelement location="${commons-digester.jar}"/>
+ <pathelement location="${commons-fileupload.jar}"/>
+ <pathelement location="${commons-launcher.jar}"/>
+ <pathelement location="${commons-logging.jar}"/>
+ <pathelement location="${commons-modeler.jar}"/>
+ <pathelement location="${jaas.jar}"/>
+ <pathelement location="${jcert.jar}"/>
+ <pathelement location="${jdbc20ext.jar}"/>
+ <pathelement location="${jmx.jar}"/>
+ <pathelement location="${jndi.jar}"/>
+ <pathelement location="${jnet.jar}"/>
+ <pathelement location="${jsse.jar}"/>
+ <pathelement location="${jta.jar}"/>
+ <pathelement location="${ldap.jar}"/>
+ <pathelement location="${mail.jar}"/>
+ <pathelement location="${regexp.jar}"/>
+ <pathelement location="${servlet-api.jar}"/>
+ <pathelement location="${xercesImpl.jar}"/>
+ <pathelement location="${xml-apis.jar}"/>
+ <pathelement location="${classes.dir}"/>
+ <pathelement location="${catalina.build}/tests"/>
+ </path>
+
+ <!-- Source path -->
+ <path id="javadoc.sourcepath">
+ <pathelement location="src/share"/>
+ <pathelement location="${tomcat-util.home}/java"/>
+ <pathelement location="${tomcat-coyote.home}/src/java"/>
+ <pathelement location="${tomcat-jk.home}/java"/>
+ <pathelement location="${tomcat-http11.home}/src/java"/>
+ </path>
+
+
+ <!-- =================== BUILD: Set compile flags ======================= -->
+ <target name="flags">
+
+ <!-- JDK flags -->
+ <available property="jdk.1.2.present" classname="java.util.HashMap" />
+ <available property="jdk.1.3.present"
+ classname="java.lang.reflect.Proxy" />
+ <available property="jdk.1.4.present" classname="java.nio.Buffer" />
+
+ <!-- Ant flags -->
+ <available property="style.available"
+ classname="org.apache.tools.ant.taskdefs.optional.TraXLiaison" />
+
+ <!-- Source path -->
+ <available property="jtc.home.present" file="${jtc.home}" />
+
+ <!-- Class availability flags -->
+ <available property="beanutils.present"
+ classname="org.apache.commons.beanutils.BeanUtils"
+ classpath="${commons-beanutils.jar}"/>
+ <available property="collections.present"
+ classname="org.apache.commons.collections.FastHashMap"
+ classpath="${commons-collections.jar}"/>
+ <available property="dbcp.present"
+ classname="org.apache.tomcat.dbcp.dbcp.ConnectionFactory"
+ classpath="${tomcat-dbcp.jar}"/>
+ <available property="digester.present"
+ classname="org.apache.commons.digester.Digester"
+ classpath="${commons-digester.jar}"/>
+ <available property="fileupload.present"
+ classname="org.apache.commons.fileupload.FileUpload"
+ classpath="${commons-fileupload.jar}"/>
+ <available property="launcher.present"
+ classname="org.apache.commons.launcher.Launcher"
+ classpath="${commons-launcher.jar}"/>
+ <available property="launcher.bootstrap.present"
+ file="${commons-launcher.bootstrap.class}"/>
+ <available property="logging.present"
+ classname="org.apache.commons.logging.Log"
+ classpath="${commons-logging.jar}"/>
+ <available property="modeler.present"
+ classname="org.apache.commons.modeler.Registry"
+ classpath="${commons-modeler.jar}:${jmx.jar}"/>
+ <available property="jaas.present"
+ classname="javax.security.auth.Subject"
+ classpath="${jaas.jar}" />
+ <condition property="jaxp.present">
+ <and>
+ <available classname="javax.xml.parsers.SAXParser"
+ classpath="${xml-apis.jar}" />
+ <available classname="org.xml.sax.ContentHandler"
+ classpath="${xml-apis.jar}" />
+ </and>
+ </condition>
+ <condition property="javamail.present">
+ <and>
+ <available classname="javax.activation.DataSource"
+ classpath="${activation.jar}" />
+ <available classname="javax.mail.Service"
+ classpath="${mail.jar}" />
+ </and>
+ </condition>
+ <available property="jmx.present"
+ classname="javax.management.MBeanServer"
+ classpath="${jmx.jar}" />
+ <available property="jndi.present"
+ classname="javax.naming.Context"
+ classpath="${jndi.jar}" />
+ <condition property="jsse.present">
+ <and>
+ <available classname="javax.security.cert.Certificate"
+ classpath="${jcert.jar}" />
+ <available classname="javax.net.SocketFactory"
+ classpath="${jnet.jar}" />
+ <available classname="javax.net.ssl.SSLSocket"
+ classpath="${jsse.jar}" />
+ </and>
+ </condition>
+ <condition property="jta.present">
+ <and>
+ <available classname="javax.sql.XADataSource"
+ classpath="${jdbc20ext.jar}" />
+ <available classname="javax.transaction.UserTransaction"
+ classpath="${jta.jar}" />
+ </and>
+ </condition>
+ <available property="junit.present"
+ classname="junit.framework.TestCase"
+ classpath="${junit.jar}" />
+ <available property="ldap.present"
+ classname="com.sun.jndi.ldap.LdapClient"
+ classpath="${ldap.jar}" />
+ <available property="pool.present"
+ classname="org.apache.tomcat.dbcp.pool.ObjectPool"
+ classpath="${tomcat-dbcp.jar}"/>
+ <available property="regexp.present"
+ classname="org.apache.regexp.RE"
+ classpath="${regexp.jar}" />
+ <available property="xerces.present"
+ classname="org.apache.xerces.parsers.SAXParser"
+ classpath="${xercesImpl.jar}" />
+
+ <!-- JAR files availability flags -->
+ <available property="dbcp.jar.present" file="${tomcat-dbcp.jar}" />
+ <available property="fileupload.jar.present" file="${commons-fileupload.jar}" />
+ <available property="jaas.jar.present" file="${jaas.jar}" />
+ <condition property="javamail.jar.present">
+ <and>
+ <available file="${activation.jar}" />
+ <available file="${mail.jar}" />
+ </and>
+ </condition>
+ <available property="jdbc20ext.jar.present" file="${jdbc20ext.jar}" />
+ <available property="jmx.jar.present" file="${jmx.jar}" />
+ <available property="jcert.jar.present" file="${jcert.jar}" />
+ <available property="jndi.jar.present" file="${jndi.jar}" />
+ <available property="jnet.jar.present" file="${jnet.jar}" />
+ <available property="jsse.jar.present" file="${jsse.jar}" />
+ <available property="jta.jar.present" file="${jta.jar}" />
+ <available property="junit.jar.present" file="${junit.jar}" />
+ <condition property="launcher.jars.present">
+ <and>
+ <equals arg1="${launcher.present}" arg2="true"/>
+ <equals arg1="${launcher.bootstrap.present}" arg2="true"/>
+ </and>
+ </condition>
+ <available property="ldap.jar.present" file="${ldap.jar}" />
+ <available property="logging.jar.present" file="${commons-logging.jar}" />
+ <available property="modeler.jar.present" file="${commons-modeler.jar}" />
+ <available property="pool.jar.present" file="${tomcat-dbcp.jar}" />
+ <available property="regexp.jar.present" file="${regexp.jar}" />
+ <available property="servlet-api.jar.present" file="${servlet-api.jar}" />
+ <available property="tomcat-util.jar.present" file="${tomcat-util.jar}" />
+ <available property="xercesImpl.jar.present" file="${xercesImpl.jar}"/>
+ <available property="xml-apis.jar.present" file="${xml-apis.jar}"/>
+ <condition property="xerces2.jars.present">
+ <and>
+ <equals arg1="${xercesImpl.jar.present}" arg2="true"/>
+ <equals arg1="${xml-apis.jar.present}" arg2="true"/>
+ </and>
+ </condition>
+
+ <!-- Conditional compilation flags (determined from the flags above) -->
+ <condition property="compile.dbcp">
+ <or>
+ <equals arg1="${full.dist}" arg2="on" />
+ <and>
+ <equals arg1="${dbcp.present}" arg2="true" />
+ <equals arg1="${pool.present}" arg2="true" />
+ </and>
+ </or>
+ </condition>
+ <condition property="compile.jaas">
+ <or>
+ <equals arg1="${full.dist}" arg2="on" />
+ <equals arg1="${jaas.present}" arg2="true" />
+ </or>
+ </condition>
+ <condition property="compile.javamail">
+ <or>
+ <equals arg1="${full.dist}" arg2="on" />
+ <equals arg1="${javamail.present}" arg2="true" />
+ </or>
+ </condition>
+ <condition property="compile.jmx">
+ <or>
+ <equals arg1="${full.dist}" arg2="on" />
+ <and>
+ <equals arg1="${jmx.present}" arg2="true" />
+ <equals arg1="${modeler.present}" arg2="true" />
+ </and>
+ </or>
+ </condition>
+ <condition property="compile.jndi">
+ <or>
+ <equals arg1="${full.dist}" arg2="on" />
+ <equals arg1="${jndi.present}" arg2="true" />
+ <equals arg1="${jdk.1.3.present}" arg2="true" />
+ </or>
+ </condition>
+ <condition property="compile.jsse">
+ <or>
+ <equals arg1="${full.dist}" arg2="on" />
+ <equals arg1="${jsse.present}" arg2="true" />
+ <equals arg1="${jdk.1.4.present}" arg2="true" />
+ </or>
+ </condition>
+ <condition property="compile.jta">
+ <or>
+ <equals arg1="${full.dist}" arg2="on" />
+ <equals arg1="${jta.present}" arg2="true" />
+ </or>
+ </condition>
+ <condition property="compile.junit">
+ <or>
+ <equals arg1="${full.dist}" arg2="on" />
+ <equals arg1="${junit.present}" arg2="true" />
+ </or>
+ </condition>
+ <condition property="compile.launcher">
+ <or>
+ <equals arg1="${full.dist}" arg2="on" />
+ <and>
+ <equals arg1="${launcher.present}" arg2="true" />
+ <equals arg1="${launcher.bootstrap.present}" arg2="true" />
+ </and>
+ </or>
+ </condition>
+ <condition property="compile.ldap">
+ <or>
+ <equals arg1="${full.dist}" arg2="on" />
+ <equals arg1="${ldap.present}" arg2="true" />
+ <equals arg1="${jdk.1.3.present}" arg2="true" />
+ </or>
+ </condition>
+ <property name="compile.ssi" value="true"/>
+
+
+ <!-- Conditional copy flags (determined from the flags above) -->
+ <condition property="copy.dbcp.jar">
+ <or>
+ <equals arg1="${full.dist}" arg2="on" />
+ <equals arg1="${dbcp.present}" arg2="true" />
+ </or>
+ </condition>
+ <condition property="copy.jmx.jar">
+ <or>
+ <equals arg1="${full.dist}" arg2="on" />
+ <equals arg1="${jmx.jar.present}" arg2="true" />
+ </or>
+ </condition>
+ <condition property="copy.lang.jar">
+ <or>
+ <equals arg1="${full.dist}" arg2="on" />
+ <equals arg1="${lang.present}" arg2="true" />
+ </or>
+ </condition>
+ <condition property="copy.launcher.jars">
+ <or>
+ <equals arg1="${full.dist}" arg2="on" />
+ <equals arg1="${launcher.jars.present}" arg2="true" />
+ </or>
+ </condition>
+ <condition property="copy.modeler.jar">
+ <or>
+ <equals arg1="${full.dist}" arg2="on" />
+ <equals arg1="${modeler.present}" arg2="true" />
+ </or>
+ </condition>
+ <condition property="copy.logging.jar">
+ <or>
+ <equals arg1="${full.dist}" arg2="on" />
+ <equals arg1="${logging.present}" arg2="true" />
+ </or>
+ </condition>
+ <condition property="copy.pool.jar">
+ <or>
+ <equals arg1="${full.dist}" arg2="on" />
+ <equals arg1="${pool.present}" arg2="true" />
+ </or>
+ </condition>
+
+ </target>
+
+
+ <!-- =================== BUILD: Set compile flags ======================= -->
+ <target name="flags.display" depends="flags" unless="flags.hide">
+
+ <echo message="--- Build environment for Catalina ---" />
+
+ <echo message="If ${property_name} is displayed, then the property is not set)" />
+
+ <echo message="--- Build options ---" />
+ <echo message="full.dist=${full.dist}" />
+ <echo message="build.sysclasspath=${build.sysclasspath}" />
+ <echo message="compile.debug=${compile.debug}" />
+ <echo message="compile.deprecation=${compile.deprecation}" />
+ <echo message="compile.optimize=${compile.optimize}" />
+
+ <echo message="--- Ant Flags ---" />
+ <echo message="<style> task available (required)=${style.available}" />
+
+ <echo message="--- JDK ---" />
+ <echo message="jdk.1.2.present=${jdk.1.2.present}" />
+ <echo message="jdk.1.3.present=${jdk.1.3.present}" />
+ <echo message="jdk.1.4.present=${jdk.1.4.present}" />
+
+ <echo message="--- Source Dependencies ---" />
+ <echo message="jtc.home.present=${jtc.home.present}" />
+
+ <echo message="--- Required Libraries ---" />
+ <echo message="beanutils.present=${beanutils.present}" />
+ <echo message="collections.present=${collections.present}" />
+ <echo message="digester.present=${digester.present}" />
+ <echo message="jaxp.present=${jaxp.present}" />
+ <echo message="jndi.present=${jndi.present}" />
+ <echo message="logging.present=${logging.present}" />
+ <echo message="regexp.present=${regexp.present}" />
+
+ <echo message="--- Optional Libraries ---" />
+ <echo message="dbcp.present=${dbcp.present}" />
+ <echo message="fileupload.present=${fileupload.present}" />
+ <echo message="jaas.present=${jaas.present}" />
+ <echo message="javamail.present=${javamail.present}" />
+ <echo message="jmx.present=${jmx.present}" />
+ <echo message="jsse.present=${jsse.present}" />
+ <echo message="jta.present=${jta.present}" />
+ <echo message="junit.present=${junit.present}" />
+ <echo message="lang.present=${lang.present}" />
+ <echo message="launcher.present=${launcher.present}" />
+ <echo message="launcher.bootstrap.present=${launcher.bootstrap.present}" />
+ <echo message="ldap.present=${ldap.present}" />
+ <echo message="modeler.present=${modeler.present}" />
+ <echo message="pool.present=${pool.present}" />
+
+ <echo message="--- Required JARs ---" />
+ <echo message="jndi.jar.present(except JDK 1.3+)=${jndi.jar.present}" />
+ <echo message="regexp.jar.present=${regexp.jar.present}" />
+ <echo message="servlet-api.jar.present=${servlet-api.jar.present}" />
+ <echo message="xerces2.jars.present(except JDK 1.4+)=${xerces2.jars.present}" />
+
+ <echo message="--- Optional JARs ---" />
+ <echo message="dbcp.jar.present=${dbcp.jar.present}" />
+ <echo message="fileupload.jar.present=${fileupload.jar.present}" />
+ <echo message="jaas.jar.present=${jaas.jar.present}" />
+ <echo message="javamail.jar.present=${javamail.jar.present}" />
+ <echo message="jdbc20ext.jar.present=${jdbc20ext.jar.present}" />
+ <echo message="jmx.jar.present=${jmx.jar.present}" />
+ <echo message="jta.jar.present=${jta.jar.present}" />
+ <echo message="junit.jar.present=${junit.jar.present}" />
+ <echo message="modeler.jar.present=${modeler.jar.present}" />
+ <echo message="pool.jar.present=${pool.jar.present}" />
+
+ <echo message="--- Conditional compilation flags ---" />
+ <echo message="compile.dbcp=${compile.dbcp}" />
+ <echo message="compile.jaas=${compile.jaas}" />
+ <echo message="compile.javamail=${compile.javamail}" />
+ <echo message="compile.jmx=${compile.jmx}" />
+ <echo message="compile.jndi=${compile.jndi}" />
+ <echo message="compile.jsse=${compile.jsse}" />
+ <echo message="compile.jta=${compile.jta}" />
+ <echo message="compile.junit=${compile.junit}" />
+ <echo message="compile.ldap=${compile.ldap}" />
+ <echo message="compile.ssi=${compile.ssi}" />
+
+ <echo message="--- Distribution flags ---" />
+ <echo message="copy.dbcp.jar=${copy.dbcp.jar}" />
+ <echo message="copy.jmx.jar=${copy.jmx.jar}" />
+ <echo message="copy.launcher.jars=${copy.launcher.jars}" />
+ <echo message="copy.logging.jar=${copy.logging.jar}" />
+ <echo message="copy.modeler.jar=${copy.modeler.jar}" />
+ <echo message="copy.pool.jar=${copy.pool.jar}" />
+
+ </target>
+
+ <!-- =================== BUILD: Create Directories ====================== -->
+ <target name="build-prepare">
+
+ <mkdir dir="${catalina.build}"/>
+ <mkdir dir="${catalina.build}/bin"/>
+ <mkdir dir="${catalina.build}/common/classes"/>
+ <mkdir dir="${catalina.build}/common/lib"/>
+ <mkdir dir="${catalina.build}/common/endorsed"/>
+ <mkdir dir="${catalina.build}/conf"/>
+ <mkdir dir="${catalina.build}/logs"/>
+ <mkdir dir="${classes.dir}"/>
+ <mkdir dir="${catalina.build}/server/lib"/>
+ <mkdir dir="${catalina.build}/shared/classes"/>
+ <mkdir dir="${catalina.build}/shared/lib"/>
+ <mkdir dir="${catalina.build}/work"/>
+ <mkdir dir="${catalina.build}/temp"/>
+
+ </target>
+
+
+ <!-- ======================== BUILD: Copy JARs ========================== -->
+ <target name="copy-dbcp.jar" if="copy.dbcp.jar">
+ <copy todir="${catalina.build}/common/lib" file="${commons-dbcp.jar}"/>
+ </target>
+ <target name="copy-fileupload.jar" if="fileupload.jar.present">
+ </target>
+ <target name="copy-jmx.jar" if="copy.jmx.jar">
+ <copy tofile="${catalina.build}/bin/jmx.jar" file="${jmx.jar}"/>
+ </target>
+ <target name="copy-launcher.jars" if="copy.launcher.jars">
+ <!-- <copy todir="${catalina.build}/common/lib" file="${ant.jar}"/> -->
+ <copy todir="${catalina.build}/bin" file="${commons-launcher.jar}"/>
+ <copy todir="${catalina.build}/bin" file="${commons-launcher.bootstrap.class}"/>
+ <copy todir="${catalina.build}/bin">
+ <fileset dir="src/bin" includes="*-using-launcher.*,launcher.properties,catalina.xml" />
+ </copy>
+ </target>
+ <target name="copy-modeler.jar" if="copy.modeler.jar">
+ <copy todir="${catalina.build}/server/lib" file="${commons-modeler.jar}"/>
+ </target>
+ <target name="copy-pool.jar" if="copy.pool.jar">
+ <copy todir="${catalina.build}/common/lib" file="${commons-pool.jar}"/>
+ </target>
+ <target name="copy-tomcat-util.jar">
+ <!--
+ <copy todir="${catalina.build}/server/lib" file="${tomcat-util.jar}"/>
+ -->
+ <jar jarfile="${tomcat-util.jar}"
+ index="true">
+ <fileset dir="${catalina.build}/classes">
+ <include name="org/apache/tomcat/util/**"/>
+ <!-- Javadoc and i18n exclusions -->
+ <exclude name="**/package.html" />
+ <exclude name="**/LocalStrings_*" />
+ </fileset>
+ </jar>
+ </target>
+ <target name="copy-xerces2.jars">
+ <copy todir="${catalina.build}/common/endorsed" file="${xercesImpl.jar}"/>
+ <copy todir="${catalina.build}/common/endorsed" file="${xml-apis.jar}"/>
+ </target>
+
+
+ <!-- =================== BUILD: Copy Static Files ======================= -->
+ <target name="build-static" depends="flags,flags.display,build-prepare,copy-fileupload.jar,copy-launcher.jars,copy-modeler.jar">
+
+ <!-- Executable Commands -->
+ <copy todir="${catalina.build}/bin">
+ <fileset dir="src/bin" excludes="*-using-launcher.*,launcher.properties,catalina.xml" />
+ </copy>
+ <fixcrlf srcdir="${catalina.build}/bin" includes="*.sh" eol="lf"/>
+ <fixcrlf srcdir="${catalina.build}/bin" includes="*.bat" eol="crlf"/>
+ <chmod perm="+x" dir="${catalina.build}/bin" includes="*.sh"/>
+
+ <!-- Common Extensions -->
+ <copy todir="${catalina.build}/bin"
+ file="${commons-logging-api.jar}"/>
+<!--
+ <copy todir="${catalina.build}/common/lib" file="${servlet-api.jar}"/>
+-->
+ <copy todir="${catalina.build}/common/lib"
+ file="${tomcat-dbcp.jar}" />
+
+ <!-- Configuration Files -->
+ <copy todir="${catalina.build}/conf">
+ <fileset dir="src/conf">
+ <exclude name="catalina.conf.xml" />
+ </fileset>
+ </copy>
+
+ <!-- JVM Temporary Directory README -->
+ <copy todir="${catalina.build}/temp"
+ file="src/temp/README.txt"/>
+
+ <!-- Catalina Server Libraries -->
+ <!--
+ <copy todir="${catalina.build}/server/lib" file="${regexp.jar}"/>
+ -->
+
+ </target>
+
+
+ <!-- =================== BUILD: Build tomcat-util ======================= -->
+ <target name="build-tomcat-util">
+
+ <ant dir="${tomcat-util.home}" target="build-main">
+ <property name="jmx.jar" value="${jmx.jar}" />
+ <property name="puretls.jar" value="${puretls.jar}" />
+ <property name="jsse.lib" value="${jsse.lib}" />
+ </ant>
+
+ <copy todir="${catalina.build}/server/lib"
+ file="${tomcat-util.jar}"/>
+
+ </target>
+
+
+ <!-- ================ BUILD: Compile Catalina Components ================ -->
+ <target name="build-catalina" depends="build-catalina-core,build-catalina-optional"/>
+
+ <target name="build-catalina-core">
+ <!-- Compile internal server components -->
+ <javac srcdir="src/share" destdir="${classes.dir}"
+ debug="${compile.debug}"
+ deprecation="${compile.deprecation}"
+ source="${compile.source}"
+ optimize="${compile.optimize}"
+ excludes="**/CVS/**">
+ <classpath refid="catalina.classpath" />
+
+ <exclude name="org/apache/catalina/util/ProcessHelper.java"
+ unless="jdk.1.3.present"/>
+ <exclude name="org/apache/catalina/valves/CertificatesValve.java"
+ unless="compile.jsse"/>
+
+ <exclude name="org/apache/catalina/servlets/CGIServlet.java" />
+ <exclude name="org/apache/catalina/servlets/HTMLManagerServlet.java" />
+ <exclude name="org/apache/naming/factory/DbcpDataSourceFactory.java" />
+ <exclude name="org/apache/catalina/ssi/**"/>
+ <exclude name="org/apache/catalina/cluster/**"/>
+ <exclude name="org/apache/naming/factory/MailSessionFactory.java"/>
+ <exclude name="org/apache/naming/factory/SendMailFactory.java"/>
+ <exclude name="org/apache/catalina/launcher/**"/>
+ </javac>
+
+ <!-- Copy static resource files -->
+ <filter token="VERSION" value="${version}"/>
+ <copy todir="${classes.dir}" filtering="true" encoding="ISO-8859-1">
+ <fileset dir="src/share">
+ <exclude name="**/*.java"/>
+ <exclude name="**/*.ser"/>
+ </fileset>
+ </copy>
+ <copy todir="${classes.dir}">
+ <fileset dir="src/share">
+ <include name="**/*.ser"/>
+ </fileset>
+ </copy>
+
+ </target>
+
+ <target name="build-catalina-optional" unless="build.tomcat.base">
+ <!-- Compile internal server components -->
+ <javac srcdir="src/share" destdir="${classes.dir}"
+ debug="${compile.debug}"
+ deprecation="${compile.deprecation}"
+ optimize="${compile.optimize}"
+ source="${compile.source}"
+ excludes="**/CVS/**">
+ <classpath refid="catalina.classpath" />
+ <exclude name="org/apache/naming/factory/MailSessionFactory.java"
+ unless="compile.javamail"/>
+ <exclude name="org/apache/naming/factory/SendMailFactory.java"
+ unless="compile.javamail"/>
+ <exclude name="org/apache/catalina/valves/CertificatesValve.java"
+ unless="compile.jsse"/>
+ </javac>
+
+ <!-- Copy static resource files -->
+ <filter token="VERSION" value="${version}"/>
+ <copy todir="${classes.dir}" filtering="true">
+ <fileset dir="src/share">
+ <exclude name="**/*.java"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <!-- ================== BUILD: Build tomcat-coyote ====================== -->
+ <target name="build-tomcat-coyote">
+
+ <ant dir="${tomcat-coyote.home}" target="compile">
+ <property name="catalina.home" value="${catalina.deploy}"/>
+ <property name="servlet.jar" value="${servlet-api.jar}"/>
+ <property name="commons-logging.jar" value="${commons-logging.jar}"/>
+ <property name="commons-modeler.jar" value="${commons-modeler.jar}"/>
+ <property name="jmx.jar" value="${jmx.jar}"/>
+ </ant>
+
+ <!--
+ <copy todir="${catalina.deploy}/server/lib"
+ file="${tomcat-coyote.jar}"/>
+ -->
+
+ </target>
+
+
+ <!-- ==================== BUILD: Build tomcat-jk ======================== -->
+ <target name="build-tomcat-jk">
+
+ <ant dir="${tomcat-jk.home}" target="build-main">
+ <property name="tomcat5.home" value="${catalina.deploy}"/>
+ <property name="commons-logging.jar" value="${commons-logging.jar}"/>
+ <property name="commons-modeler.jar" value="${commons-modeler.jar}"/>
+ <property name="jmx.jar" value="${jmx.jar}"/>
+ </ant>
+
+ <!--
+ <copy tofile="${catalina.deploy}/server/lib/tomcat-ajp.jar"
+ file="${tomcat-jk2.jar}"/>
+ -->
+ <copy todir="${catalina.deploy}/conf"
+ file="${jk2.properties}"/>
+
+ </target>
+
+
+ <!-- ============== BUILD: Build tomcat-coyote-http11 =================== -->
+ <target name="build-tomcat-http11">
+
+ <ant dir="${tomcat-http11.home}" target="compile">
+ <property name="commons-logging.jar" value="${commons-logging.jar}"/>
+ <property name="commons-modeler.jar" value="${commons-modeler.jar}"/>
+ <property name="jmx.jar" value="${jmx.jar}"/>
+ </ant>
+ <!--
+ <copy todir="${catalina.deploy}/server/lib"
+ file="${tomcat-http11.jar}"/>
+ -->
+
+ </target>
+
+
+ <!-- ================= BUILD: Compile All Server Components ============= -->
+ <target name="build-main" depends="build-static,build-tomcat-util,build-catalina">
+ </target>
+
+
+ <!-- ================ BUILD: Create Catalina Javadocs =================== -->
+ <target name="javadoc" unless="docs.uptodate" >
+ <delete dir="${catalina.build}/javadoc"/>
+ <mkdir dir="${catalina.build}/javadoc"/>
+ <javadoc packagenames="org.apache.*"
+ classpathref="catalina.classpath"
+ sourcepathref="javadoc.sourcepath"
+ destdir="${catalina.build}/javadoc"
+ author="true"
+ version="true"
+ windowtitle="Tomcat API Documentation"
+ doctitle="Tomcat API"
+ bottom="Copyright © 2000-2004 Apache Software Foundation. All Rights Reserved."
+ additionalparam="-breakiterator"
+ />
+ </target>
+
+
+ <!-- ======================= BUILD: Clean Directory ===================== -->
+ <target name="build-clean">
+
+ <delete dir="${catalina.build}"/>
+
+ <ant dir="${tomcat-util.home}" target="clean"/>
+ <ant dir="${tomcat-coyote.home}" target="clean"/>
+ <ant dir="${tomcat-jk.home}" target="clean"/>
+ <ant dir="${tomcat-http11.home}" target="clean"/>
+
+ </target>
+
+
+ <!-- ==================== BUILD: Rebuild Everything ===================== -->
+ <target name="all" depends="build-clean,build-main"
+ description="Clean, build, and deploy Catalina component"/>
+
+
+ <!-- ================ TEST: Compile Unit Tests ========================== -->
+ <target name="build-tests" depends="build-main" if="junit.present">
+ <mkdir dir="${catalina.build}/tests"/>
+ <!-- Compile unit test classes -->
+ <javac srcdir="src/test" destdir="${catalina.build}/tests"
+ deprecation="${compile.deprecation}"
+ debug="${compile.debug}"
+ optimize="off"
+ source="${compile.source}"
+ excludes="**/CVS/**">
+ <classpath refid="test.classpath"/>
+ </javac>
+ </target>
+
+
+ <!-- ==================== TEST: Execute Unit Tests ====================== -->
+ <target name="test" if="junit.present"
+ description="Run all unit test cases"
+ depends="build-tests,test-dir-context,test-util">
+ </target>
+
+ <target name="test-dir-context" if="junit.present">
+
+ <echo message="Running FileDirContext tests"/>
+ <java classname="${test.runner}" fork="yes"
+ failonerror="${test.failonerror}">
+ <sysproperty key="doc.base" value="${test.webapp}"/>
+ <arg value="org.apache.naming.resources.FileDirContextTestCase"/>
+ <classpath refid="test.classpath"/>
+ </java>
+
+ <echo message="Running WARDirContext tests"/>
+ <jar jarfile="${test.webapp.war}">
+ <fileset dir="${test.webapp}"/>
+ </jar>
+ <java classname="${test.runner}" fork="yes"
+ failonerror="${test.failonerror}">
+ <sysproperty key="doc.base" value="${test.webapp.war}"/>
+ <arg value="org.apache.naming.resources.WARDirContextTestCase"/>
+ <classpath refid="test.classpath"/>
+ </java>
+ <delete file="${test.webapp.war}"/>
+
+ </target>
+
+ <target name="test-util" if="junit.present">
+
+ <echo message="Running CookieTools tests"/>
+ <java classname="${test.runner}" fork="yes"
+ failonerror="${test.failonerror}">
+ <arg value="org.apache.catalina.util.CookieToolsTestCase"/>
+ <classpath refid="test.classpath"/>
+ </java>
+
+ <echo message="Running URL tests"/>
+ <java classname="${test.runner}" fork="yes"
+ failonerror="${test.failonerror}">
+ <arg value="org.apache.catalina.util.URLTestCase"/>
+ <classpath refid="test.classpath"/>
+ </java>
+
+ </target>
+
+
+ <!-- ====================== DEPLOY: Create Directories ================== -->
+ <target name="deploy-prepare">
+ <mkdir dir="${catalina.deploy}"/>
+ <mkdir dir="${catalina.deploy}/bin"/>
+ <mkdir dir="${catalina.deploy}/conf"/>
+ <mkdir dir="${catalina.deploy}/logs"/>
+ <mkdir dir="${catalina.deploy}/common/classes"/>
+ <mkdir dir="${catalina.deploy}/common/endorsed"/>
+ <mkdir dir="${catalina.deploy}/common/i18n"/>
+ <mkdir dir="${catalina.deploy}/common/lib"/>
+ <mkdir dir="${catalina.deploy}/server/classes"/>
+ <mkdir dir="${catalina.deploy}/server/lib"/>
+ <mkdir dir="${catalina.deploy}/work"/>
+ <mkdir dir="${catalina.deploy}/temp"/>
+ </target>
+
+
+ <!-- ====================== DEPLOY: Copy Static Files =================== -->
+ <target name="deploy-static" depends="build-main,deploy-prepare,deploy-static-only,deploy-libs"/>
+
+ <target name="deploy-static-only" depends="deploy-prepare">
+
+ <!-- Executable Commands -->
+ <copy todir="${catalina.deploy}/bin">
+ <fileset dir="src/bin" excludes="*-using-launcher.*,launcher.properties,catalina.xml" />
+ </copy>
+ <fixcrlf srcdir="${catalina.deploy}/bin" includes="*.sh" eol="lf"/>
+ <fixcrlf srcdir="${catalina.deploy}/bin" includes="*.bat" eol="crlf"/>
+ <chmod perm="+x" dir="${catalina.build}/bin" includes="*.sh"/>
+
+ <!-- Configuration Files -->
+ <copy todir="${catalina.deploy}/conf">
+ <fileset dir="${catalina.build}/conf" />
+ </copy>
+
+ </target>
+
+ <target name="deploy-libs">
+
+ <!-- Common Extensions -->
+ <copy todir="${catalina.deploy}/common/endorsed">
+ <fileset dir="${catalina.build}/common/endorsed" />
+ </copy>
+
+ <copy todir="${catalina.deploy}/common/lib">
+ <fileset dir="${catalina.build}/common/lib" />
+ </copy>
+
+ <!-- Server Components -->
+ <copy todir="${catalina.deploy}/server/lib">
+ <fileset dir="${catalina.build}/server/lib" />
+ </copy>
+
+ <!-- Shared Extensions -->
+<!--
+ <copy todir="${catalina.deploy}/shared/lib">
+ <fileset dir="${catalina.build}/shared/lib" />
+ </copy>
+-->
+ </target>
+
+
+ <!-- ====================== DEPLOY: Create Catalina JARs ================ -->
+ <target name="catalina-jars" depends="build-static,deploy-prepare,flags,flags.display,build-catalina"
+ description="Build catalina jars">
+
+ <!-- Catalina Bootstrap JAR File. It is a very wrong idea to split packages in multiple jars !!! -->
+ <jar jarfile="${catalina.deploy}/bin/bootstrap.jar"
+ manifest="etc/bootstrap.MF">
+ <fileset dir="${classes.dir}">
+ <include name="org/apache/catalina/startup/Bootstrap.class" />
+ <include name="org/apache/catalina/startup/catalina.properties" />
+ <include name="org/apache/catalina/startup/CatalinaProperties.class" />
+ <include name="org/apache/catalina/startup/ClassLoaderFactory.class" />
+ <include name="org/apache/catalina/startup/Tool.class" />
+ <include name="org/apache/catalina/loader/StandardClassLoader*.class" />
+ <include name="org/apache/catalina/loader/Extension.class" />
+ <include name="org/apache/catalina/loader/Reloader.class" />
+ <include name="org/apache/catalina/security/SecurityClassLoad.class" />
+ <include name="org/apache/catalina/launcher/CatalinaLaunchFilter.class" />
+ <include name="org/apache/naming/JndiPermission.class" />
+ <include name="org/apache/tomcat/util/compat/*" />
+
+ <!-- Javadoc and i18n exclusions -->
+ <exclude name="**/package.html" />
+ <exclude name="**/LocalStrings_*" />
+ </fileset>
+ </jar>
+
+ <!-- Catalina Main JAR File -->
+ <!-- Excluding files from here is worse than duplicating them - a loader that uses the
+ package name as index and includes both bootstrap and catalina will be confused -->
+
+ <jar jarfile="${catalina.deploy}/server/lib/catalina.jar">
+ <fileset dir="${classes.dir}">
+
+ <include name="org/apache/catalina/**" />
+ <include name="org/apache/catalina/servlets/Constants.class" />
+ <include name="org/apache/catalina/servlets/LocalStrings.properties" />
+
+ <!-- Javadoc and i18n exclusions -->
+ <exclude name="**/package.html" />
+ <exclude name="**/LocalStrings_*" />
+
+ <!-- Modules -->
+ <exclude name="org/apache/catalina/ant/**" />
+ <exclude name="org/apache/catalina/cluster/**" />
+ <exclude name="org/apache/catalina/launcher/**" />
+ <exclude name="org/apache/catalina/servlets/**" />
+ <exclude name="org/apache/catalina/startup/Bootstrap.class" />
+ <exclude name="org/apache/catalina/ssi/**" />
+ <exclude name="org/apache/naming/**" />
+
+ <!-- Catalina-optional classes -->
+ <exclude name="org/apache/catalina/realm/DataSourceRealm.class" />
+ <exclude name="org/apache/catalina/realm/JAAS*" />
+ <exclude name="org/apache/catalina/realm/JDBC*" />
+ <exclude name="org/apache/catalina/realm/JNDI*" />
+ <exclude name="org/apache/catalina/realm/Memory*" />
+ <exclude name="org/apache/catalina/session/StoreBase.class" />
+ <exclude name="org/apache/catalina/session/*Store.class" />
+ <exclude name="org/apache/catalina/session/PersistentManager*" />
+ <exclude name="org/apache/catalina/util/CGIProcessEnvironment.class" />
+ <exclude name="org/apache/catalina/util/CookieTools.class" />
+ <exclude name="org/apache/catalina/util/DateTool.class" />
+ <exclude name="org/apache/catalina/util/DOMWriter.class" />
+ <exclude name="org/apache/catalina/util/FastDateFormat.class" />
+ <exclude name="org/apache/catalina/util/IOTools.class" />
+ <exclude name="org/apache/catalina/util/MIME2Java.class" />
+ <exclude name="org/apache/catalina/util/Process*" />
+ <exclude name="org/apache/catalina/util/Queue.class" />
+ <exclude name="org/apache/catalina/util/Strftime.class" />
+ <exclude name="org/apache/catalina/util/XMLWriter.class" />
+ <exclude name="org/apache/catalina/valves/ExtendedAccessLogValve.class" />
+ <exclude name="org/apache/catalina/valves/FieldInfo.class" />
+ <exclude name="org/apache/catalina/valves/JDBCAccessLogValve.class" />
+ <exclude name="org/apache/catalina/valves/PersistentValve.class" />
+ <exclude name="org/apache/catalina/valves/Remote*" />
+ <exclude name="org/apache/catalina/valves/RequestDumperValve.class" />
+ <exclude name="org/apache/catalina/valves/RequestFilterValve.class" />
+
+ </fileset>
+ </jar>
+
+ <jar jarfile="${catalina.deploy}/server/lib/catalina-optional.jar">
+ <fileset dir="${classes.dir}">
+
+ <include name="org/apache/catalina/realm/DataSourceRealm.class" />
+ <include name="org/apache/catalina/realm/JAAS*" />
+ <include name="org/apache/catalina/realm/JDBC*" />
+ <include name="org/apache/catalina/realm/JNDI*" />
+ <include name="org/apache/catalina/realm/Memory*" />
+ <include name="org/apache/catalina/session/StoreBase.class" />
+ <include name="org/apache/catalina/session/*Store.class" />
+ <include name="org/apache/catalina/session/PersistentManager*" />
+ <include name="org/apache/catalina/util/CGIProcessEnvironment.class" />
+ <include name="org/apache/catalina/util/CookieTools.class" />
+ <include name="org/apache/catalina/util/DateTool.class" />
+ <include name="org/apache/catalina/util/DOMWriter.class" />
+ <include name="org/apache/catalina/util/FastDateFormat.class" />
+ <include name="org/apache/catalina/util/IOTools.class" />
+ <include name="org/apache/catalina/util/MIME2Java.class" />
+ <include name="org/apache/catalina/util/Process*" />
+ <include name="org/apache/catalina/util/Queue.class" />
+ <include name="org/apache/catalina/util/Strftime.class" />
+ <include name="org/apache/catalina/util/XMLWriter.class" />
+ <include name="org/apache/catalina/valves/ExtendedAccessLogValve.class" />
+ <include name="org/apache/catalina/valves/FieldInfo.class" />
+ <include name="org/apache/catalina/valves/JDBCAccessLogValve.class" />
+ <include name="org/apache/catalina/valves/PersistentValve.class" />
+ <include name="org/apache/catalina/valves/Remote*" />
+ <include name="org/apache/catalina/valves/RequestDumperValve.class" />
+ <include name="org/apache/catalina/valves/RequestFilterValve.class" />
+
+ <!-- Javadoc and i18n exclusions -->
+ <exclude name="**/package.html" />
+ <exclude name="**/LocalStrings_*" />
+
+ </fileset>
+ </jar>
+
+ <!-- Catalina Ant Tasks JAR File -->
+ <jar jarfile="${catalina.deploy}/server/lib/catalina-ant.jar">
+ <fileset dir="${classes.dir}">
+
+ <include name="org/apache/catalina/ant/**" />
+ <include name="org/apache/catalina/util/Base64.class" />
+
+ <!-- Javadoc and i18n exclusions -->
+ <exclude name="**/package.html" />
+ <exclude name="**/LocalStrings_*" />
+
+ </fileset>
+ </jar>
+
+ <!-- Naming - Common JAR File -->
+ <jar jarfile="${catalina.deploy}/common/lib/naming-common.jar"
+ index="true">
+ <fileset dir="${classes.dir}">
+ <include name="org/apache/naming/*" />
+ <include name="org/apache/naming/factory/Constants.class" />
+ <include name="org/apache/naming/factory/ResourceLinkFactory.class" />
+ <exclude name="org/apache/naming/java/*" />
+<!--
+ <exclude name="org/apache/naming/JndiPermission.class" />
+-->
+
+ <!-- Javadoc and i18n exclusions -->
+ <exclude name="**/package.html" />
+ <exclude name="**/LocalStrings_*" />
+
+ </fileset>
+ </jar>
+
+ <!-- Naming - Java: namespace. It shouldn't be included if tomcat is used inside a different
+ container that provides this ns -->
+ <jar jarfile="${catalina.deploy}/common/lib/naming-java.jar" index="true">
+ <fileset dir="${classes.dir}">
+ <include name="org/apache/naming/java/*" />
+ <!-- Javadoc and i18n exclusions -->
+ <exclude name="**/package.html" />
+ <exclude name="**/LocalStrings_*" />
+ </fileset>
+ </jar>
+
+
+ <!-- Naming - Factory JAR File -->
+ <jar jarfile="${catalina.deploy}/common/lib/naming-factory.jar" index="true">
+ <fileset dir="${classes.dir}">
+ <include name="org/apache/naming/factory/**" />
+ <exclude name="org/apache/naming/factory/Constants.class" />
+ <exclude name="org/apache/naming/factory/ResourceLinkFactory.class" />
+ <!-- Javadoc and i18n exclusions -->
+ <exclude name="**/package.html" />
+ <exclude name="**/LocalStrings_*" />
+ </fileset>
+ </jar>
+
+ <!-- Naming - Resources JAR File -->
+ <jar jarfile="${catalina.deploy}/common/lib/naming-resources.jar" index="true">
+ <fileset dir="${classes.dir}">
+ <include name="org/apache/naming/NameParserImpl.class" />
+ <include name="org/apache/naming/NamingContextBindingsEnumeration.class" />
+ <include name="org/apache/naming/NamingContextEnumeration.class" />
+ <include name="org/apache/naming/NamingEntry.class" />
+ <include name="org/apache/naming/StringManager.class" />
+ <include name="org/apache/naming/resources/*" />
+ <!-- Javadoc and i18n exclusions -->
+ <exclude name="**/package.html" />
+ <exclude name="**/LocalStrings_*" />
+ </fileset>
+ </jar>
+
+ <!-- Servlets - CGI Servlet -->
+ <jar jarfile="${catalina.deploy}/server/lib/servlets-cgi.renametojar" index="true">
+ <fileset dir="${classes.dir}">
+ <include name="org/apache/catalina/servlets/CGI*" />
+ </fileset>
+ </jar>
+
+ <!-- Servlets - Default File-Serving Servlet -->
+ <jar jarfile="${catalina.deploy}/server/lib/servlets-default.jar" index="true">
+ <fileset dir="${classes.dir}">
+ <include name="org/apache/catalina/servlets/Default*" />
+ </fileset>
+ </jar>
+
+ <!-- Servlets - Invoker Servlet -->
+ <jar jarfile="${catalina.deploy}/server/lib/servlets-invoker.jar" index="true">
+ <fileset dir="${classes.dir}">
+ <include name="org/apache/catalina/servlets/Invoker*" />
+ </fileset>
+ </jar>
+
+ <!-- Servlets - SSI Servlet -->
+ <jar jarfile="${catalina.deploy}/server/lib/servlets-ssi.renametojar" index="true">
+ <fileset dir="${classes.dir}">
+ <include name="org/apache/catalina/ssi/**" />
+ <!-- Javadoc and i18n exclusions -->
+ <exclude name="**/package.html" />
+ <exclude name="**/LocalStrings_*" />
+ </fileset>
+ </jar>
+
+ <!-- Servlets - Webdav Servlet -->
+ <jar jarfile="${catalina.deploy}/server/lib/servlets-webdav.jar" index="true">
+ <fileset dir="${classes.dir}">
+ <include name="org/apache/catalina/servlets/Webdav*" />
+ </fileset>
+ </jar>
+
+ </target>
+
+ <target name="deploy-catalina" depends="deploy-static,build-main,catalina-jars"
+ description="Build and deploy Catalina component">
+ </target>
+
+
+ <!-- ====================== DEPLOY: Create Catalina JARs ================ -->
+ <target name="deploy" depends="deploy-catalina,build-tomcat-coyote,build-tomcat-jk,build-tomcat-http11"
+ description="Build and deploy Catalina">
+ </target>
+
+
+ <!-- ================ DIST: Create Distribution ========================= -->
+ <target name="dist" depends="build-main"
+ description="Create binary distribution">
+
+ <!-- Executable Commands -->
+ <mkdir dir="${catalina.dist}/bin"/>
+ <copy todir="${catalina.dist}/bin">
+ <fileset dir="src/bin" excludes="*-using-launcher.*,launcher.properties,catalina.xml" />
+ </copy>
+ <fixcrlf srcdir="${catalina.dist}/bin" includes="*.sh" eol="lf"/>
+ <fixcrlf srcdir="${catalina.dist}/bin" includes="*.bat" eol="crlf"/>
+ <chmod perm="+x" dir="${catalina.build}/bin" includes="*.sh"/>
+
+ <!-- Common Extensions -->
+ <mkdir dir="${catalina.dist}/common/classes"/>
+ <copy todir="${catalina.dist}/common/classes">
+ <fileset dir="${catalina.build}/common/classes" />
+ </copy>
+ <mkdir dir="${catalina.dist}/common/lib"/>
+ <copy todir="${catalina.dist}/common/lib">
+ <fileset dir="${catalina.build}/common/lib" />
+ </copy>
+
+ <!-- Configuration Files -->
+ <mkdir dir="${catalina.dist}/conf"/>
+ <copy todir="${catalina.dist}/conf">
+ <fileset dir="${catalina.build}/conf" />
+ </copy>
+
+ <!-- Server Components -->
+ <mkdir dir="${catalina.dist}/server/classes"/>
+ <!-- Do we want to copy the classes ?
+ <copy todir="${catalina.dist}/server/classes">
+ <fileset dir="${classes.dir}" />
+ </copy>
+ -->
+ <mkdir dir="${catalina.dist}/server/lib"/>
+ <copy todir="${catalina.dist}/server/lib">
+ <fileset dir="${catalina.build}/server/lib" />
+ </copy>
+
+ <!-- Shared Extensions -->
+ <mkdir dir="${catalina.dist}/shared/classes"/>
+ <copy todir="${catalina.dist}/shared/classes">
+ <fileset dir="${catalina.build}/shared/classes" />
+ </copy>
+ <mkdir dir="${catalina.dist}/shared/lib"/>
+ <copy todir="${catalina.dist}/shared/lib">
+ <fileset dir="${catalina.build}/shared/lib" />
+ </copy>
+
+ </target>
+
+
+ <!-- ======================== DIST: Clean Directory ===================== -->
+ <target name="dist-clean">
+ <delete dir="${catalina.dist}"/>
+ </target>
+
+
+ <!-- ====================== Convenient Synonyms ========================= -->
+ <target name="clean" depends="build-clean, dist-clean"
+ description="Clean build and dist directories"/>
+
+
+</project>
diff --git a/container/catalina/etc/bootstrap.MF b/container/catalina/etc/bootstrap.MF
new file mode 100644
index 0000000..1ae3131
--- /dev/null
+++ b/container/catalina/etc/bootstrap.MF
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Main-Class: org.apache.catalina.startup.Bootstrap
+Class-Path: jmx.jar commons-daemon.jar commons-logging-api.jar
+Specification-Title: Catalina
+Specification-Version: 1.0
\ No newline at end of file
diff --git a/container/catalina/src/bin/catalina.bat b/container/catalina/src/bin/catalina.bat
new file mode 100644
index 0000000..d6b8c79
--- /dev/null
+++ b/container/catalina/src/bin/catalina.bat
@@ -0,0 +1,192 @@
+@echo off
+if "%OS%" == "Windows_NT" setlocal
+rem ---------------------------------------------------------------------------
+rem Start/Stop Script for the CATALINA Server
+rem
+rem Environment Variable Prequisites
+rem
+rem CATALINA_HOME May point at your Catalina "build" directory.
+rem
+rem CATALINA_BASE (Optional) Base directory for resolving dynamic portions
+rem of a Catalina installation. If not present, resolves to
+rem the same directory that CATALINA_HOME points to.
+rem
+rem CATALINA_OPTS (Optional) Java runtime options used when the "start",
+rem "stop", or "run" command is executed.
+rem
+rem CATALINA_TMPDIR (Optional) Directory path location of temporary directory
+rem the JVM should use (java.io.tmpdir). Defaults to
+rem %CATALINA_BASE%\temp.
+rem
+rem JAVA_HOME Must point at your Java Development Kit installation.
+rem
+rem JAVA_OPTS (Optional) Java runtime options used when the "start",
+rem "stop", or "run" command is executed.
+rem
+rem JSSE_HOME (Optional) May point at your Java Secure Sockets Extension
+rem (JSSE) installation, whose JAR files will be added to the
+rem system class path used to start Tomcat.
+rem
+rem JPDA_TRANSPORT (Optional) JPDA transport used when the "jpda start"
+rem command is executed. The default is "dt_shmem".
+rem
+rem JPDA_ADDRESS (Optional) Java runtime options used when the "jpda start"
+rem command is executed. The default is "jdbconn".
+rem
+rem $Id$
+rem ---------------------------------------------------------------------------
+
+rem Guess CATALINA_HOME if not defined
+set CURRENT_DIR=%cd%
+if not "%CATALINA_HOME%" == "" goto gotHome
+set CATALINA_HOME=%CURRENT_DIR%
+if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
+cd ..
+set CATALINA_HOME=%cd%
+cd %CURRENT_DIR%
+:gotHome
+if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
+echo The CATALINA_HOME environment variable is not defined correctly
+echo This environment variable is needed to run this program
+goto end
+:okHome
+
+rem Get standard environment variables
+if exist "%CATALINA_HOME%\bin\setenv.bat" call "%CATALINA_HOME%\bin\setenv.bat"
+
+rem Get standard Java environment variables
+if exist "%CATALINA_HOME%\bin\setclasspath.bat" goto okSetclasspath
+echo Cannot find %CATALINA_HOME%\bin\setclasspath.bat
+echo This file is needed to run this program
+goto end
+:okSetclasspath
+set BASEDIR=%CATALINA_HOME%
+call "%CATALINA_HOME%\bin\setclasspath.bat"
+
+rem Add on extra jar files to CLASSPATH
+if "%JSSE_HOME%" == "" goto noJsse
+set CLASSPATH=%CLASSPATH%;%JSSE_HOME%\lib\jcert.jar;%JSSE_HOME%\lib\jnet.jar;%JSSE_HOME%\lib\jsse.jar
+:noJsse
+set CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\bootstrap.jar
+
+if not "%CATALINA_BASE%" == "" goto gotBase
+set CATALINA_BASE=%CATALINA_HOME%
+:gotBase
+
+if not "%CATALINA_TMPDIR%" == "" goto gotTmpdir
+set CATALINA_TMPDIR=%CATALINA_BASE%\temp
+:gotTmpdir
+
+rem ----- Execute The Requested Command ---------------------------------------
+
+echo Using CATALINA_BASE: %CATALINA_BASE%
+echo Using CATALINA_HOME: %CATALINA_HOME%
+echo Using CATALINA_TMPDIR: %CATALINA_TMPDIR%
+echo Using JAVA_HOME: %JAVA_HOME%
+
+set _EXECJAVA=%_RUNJAVA%
+set MAINCLASS=org.apache.catalina.startup.Bootstrap
+set ACTION=start
+set SECURITY_POLICY_FILE=
+set DEBUG_OPTS=
+set JPDA=
+
+if not ""%1"" == ""jpda"" goto noJpda
+set JPDA=jpda
+if not "%JPDA_TRANSPORT%" == "" goto gotJpdaTransport
+set JPDA_TRANSPORT=dt_shmem
+:gotJpdaTransport
+if not "%JPDA_ADDRESS%" == "" goto gotJpdaAddress
+set JPDA_ADDRESS=jdbconn
+:gotJpdaAddress
+shift
+:noJpda
+
+if ""%1"" == ""debug"" goto doDebug
+if ""%1"" == ""run"" goto doRun
+if ""%1"" == ""start"" goto doStart
+if ""%1"" == ""stop"" goto doStop
+if ""%1"" == ""version"" goto doVersion
+
+echo Usage: catalina ( commands ... )
+echo commands:
+echo debug Start Catalina in a debugger
+echo debug -security Debug Catalina with a security manager
+echo jpda start Start Catalina under JPDA debugger
+echo run Start Catalina in the current window
+echo run -security Start in the current window with security manager
+echo start Start Catalina in a separate window
+echo start -security Start in a separate window with security manager
+echo stop Stop Catalina
+echo version What version of tomcat are you running?
+goto end
+
+:doDebug
+shift
+set _EXECJAVA=%_RUNJDB%
+set DEBUG_OPTS=-sourcepath "%CATALINA_HOME%\..\..\jakarta-tomcat-catalina\catalina\src\share"
+if not ""%1"" == ""-security"" goto execCmd
+shift
+echo Using Security Manager
+set SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy
+goto execCmd
+
+:doRun
+shift
+if not ""%1"" == ""-security"" goto execCmd
+shift
+echo Using Security Manager
+set SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy
+goto execCmd
+
+:doStart
+shift
+if not "%OS%" == "Windows_NT" goto noTitle
+set _EXECJAVA=start "Tomcat" %_RUNJAVA%
+goto gotTitle
+:noTitle
+set _EXECJAVA=start %_RUNJAVA%
+:gotTitle
+if not ""%1"" == ""-security"" goto execCmd
+shift
+echo Using Security Manager
+set SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy
+goto execCmd
+
+:doStop
+shift
+set ACTION=stop
+goto execCmd
+
+:doVersion
+%_EXECJAVA% -classpath "%CATALINA_HOME%\server\lib\catalina.jar" org.apache.catalina.util.ServerInfo
+goto end
+
+
+:execCmd
+rem Get remaining unshifted command line arguments and save them in the
+set CMD_LINE_ARGS=
+:setArgs
+if ""%1""=="""" goto doneSetArgs
+set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
+shift
+goto setArgs
+:doneSetArgs
+
+rem Execute Java with the applicable properties
+if not "%JPDA%" == "" goto doJpda
+if not "%SECURITY_POLICY_FILE%" == "" goto doSecurity
+%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
+goto end
+:doSecurity
+%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
+goto end
+:doJpda
+if not "%SECURITY_POLICY_FILE%" == "" goto doSecurityJpda
+%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% -Xdebug -Xrunjdwp:transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=n %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
+goto end
+:doSecurityJpda
+%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% -Xrunjdwp:transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=n %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
+goto end
+
+:end
diff --git a/container/catalina/src/bin/catalina.sh b/container/catalina/src/bin/catalina.sh
new file mode 100644
index 0000000..d0ea0bf
--- /dev/null
+++ b/container/catalina/src/bin/catalina.sh
@@ -0,0 +1,287 @@
+#!/bin/sh
+# -----------------------------------------------------------------------------
+# Start/Stop Script for the CATALINA Server
+#
+# Environment Variable Prequisites
+#
+# CATALINA_HOME May point at your Catalina "build" directory.
+#
+# CATALINA_BASE (Optional) Base directory for resolving dynamic portions
+# of a Catalina installation. If not present, resolves to
+# the same directory that CATALINA_HOME points to.
+#
+# CATALINA_OPTS (Optional) Java runtime options used when the "start",
+# "stop", or "run" command is executed.
+#
+# CATALINA_TMPDIR (Optional) Directory path location of temporary directory
+# the JVM should use (java.io.tmpdir). Defaults to
+# $CATALINA_BASE/temp.
+#
+# JAVA_HOME Must point at your Java Development Kit installation.
+#
+# JAVA_OPTS (Optional) Java runtime options used when the "start",
+# "stop", or "run" command is executed.
+#
+# JPDA_TRANSPORT (Optional) JPDA transport used when the "jpda start"
+# command is executed. The default is "dt_socket".
+#
+# JPDA_ADDRESS (Optional) Java runtime options used when the "jpda start"
+# command is executed. The default is 8000.
+#
+# JSSE_HOME (Optional) May point at your Java Secure Sockets Extension
+# (JSSE) installation, whose JAR files will be added to the
+# system class path used to start Tomcat.
+#
+# CATALINA_PID (Optional) Path of the file which should contains the pid
+# of catalina startup java process, when start (fork) is used
+#
+# $Id$
+# -----------------------------------------------------------------------------
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false
+os400=false
+case "`uname`" in
+CYGWIN*) cygwin=true;;
+OS400*) os400=true;;
+esac
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ]; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+# Get standard environment variables
+PRGDIR=`dirname "$PRG"`
+
+# Only set CATALINA_HOME if not already set
+[ -z "$CATALINA_HOME" ] && CATALINA_HOME=`cd "$PRGDIR/.." ; pwd`
+
+if [ -r "$CATALINA_HOME"/bin/setenv.sh ]; then
+ . "$CATALINA_HOME"/bin/setenv.sh
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CATALINA_HOME" ] && CATALINA_HOME=`cygpath --unix "$CATALINA_HOME"`
+ [ -n "$CATALINA_BASE" ] && CATALINA_BASE=`cygpath --unix "$CATALINA_BASE"`
+ [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+ [ -n "$JSSE_HOME" ] && JSSE_HOME=`cygpath --absolute --unix "$JSSE_HOME"`
+fi
+
+# For OS400
+if $os400; then
+ # Set job priority to standard for interactive (interactive - 6) by using
+ # the interactive priority - 6, the helper threads that respond to requests
+ # will be running at the same priority as interactive jobs.
+ COMMAND='chgjob job('$JOBNAME') runpty(6)'
+ system $COMMAND
+
+ # Enable multi threading
+ export QIBM_MULTI_THREADED=Y
+fi
+
+# Get standard Java environment variables
+if [ -r "$CATALINA_HOME"/bin/setclasspath.sh ]; then
+ BASEDIR="$CATALINA_HOME"
+ . "$CATALINA_HOME"/bin/setclasspath.sh
+else
+ echo "Cannot find $CATALINA_HOME/bin/setclasspath.sh"
+ echo "This file is needed to run this program"
+ exit 1
+fi
+
+# Add on extra jar files to CLASSPATH
+if [ -n "$JSSE_HOME" ]; then
+ CLASSPATH="$CLASSPATH":"$JSSE_HOME"/lib/jcert.jar:"$JSSE_HOME"/lib/jnet.jar:"$JSSE_HOME"/lib/jsse.jar
+fi
+CLASSPATH="$CLASSPATH":"$CATALINA_HOME"/bin/bootstrap.jar:"$CATALINA_HOME"/bin/commons-logging-api.jar
+
+if [ -z "$CATALINA_BASE" ] ; then
+ CATALINA_BASE="$CATALINA_HOME"
+fi
+
+if [ -z "$CATALINA_TMPDIR" ] ; then
+ # Define the java.io.tmpdir to use for Catalina
+ CATALINA_TMPDIR="$CATALINA_BASE"/temp
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
+ CATALINA_HOME=`cygpath --absolute --windows "$CATALINA_HOME"`
+ CATALINA_BASE=`cygpath --absolute --windows "$CATALINA_BASE"`
+ CATALINA_TMPDIR=`cygpath --absolute --windows "$CATALINA_TMPDIR"`
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+ [ -n "$JSSE_HOME" ] && JSSE_HOME=`cygpath --absolute --windows "$JSSE_HOME"`
+ JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`
+fi
+
+# ----- Execute The Requested Command -----------------------------------------
+
+echo "Using CATALINA_BASE: $CATALINA_BASE"
+echo "Using CATALINA_HOME: $CATALINA_HOME"
+echo "Using CATALINA_TMPDIR: $CATALINA_TMPDIR"
+echo "Using JAVA_HOME: $JAVA_HOME"
+
+if [ "$1" = "jpda" ] ; then
+ if [ -z "$JPDA_TRANSPORT" ]; then
+ JPDA_TRANSPORT="dt_socket"
+ fi
+ if [ -z "$JPDA_ADDRESS" ]; then
+ JPDA_ADDRESS="8000"
+ fi
+ if [ -z "$JPDA_OPTS" ]; then
+ JPDA_OPTS="-Xdebug -Xrunjdwp:transport=$JPDA_TRANSPORT,address=$JPDA_ADDRESS,server=y,suspend=n"
+ fi
+ CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS"
+ shift
+fi
+
+if [ "$1" = "debug" ] ; then
+
+ if $os400; then
+ echo "Debug command not available on OS400"
+ exit 1
+ else
+ shift
+ if [ "$1" = "-security" ] ; then
+ echo "Using Security Manager"
+ shift
+ exec "$_RUNJDB" $JAVA_OPTS $CATALINA_OPTS \
+ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
+ -sourcepath "$CATALINA_HOME"/../../jakarta-tomcat-catalina/catalina/src/share \
+ -Djava.security.manager \
+ -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \
+ -Dcatalina.base="$CATALINA_BASE" \
+ -Dcatalina.home="$CATALINA_HOME" \
+ -Djava.io.tmpdir="$CATALINA_TMPDIR" \
+ org.apache.catalina.startup.Bootstrap "$@" start
+ else
+ exec "$_RUNJDB" $JAVA_OPTS $CATALINA_OPTS \
+ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
+ -sourcepath "$CATALINA_HOME"/../../jakarta-tomcat-catalina/catalina/src/share \
+ -Dcatalina.base="$CATALINA_BASE" \
+ -Dcatalina.home="$CATALINA_HOME" \
+ -Djava.io.tmpdir="$CATALINA_TMPDIR" \
+ org.apache.catalina.startup.Bootstrap "$@" start
+ fi
+ fi
+
+elif [ "$1" = "run" ]; then
+
+ shift
+ if [ "$1" = "-security" ] ; then
+ echo "Using Security Manager"
+ shift
+ exec "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
+ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
+ -Djava.security.manager \
+ -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \
+ -Dcatalina.base="$CATALINA_BASE" \
+ -Dcatalina.home="$CATALINA_HOME" \
+ -Djava.io.tmpdir="$CATALINA_TMPDIR" \
+ org.apache.catalina.startup.Bootstrap "$@" start
+ else
+ exec "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
+ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
+ -Dcatalina.base="$CATALINA_BASE" \
+ -Dcatalina.home="$CATALINA_HOME" \
+ -Djava.io.tmpdir="$CATALINA_TMPDIR" \
+ org.apache.catalina.startup.Bootstrap "$@" start
+ fi
+
+elif [ "$1" = "start" ] ; then
+
+ shift
+ touch "$CATALINA_BASE"/logs/catalina.out
+ if [ "$1" = "-security" ] ; then
+ echo "Using Security Manager"
+ shift
+ "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
+ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
+ -Djava.security.manager \
+ -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \
+ -Dcatalina.base="$CATALINA_BASE" \
+ -Dcatalina.home="$CATALINA_HOME" \
+ -Djava.io.tmpdir="$CATALINA_TMPDIR" \
+ org.apache.catalina.startup.Bootstrap "$@" start \
+ >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
+
+ if [ ! -z "$CATALINA_PID" ]; then
+ echo $! > $CATALINA_PID
+ fi
+ else
+ "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
+ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
+ -Dcatalina.base="$CATALINA_BASE" \
+ -Dcatalina.home="$CATALINA_HOME" \
+ -Djava.io.tmpdir="$CATALINA_TMPDIR" \
+ org.apache.catalina.startup.Bootstrap "$@" start \
+ >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
+
+ if [ ! -z "$CATALINA_PID" ]; then
+ echo $! > $CATALINA_PID
+ fi
+ fi
+
+elif [ "$1" = "stop" ] ; then
+
+ shift
+ FORCE=0
+ if [ "$1" = "-force" ]; then
+ shift
+ FORCE=1
+ fi
+
+ "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
+ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
+ -Dcatalina.base="$CATALINA_BASE" \
+ -Dcatalina.home="$CATALINA_HOME" \
+ -Djava.io.tmpdir="$CATALINA_TMPDIR" \
+ org.apache.catalina.startup.Bootstrap "$@" stop
+
+ if [ $FORCE -eq 1 ]; then
+ if [ ! -z "$CATALINA_PID" ]; then
+ echo "Killing: `cat $CATALINA_PID`"
+ kill -9 `cat $CATALINA_PID`
+ fi
+ fi
+
+elif [ "$1" = "version" ] ; then
+
+ "$_RUNJAVA" \
+ -classpath "$CATALINA_HOME/server/lib/catalina.jar" \
+ org.apache.catalina.util.ServerInfo
+
+else
+
+ echo "Usage: catalina.sh ( commands ... )"
+ echo "commands:"
+ if $os400; then
+ echo " debug Start Catalina in a debugger (not available on OS400)"
+ echo " debug -security Debug Catalina with a security manager (not available on OS400)"
+ else
+ echo " debug Start Catalina in a debugger"
+ echo " debug -security Debug Catalina with a security manager"
+ fi
+ echo " jpda start Start Catalina under JPDA debugger"
+ echo " run Start Catalina in the current window"
+ echo " run -security Start in the current window with security manager"
+ echo " start Start Catalina in a separate window"
+ echo " start -security Start in a separate window with security manager"
+ echo " stop Stop Catalina"
+ echo " stop -force Stop Catalina (followed by kill -KILL)"
+ echo " version What version of tomcat are you running?"
+ exit 1
+
+fi
diff --git a/container/catalina/src/bin/catalina.xml b/container/catalina/src/bin/catalina.xml
new file mode 100644
index 0000000..1e78d64
--- /dev/null
+++ b/container/catalina/src/bin/catalina.xml
@@ -0,0 +1,234 @@
+<!--
+ XML file for launching Catalina applications using ant.
+-->
+
+<project name="Catalina Launcher" default="catalina" basedir=".">
+ <property file="${user.home}/.tomcat5.properties"/>
+
+ <!-- Set the application home to the parent directory of this directory -->
+ <property name="catalina.home" location="${basedir}/.."/>
+ <property name="bootstrap.jar" location="${catalina.home}/bin/bootstrap.jar"/>
+
+ <!-- Import the user's custom properties -->
+ <property file="${catalina.home}/bin/catalina.properties"/> <!-- XXX shold it be conf ?? -->
+ <property file="${catalina.home}/conf/catalina.properties"/> <!-- XXX shold it be conf ?? -->
+
+
+ <!-- Set user configurable properties -->
+ <property name="jsse.home" location="${catalina.home}"/>
+ <property name="catalina.base" location="${catalina.home}"/>
+ <property name="catalina.tmpdir" location="${catalina.base}/temp"/>
+ <property name="catalina.out" location="${catalina.base}/logs/catalina.out"/>
+ <property name="catalina.policy" location="${catalina.base}/conf/catalina.policy"/>
+ <property name="catalina.jvm.args" value="-Dsun.io.useCanonCaches=false"/>
+
+ <property name="catalina.source.path" value="${catalina.home}/../../jakarta-servletapi-5/src/share:${catalina.home}/../../jakarta-tomcat-jasper/jasper2/src/share:${catalina.home}/../../jakarta-tomcat-connectors/coyote/src/java:${catalina.home}/../../jakarta-tomcat-catalina/catalina/src/share"/>
+
+
+ <!-- Build the classpath relative to the application home -->
+ <path id="base.class.path">
+ <pathelement location="${bootstrap.jar}"/>
+ <pathelement path="${jsse.home}/lib/jsse.jar:${jsse.home}/lib/jcert.jar:${jsse.home}/lib/jnet.jar"/>
+ </path>
+
+ <property name="basedir" location="."/>
+
+ <property name="tools.jar" location="${java.home}/../lib/tools.jar" />
+
+ <path id="tomcatcp" >
+ <pathelement location="${catalina.home}/bin/bootstrap.jar"/>
+ <!--
+ <fileset dir="${catalina.home}/common/lib" includes="*.jar"/>
+ <fileset dir="${catalina.home}/server/lib" includes="*.jar"/>
+ <pathelement location="${catalina.home}/common/classes"/>
+ -->
+ <!--
+ <pathelement location="${ant.home}/lib/xercesImpl.jar" />
+ <pathelement location="${ant.home}/lib/xml-apis.jar" />
+ -->
+ <pathelement location="${ant.home}/lib/ant.jar" />
+ <pathelement location="${tools.jar}" />
+ </path>
+
+
+ <!-- =================== Initialization/helpers ================== -->
+
+
+ <target name="init"
+ description="Display configuration and conditional compilation flags">
+ </target>
+
+ <target name="init-launcher" >
+ <!-- Build the sysproperties relative to the application home -->
+ <syspropertyset id="base.sys.properties">
+ <sysproperty key="java.endorsed.dirs" file="${catalina.home}/common/endorsed"/>
+ <sysproperty key="java.io.tmpdir" file="${catalina.tmpdir}"/>
+ <sysproperty key="catalina.home" file="${catalina.home}"/>
+ <sysproperty key="catalina.base" file="${catalina.base}"/>
+ </syspropertyset>
+
+ <!-- Build the standard jvmargs -->
+ <jvmargset id="base.jvm.args">
+ <jvmarg line="${catalina.jvm.args}"/>
+ <jvmarg value="-Xdebug" if="jpda.settings"/>
+ <jvmarg value="-Xrunjdwp:${jpda.settings}" if="jpda.settings"/>
+ <jvmarg value="-sourcepath" if="jdb"/>
+ <jvmarg path="${catalina.source.path}" if="jdb"/>
+ </jvmargset>
+ </target>
+
+ <target name="echo-config" >
+ <echo>TOMCAT_HOME=${catalina.home}</echo>
+ <echo>CLASSPATH=${toString:tomcatcp}</echo>
+ </target>
+
+ <target name="help" >
+ <echo>
+ To run any of the applications in the JDB debugger, execute the Launcher with
+ a "-Ddebug=true" argument.
+
+ To run any of the applications in JPDA mode, execute the Launcher with a
+ "-Djpda=true" argument.
+ </echo>
+ </target>
+
+ <!-- Target that sets JDB properties when the "debug" property is set -->
+ <target name="setjdb" description="Set JDB properties" if="debug">
+ <property name="jdb" value="true"/>
+ </target>
+
+ <!-- Target that sets JPDA properties when the "jpda" property is set -->
+ <target name="setjpda" description="Set JPDA properties" if="jpda">
+ <condition property="jpda.transport" value="dt_shmem">
+ <os family="windows"/>
+ </condition>
+ <condition property="jpda.transport" value="dt_socket">
+ <not>
+ <os family="windows"/>
+ </not>
+ </condition>
+ <condition property="jpda.address" value="jdbconn">
+ <equals arg1="${jpda.transport}" arg2="dt_shmem"/>
+ </condition>
+ <condition property="jpda.address" value="8000">
+ <not>
+ <equals arg1="${jpda.transport}" arg2="dt_shmem"/>
+ </not>
+ </condition>
+ <property name="jpda.suspend" value="y"/>
+ <property name="jpda.settings" value="transport=${jpda.transport},address=${jpda.address},server=y,suspend=${jpda.suspend}"/>
+ </target>
+
+ <!-- =================== Launcher-based ================== -->
+
+ <!-- Target that executes Catalina -->
+ <target name="catalina" description="Execute Catalina"
+ depends="init-launcher,setjdb,setjpda" >
+
+ <!-- Set default title for minimized window -->
+ <property name="catalina.window.title" value="Catalina"/>
+
+ <!--
+ Launch Catalina. Note that the "filterclassname" attribute will force
+ the "waitforchild" attribute to "true" if any invalid arguments are
+ used or if "start" is not the last argument.
+ -->
+ <launch classname="org.apache.catalina.startup.Bootstrap"
+ waitforchild="${wait}"
+ debug="${jdb}"
+ print="${print}"
+ filterclassname="org.apache.catalina.launcher.CatalinaLaunchFilter"
+ filterclasspath="${bootstrap.jar}"
+ usesystemin="false"
+ requiretools="true"
+ redirectoutput="true"
+ output="${catalina.out}"
+ displayMinimizedWindow="true"
+ minimizedWindowTitle="${catalina.window.title}">
+ <jvmargset refid="base.jvm.args"/>
+ <syspropertyset refid="base.sys.properties"/>
+ <sysproperty key="java.security.manager" value="" if="security"/>
+ <sysproperty key="java.security.policy" value="=${catalina.policy}" if="security"/>
+ <classpath refid="base.class.path"/>
+ </launch>
+
+ </target>
+
+ <!-- Target that executes the Catalina tool wrapper -->
+ <target name="tool-wrapper" description="Execute Catalina tool wrapper"
+ depends="setjdb,setjpda" >
+
+ <!-- Launch Catalina tool wrapper -->
+ <launch classname="org.apache.catalina.startup.Tool"
+ debug="${jdb}"
+ print="${print}"
+ usesystemin="false"
+ requiretools="true">
+ <jvmargset refid="base.jvm.args"/>
+ <syspropertyset refid="base.sys.properties"/>
+ <classpath refid="base.class.path"/>
+ </launch>
+
+ </target>
+
+ <!-- ======================= Ant/JMX based ================ -->
+
+ <target name="taskdef" >
+ <property name="tomcat.home" location=".." />
+
+ <path id="jmx.test.classpath">
+ <pathelement location="${commons-modeler.jar}" />
+ <fileset dir="${tomcat.home}/common/lib" includes="*.jar"/>
+ <fileset dir="${tomcat.home}/server/lib" includes="*.jar"/>
+ <fileset dir="${tomcat.home}/bin" includes="*.jar"/>
+ </path>
+
+ <!-- part of modeler -->
+ <taskdef resource="META-INF/ant.properties"
+ classpathref="jmx.test.classpath" />
+ </target>
+
+
+ <target name="run" depends="echo-config,taskdef"
+ description="Start tomcat as a task and return">
+
+ <MLET code="org.apache.commons.modeler.BaseModelMBean"
+ name="catalina:type=server" >
+ <arg value="org.apache.catalina.startup.Catalina" />
+ </MLET>
+
+ <jmxSet name="catalina:type=server"
+ attribute="catalinaHome"
+ value="${tomcat.home}"/>
+
+ <!-- We could also call init and set other properties -
+ init should load the modules -->
+
+ <jmx name="catalina:type=server"
+ method="start" />
+
+ <echo message="Tomcat5 running"/>
+
+ </target>
+
+
+ <!-- ======================= Exec/java ================ -->
+
+ <target name="java-start" depends="echo-config"
+ description="Run tomcat in-process and wait for it to end, using java task" >
+
+ <property name="tomcat.fork" value="false" />
+
+ <java classname="org.apache.catalina.startup.Bootstrap" fork="${tomcat.fork}">
+ <classpath refid="tomcatcp" />
+ <arg value="startd" />
+ <sysproperty key="catalina.home" value="${catalina.home}"/>
+ <sysproperty key="build.compiler" value="jikes"/>
+ <sysproperty key="java.endorsed.dirs" value="${ant.home}/lib:${java.home}/lib"/>
+ </java>
+
+ <echo message="Tomcat5 running"/>
+
+ </target>
+
+</project>
diff --git a/container/catalina/src/bin/cpappend.bat b/container/catalina/src/bin/cpappend.bat
new file mode 100644
index 0000000..3455e6f
--- /dev/null
+++ b/container/catalina/src/bin/cpappend.bat
@@ -0,0 +1,19 @@
+rem ---------------------------------------------------------------------------
+rem Append to CLASSPATH
+rem
+rem $Id$
+rem ---------------------------------------------------------------------------
+
+rem Process the first argument
+if ""%1"" == """" goto end
+set CLASSPATH=%CLASSPATH%;%1
+shift
+
+rem Process the remaining arguments
+:setArgs
+if ""%1"" == """" goto doneSetArgs
+set CLASSPATH=%CLASSPATH% %1
+shift
+goto setArgs
+:doneSetArgs
+:end
diff --git a/container/catalina/src/bin/digest.bat b/container/catalina/src/bin/digest.bat
new file mode 100644
index 0000000..705f711
--- /dev/null
+++ b/container/catalina/src/bin/digest.bat
@@ -0,0 +1,41 @@
+@echo off
+if "%OS%" == "Windows_NT" setlocal
+rem ---------------------------------------------------------------------------
+rem Script to digest password using the algorithm specified
+rem
+rem $Id$
+rem ---------------------------------------------------------------------------
+
+rem Guess CATALINA_HOME if not defined
+if not "%CATALINA_HOME%" == "" goto gotHome
+set CATALINA_HOME=.
+if exist "%CATALINA_HOME%\bin\tool-wrapper.bat" goto okHome
+set CATALINA_HOME=..
+:gotHome
+if exist "%CATALINA_HOME%\bin\tool-wrapper.bat" goto okHome
+echo The CATALINA_HOME environment variable is not defined correctly
+echo This environment variable is needed to run this program
+goto end
+:okHome
+
+set EXECUTABLE=%CATALINA_HOME%\bin\tool-wrapper.bat
+
+rem Check that target executable exists
+if exist "%EXECUTABLE%" goto okExec
+echo Cannot find %EXECUTABLE%
+echo This file is needed to run this program
+goto end
+:okExec
+
+rem Get remaining unshifted command line arguments and save them in the
+set CMD_LINE_ARGS=
+:setArgs
+if ""%1""=="""" goto doneSetArgs
+set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
+shift
+goto setArgs
+:doneSetArgs
+
+call "%EXECUTABLE%" -server org.apache.catalina.realm.RealmBase %CMD_LINE_ARGS%
+
+:end
diff --git a/container/catalina/src/bin/digest.sh b/container/catalina/src/bin/digest.sh
new file mode 100644
index 0000000..2a622f2
--- /dev/null
+++ b/container/catalina/src/bin/digest.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+# -----------------------------------------------------------------------------
+# Script to digest password using the algorithm specified
+#
+# $Id$
+# -----------------------------------------------------------------------------
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+PRGDIR=`dirname "$PRG"`
+EXECUTABLE=tool-wrapper.sh
+
+# Check that target executable exists
+if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
+ echo "Cannot find $PRGDIR/$EXECUTABLE"
+ echo "This file is needed to run this program"
+ exit 1
+fi
+
+exec "$PRGDIR"/"$EXECUTABLE" -server org.apache.catalina.realm.RealmBase "$@"
diff --git a/container/catalina/src/bin/launcher.properties b/container/catalina/src/bin/launcher.properties
new file mode 100644
index 0000000..95722da
--- /dev/null
+++ b/container/catalina/src/bin/launcher.properties
@@ -0,0 +1,23 @@
+#
+# Properties for the LauncherBootstrap class
+#
+# This file contains the following configurable properties:
+# - ant.class.path - This property is a ":" separated list of the URL file
+# fragments where the Ant classes are located. The list must include a JAXP
+# compliant XML parser if you are not using Java(TM) SE 1.4 or higher.
+#
+# Important notes:
+# - Relative URL file fragments, such as "../lib", are supported and strongly
+# encouraged as absolute files prevent cross platform distribution.
+# - URL file fragments are the portions of a URL after the "file:" string.
+# This means that you must use "/" characters as directory separators on
+# all platforms. Also, ":" characters in a file fragment, such as in drive
+# portion of absolute Windows files, must be URL encoded as "%3A". Lastly,
+# directories must have a "/" character at the end.
+# - All relative URL file fragments in the above properties will be resolved
+# using the URL of the directory that the LauncherBootstrap class was
+# loaded from, not the current working directory. This ensures that the
+# LauncherBootstrap class can properly resolve the files without regard to
+# the current working directory.
+#
+ant.class.path=../common/lib/ant.jar:../common/lib/ant-launcher.jar:../common/endorsed/xercesImpl.jar:../common/endorsed/xml-apis.jar
diff --git a/container/catalina/src/bin/service.bat b/container/catalina/src/bin/service.bat
new file mode 100644
index 0000000..5ea4bc8
--- /dev/null
+++ b/container/catalina/src/bin/service.bat
@@ -0,0 +1,109 @@
+@echo off
+if "%OS%" == "Windows_NT" setlocal
+rem ---------------------------------------------------------------------------
+rem NT Service Install/Uninstall script
+rem
+rem Options
+rem install Install the service using Tomcat5 as service name.
+rem Service is installed using default settings.
+rem remove Remove the service from the System.
+rem
+rem name (optional) If the second argument is present it is considered
+rem to be new service name
+rem
+rem $Id$
+rem ---------------------------------------------------------------------------
+
+rem Guess CATALINA_HOME if not defined
+set CURRENT_DIR=%cd%
+if not "%CATALINA_HOME%" == "" goto gotHome
+set CATALINA_HOME=%cd%
+if exist "%CATALINA_HOME%\bin\tomcat5.exe" goto okHome
+rem CD to the upper dir
+cd ..
+set CATALINA_HOME=%cd%
+:gotHome
+if exist "%CATALINA_HOME%\bin\tomcat5.exe" goto okHome
+echo The tomcat.exe was not found...
+echo The CATALINA_HOME environment variable is not defined correctly.
+echo This environment variable is needed to run this program
+goto end
+rem Make sure prerequisite environment variables are set
+if not "%JAVA_HOME%" == "" goto okHome
+echo The JAVA_HOME environment variable is not defined
+echo This environment variable is needed to run this program
+goto end
+:okHome
+if not "%CATALINA_BASE%" == "" goto gotBase
+set CATALINA_BASE=%CATALINA_HOME%
+:gotBase
+
+set EXECUTABLE=%CATALINA_HOME%\bin\tomcat5.exe
+
+rem Set default Service name
+set SERVICE_NAME=Tomcat5
+set PR_DISPLAYNAME=Apache Tomcat
+
+if "%1" == "" goto displayUsage
+if "%2" == "" goto setServiceName
+set SERVICE_NAME=%2
+set PR_DISPLAYNAME=Apache Tomcat %2
+:setServiceName
+if %1 == install goto doInstall
+if %1 == remove goto doRemove
+echo Unknown parameter "%1"
+:displayUsage
+echo
+echo Usage: service.bat install/remove [service_name]
+goto end
+
+:doRemove
+rem Remove the service
+"%EXECUTABLE%" //DS//%SERVICE_NAME%
+echo The service '%SERVICE_NAME%' has been removed
+goto end
+
+:doInstall
+rem Install the service
+echo Installing the service '%SERVICE_NAME%' ...
+echo Using CATALINA_HOME: %CATALINA_HOME%
+echo Using JAVA_HOME: %JAVA_HOME%
+
+rem Use the environment variables as an exaple
+rem Each command line option is prefixed with PR_
+
+set PR_DESCRIPTION=Apache Tomcat Server - http://jakarta.apache.org/tomcat
+set PR_INSTALL=%EXECUTABLE%
+set PR_LOGPATH=%CATALINA_HOME%\logs
+set PR_CLASSPATH=%CATALINA_HOME%\bin\bootstrap.jar
+rem Set the server jvm from JAVA_HOME
+set PR_JVM=%JAVA_HOME%\jre\bin\server\jvm.dll
+if exist "%PR_JVM%" goto foundJvm
+rem Set the client jvm from JAVA_HOME
+set PR_JVM=%JAVA_HOME%\jre\bin\client\jvm.dll
+if exist "%PR_JVM%" goto foundJvm
+set PR_JVM=auto
+:foundJvm
+echo Using JVM: %PR_JVM%
+"%EXECUTABLE%" //IS//%SERVICE_NAME% --StartClass org.apache.catalina.startup.Bootstrap --StopClass org.apache.catalina.startup.Bootstrap --StartParams start --StopParams stop
+if not errorlevel 1 goto installed
+echo Failed installing '%SERVICE_NAME%' service
+goto end
+:installed
+rem Clear the environment variables. They are not needed any more.
+set PR_DISPLAYNAME=
+set PR_DESCRIPTION=
+set PR_INSTALL=
+set PR_LOGPATH=
+set PR_CLASSPATH=
+set PR_JVM=
+rem Set extra parameters
+"%EXECUTABLE%" //US//%SERVICE_NAME% --JvmOptions "-Dcatalina.base=%CATALINA_BASE%;-Dcatalina.home=%CATALINA_HOME%;-Djava.endorsed.dirs=%CATALINA_HOME%\common\endorsed" --StartMode jvm --StopMode jvm
+rem More extra parameters
+set PR_STDOUTPUT=%CATALINA_HOME%\logs\stdout.log
+set PR_STDERROR=%CATALINA_HOME%\logs\stderr.log
+"%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-Djava.io.tmpdir=%CATALINA_BASE%\temp" --JvmMs 128 --JvmMx 256
+echo The service '%SERVICE_NAME%' has been installed.
+
+:end
+cd %CURRENT_DIR%
diff --git a/container/catalina/src/bin/setclasspath.bat b/container/catalina/src/bin/setclasspath.bat
new file mode 100644
index 0000000..db7ed15
--- /dev/null
+++ b/container/catalina/src/bin/setclasspath.bat
@@ -0,0 +1,57 @@
+rem ---------------------------------------------------------------------------
+rem Set CLASSPATH and Java options
+rem
+rem $Id$
+rem ---------------------------------------------------------------------------
+
+rem Make sure prerequisite environment variables are set
+if not "%JAVA_HOME%" == "" goto gotJavaHome
+echo The JAVA_HOME environment variable is not defined
+echo This environment variable is needed to run this program
+goto exit
+:gotJavaHome
+if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
+if not exist "%JAVA_HOME%\bin\javaw.exe" goto noJavaHome
+if not exist "%JAVA_HOME%\bin\jdb.exe" goto noJavaHome
+if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome
+goto okJavaHome
+:noJavaHome
+echo The JAVA_HOME environment variable is not defined correctly
+echo This environment variable is needed to run this program
+echo NB: JAVA_HOME should point to a JDK not a JRE
+goto exit
+:okJavaHome
+
+if not "%BASEDIR%" == "" goto gotBasedir
+echo The BASEDIR environment variable is not defined
+echo This environment variable is needed to run this program
+goto exit
+:gotBasedir
+if exist "%BASEDIR%\bin\setclasspath.bat" goto okBasedir
+echo The BASEDIR environment variable is not defined correctly
+echo This environment variable is needed to run this program
+goto exit
+:okBasedir
+
+rem Set the default -Djava.endorsed.dirs argument
+set JAVA_ENDORSED_DIRS=%BASEDIR%\common\endorsed
+
+rem Set standard CLASSPATH
+rem Note that there are no quotes as we do not want to introduce random
+rem quotes into the CLASSPATH
+set CLASSPATH=%JAVA_HOME%\lib\tools.jar
+
+rem Set standard command for invoking Java.
+rem Note that NT requires a window name argument when using start.
+rem Also note the quoting as JAVA_HOME may contain spaces.
+set _RUNJAVA="%JAVA_HOME%\bin\java"
+set _RUNJAVAW="%JAVA_HOME%\bin\javaw"
+set _RUNJDB="%JAVA_HOME%\bin\jdb"
+set _RUNJAVAC="%JAVA_HOME%\bin\javac"
+
+goto end
+
+:exit
+exit /b 1
+
+:end
diff --git a/container/catalina/src/bin/setclasspath.sh b/container/catalina/src/bin/setclasspath.sh
new file mode 100644
index 0000000..3c50b80
--- /dev/null
+++ b/container/catalina/src/bin/setclasspath.sh
@@ -0,0 +1,61 @@
+# -----------------------------------------------------------------------------
+# Set CLASSPATH and Java options
+#
+# $Id$
+# -----------------------------------------------------------------------------
+
+# Make sure prerequisite environment variables are set
+if [ -z "$JAVA_HOME" ]; then
+ echo "The JAVA_HOME environment variable is not defined"
+ echo "This environment variable is needed to run this program"
+ exit 1
+fi
+if $os400; then
+ if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/javac ]; then
+ echo "The JAVA_HOME environment variable is not defined correctly"
+ echo "This environment variable is needed to run this program"
+ echo "NB: JAVA_HOME should point to a JDK not a JRE"
+ exit 1
+ fi
+else
+ if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/jdb -o ! -x "$JAVA_HOME"/bin/javac ]; then
+ echo "The JAVA_HOME environment variable is not defined correctly"
+ echo "This environment variable is needed to run this program"
+ echo "NB: JAVA_HOME should point to a JDK not a JRE"
+ exit 1
+ fi
+fi
+if [ -z "$BASEDIR" ]; then
+ echo "The BASEDIR environment variable is not defined"
+ echo "This environment variable is needed to run this program"
+ exit 1
+fi
+if [ ! -x "$BASEDIR"/bin/setclasspath.sh ]; then
+ echo "The BASEDIR environment variable is not defined correctly"
+ echo "This environment variable is needed to run this program"
+ exit 1
+fi
+
+# Set the default -Djava.endorsed.dirs argument
+JAVA_ENDORSED_DIRS="$BASEDIR"/common/endorsed
+
+# Set standard CLASSPATH
+CLASSPATH="$JAVA_HOME"/lib/tools.jar
+
+# OSX hack to CLASSPATH
+JIKESPATH=
+if [ `uname -s` = "Darwin" ]; then
+ OSXHACK="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes"
+ if [ -d "$OSXHACK" ]; then
+ for i in "$OSXHACK"/*.jar; do
+ JIKESPATH="$JIKESPATH":"$i"
+ done
+ fi
+fi
+
+# Set standard commands for invoking Java.
+_RUNJAVA="$JAVA_HOME"/bin/java
+if [ $os400 = false ]; then
+ _RUNJDB="$JAVA_HOME"/bin/jdb
+fi
+_RUNJAVAC="$JAVA_HOME"/bin/javac
diff --git a/container/catalina/src/bin/shutdown-using-launcher.bat b/container/catalina/src/bin/shutdown-using-launcher.bat
new file mode 100644
index 0000000..95c4fff
--- /dev/null
+++ b/container/catalina/src/bin/shutdown-using-launcher.bat
@@ -0,0 +1,40 @@
+@echo off
+if "%OS%" == "Windows_NT" setlocal
+
+rem ---------------------------------------------------------------------------
+rem
+rem Script for shutting down Catalina using the Launcher
+rem
+rem ---------------------------------------------------------------------------
+
+rem Get standard environment variables
+set PRG=%0
+if exist %PRG%\..\setenv.bat goto gotCmdPath
+rem %0 must have been found by DOS using the %PATH% so we assume that
+rem setenv.bat will also be found in the %PATH%
+call setenv.bat
+goto doneSetenv
+:gotCmdPath
+call %PRG%\..\setenv.bat
+:doneSetenv
+
+rem Make sure prerequisite environment variables are set
+if not "%JAVA_HOME%" == "" goto gotJavaHome
+echo The JAVA_HOME environment variable is not defined
+echo This environment variable is needed to run this program
+goto end
+:gotJavaHome
+
+rem Get command line arguments and save them with the proper quoting
+set CMD_LINE_ARGS=
+:setArgs
+if ""%1""=="""" goto doneSetArgs
+set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
+shift
+goto setArgs
+:doneSetArgs
+
+rem Execute the Launcher using the "catalina" target
+"%JAVA_HOME%\bin\java.exe" -classpath %PRG%\..;"%PATH%";. LauncherBootstrap -launchfile catalina.xml -verbose catalina %CMD_LINE_ARGS% stop
+
+:end
diff --git a/container/catalina/src/bin/shutdown-using-launcher.sh b/container/catalina/src/bin/shutdown-using-launcher.sh
new file mode 100644
index 0000000..82daec2
--- /dev/null
+++ b/container/catalina/src/bin/shutdown-using-launcher.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# -----------------------------------------------------------------------------
+#
+# Script for shutting down Catalina using the Launcher
+#
+# -----------------------------------------------------------------------------
+
+# Resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ]; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+# Get standard environment variables
+PRGDIR=`dirname "$PRG"`
+if [ -r "$PRGDIR"/setenv.sh ]; then
+ . "$PRGDIR"/setenv.sh
+fi
+
+# Execute the Launcher using the "catalina" target
+exec "$JAVA_HOME"/bin/java -classpath "$PRGDIR" LauncherBootstrap -launchfile catalina.xml -verbose catalina "$@" stop
diff --git a/container/catalina/src/bin/shutdown.bat b/container/catalina/src/bin/shutdown.bat
new file mode 100644
index 0000000..d28c717
--- /dev/null
+++ b/container/catalina/src/bin/shutdown.bat
@@ -0,0 +1,44 @@
+@echo off
+if "%OS%" == "Windows_NT" setlocal
+rem ---------------------------------------------------------------------------
+rem Stop script for the CATALINA Server
+rem
+rem $Id$
+rem ---------------------------------------------------------------------------
+
+rem Guess CATALINA_HOME if not defined
+set CURRENT_DIR=%cd%
+if not "%CATALINA_HOME%" == "" goto gotHome
+set CATALINA_HOME=%CURRENT_DIR%
+if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
+cd ..
+set CATALINA_HOME=%cd%
+cd %CURRENT_DIR%
+:gotHome
+if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
+echo The CATALINA_HOME environment variable is not defined correctly
+echo This environment variable is needed to run this program
+goto end
+:okHome
+
+set EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat
+
+rem Check that target executable exists
+if exist "%EXECUTABLE%" goto okExec
+echo Cannot find %EXECUTABLE%
+echo This file is needed to run this program
+goto end
+:okExec
+
+rem Get remaining unshifted command line arguments and save them in the
+set CMD_LINE_ARGS=
+:setArgs
+if ""%1""=="""" goto doneSetArgs
+set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
+shift
+goto setArgs
+:doneSetArgs
+
+call "%EXECUTABLE%" stop %CMD_LINE_ARGS%
+
+:end
diff --git a/container/catalina/src/bin/shutdown.sh b/container/catalina/src/bin/shutdown.sh
new file mode 100644
index 0000000..441962f
--- /dev/null
+++ b/container/catalina/src/bin/shutdown.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+# -----------------------------------------------------------------------------
+# Stop script for the CATALINA Server
+#
+# $Id$
+# -----------------------------------------------------------------------------
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+PRGDIR=`dirname "$PRG"`
+EXECUTABLE=catalina.sh
+
+# Check that target executable exists
+if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
+ echo "Cannot find $PRGDIR/$EXECUTABLE"
+ echo "This file is needed to run this program"
+ exit 1
+fi
+
+exec "$PRGDIR"/"$EXECUTABLE" stop "$@"
diff --git a/container/catalina/src/bin/startup-using-launcher.bat b/container/catalina/src/bin/startup-using-launcher.bat
new file mode 100644
index 0000000..2a5ece9
--- /dev/null
+++ b/container/catalina/src/bin/startup-using-launcher.bat
@@ -0,0 +1,39 @@
+@echo off
+if "%OS%" == "Windows_NT" setlocal
+
+rem ---------------------------------------------------------------------------
+rem
+rem Script for starting Catalina using the Launcher
+rem
+rem ---------------------------------------------------------------------------
+
+rem Get standard environment variables
+set PRG=%0
+if exist %PRG%\..\setenv.bat goto gotCmdPath
+rem %0 must have been found by DOS using the %PATH% so we assume that
+rem setenv.bat will also be found in the %PATH%
+goto doneSetenv
+:gotCmdPath
+call %PRG%\..\setenv.bat
+:doneSetenv
+
+rem Make sure prerequisite environment variables are set
+if not "%JAVA_HOME%" == "" goto gotJavaHome
+echo The JAVA_HOME environment variable is not defined
+echo This environment variable is needed to run this program
+goto end
+:gotJavaHome
+
+rem Get command line arguments and save them with the proper quoting
+set CMD_LINE_ARGS=
+:setArgs
+if ""%1""=="""" goto doneSetArgs
+set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
+shift
+goto setArgs
+:doneSetArgs
+
+rem Execute the Launcher using the "catalina" target
+"%JAVA_HOME%\bin\java.exe" -classpath %PRG%\..;"%PATH%";. LauncherBootstrap -launchfile catalina.xml -verbose catalina %CMD_LINE_ARGS% start
+
+:end
diff --git a/container/catalina/src/bin/startup-using-launcher.sh b/container/catalina/src/bin/startup-using-launcher.sh
new file mode 100644
index 0000000..dcd179e
--- /dev/null
+++ b/container/catalina/src/bin/startup-using-launcher.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# -----------------------------------------------------------------------------
+#
+# Script for starting Catalina using the Launcher
+#
+# -----------------------------------------------------------------------------
+
+# Resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ]; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+# Get standard environment variables
+PRGDIR=`dirname "$PRG"`
+if [ -r "$PRGDIR"/setenv.sh ]; then
+ . "$PRGDIR"/setenv.sh
+fi
+
+# Execute the Launcher using the "catalina" target
+exec "$JAVA_HOME"/bin/java -classpath "$PRGDIR" LauncherBootstrap -launchfile catalina.xml -verbose catalina "$@" start
diff --git a/container/catalina/src/bin/startup.bat b/container/catalina/src/bin/startup.bat
new file mode 100644
index 0000000..246e2d9
--- /dev/null
+++ b/container/catalina/src/bin/startup.bat
@@ -0,0 +1,44 @@
+@echo off
+if "%OS%" == "Windows_NT" setlocal
+rem ---------------------------------------------------------------------------
+rem Start script for the CATALINA Server
+rem
+rem $Id$
+rem ---------------------------------------------------------------------------
+
+rem Guess CATALINA_HOME if not defined
+set CURRENT_DIR=%cd%
+if not "%CATALINA_HOME%" == "" goto gotHome
+set CATALINA_HOME=%CURRENT_DIR%
+if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
+cd ..
+set CATALINA_HOME=%cd%
+cd %CURRENT_DIR%
+:gotHome
+if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
+echo The CATALINA_HOME environment variable is not defined correctly
+echo This environment variable is needed to run this program
+goto end
+:okHome
+
+set EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat
+
+rem Check that target executable exists
+if exist "%EXECUTABLE%" goto okExec
+echo Cannot find %EXECUTABLE%
+echo This file is needed to run this program
+goto end
+:okExec
+
+rem Get remaining unshifted command line arguments and save them in the
+set CMD_LINE_ARGS=
+:setArgs
+if ""%1""=="""" goto doneSetArgs
+set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
+shift
+goto setArgs
+:doneSetArgs
+
+call "%EXECUTABLE%" start %CMD_LINE_ARGS%
+
+:end
diff --git a/container/catalina/src/bin/startup.sh b/container/catalina/src/bin/startup.sh
new file mode 100644
index 0000000..0f9ffc4
--- /dev/null
+++ b/container/catalina/src/bin/startup.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+# -----------------------------------------------------------------------------
+# Start Script for the CATALINA Server
+#
+# $Id$
+# -----------------------------------------------------------------------------
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+PRGDIR=`dirname "$PRG"`
+EXECUTABLE=catalina.sh
+
+# Check that target executable exists
+if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
+ echo "Cannot find $PRGDIR/$EXECUTABLE"
+ echo "This file is needed to run this program"
+ exit 1
+fi
+
+exec "$PRGDIR"/"$EXECUTABLE" start "$@"
diff --git a/container/catalina/src/bin/tool-wrapper-using-launcher.bat b/container/catalina/src/bin/tool-wrapper-using-launcher.bat
new file mode 100644
index 0000000..08b6586
--- /dev/null
+++ b/container/catalina/src/bin/tool-wrapper-using-launcher.bat
@@ -0,0 +1,40 @@
+@echo off
+if "%OS%" == "Windows_NT" setlocal
+
+rem ---------------------------------------------------------------------------
+rem
+rem Script for running the Catalina tool wrapper using the Launcher
+rem
+rem ---------------------------------------------------------------------------
+
+rem Get standard environment variables
+set PRG=%0
+if exist %PRG%\..\setenv.bat goto gotCmdPath
+rem %0 must have been found by DOS using the %PATH% so we assume that
+rem setenv.bat will also be found in the %PATH%
+call setenv.bat
+goto doneSetenv
+:gotCmdPath
+call %PRG%\..\setenv.bat
+:doneSetenv
+
+rem Make sure prerequisite environment variables are set
+if not "%JAVA_HOME%" == "" goto gotJavaHome
+echo The JAVA_HOME environment variable is not defined
+echo This environment variable is needed to run this program
+goto end
+:gotJavaHome
+
+rem Get command line arguments and save them with the proper quoting
+set CMD_LINE_ARGS=
+:setArgs
+if ""%1""=="""" goto doneSetArgs
+set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
+shift
+goto setArgs
+:doneSetArgs
+
+rem Execute the Launcher using the "tool-wrapper" target
+"%JAVA_HOME%\bin\java.exe" -classpath %PRG%\..;"%PATH%";. LauncherBootstrap -launchfile catalina.xml -verbose tool-wrapper %CMD_LINE_ARGS%
+
+:end
diff --git a/container/catalina/src/bin/tool-wrapper-using-launcher.sh b/container/catalina/src/bin/tool-wrapper-using-launcher.sh
new file mode 100644
index 0000000..4b286cc
--- /dev/null
+++ b/container/catalina/src/bin/tool-wrapper-using-launcher.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# -----------------------------------------------------------------------------
+#
+# Script for running the Catalina tool wrapper using the Launcher
+#
+# -----------------------------------------------------------------------------
+
+# Resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ]; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+# Get standard environment variables
+PRGDIR=`dirname "$PRG"`
+if [ -r "$PRGDIR"/setenv.sh ]; then
+ . "$PRGDIR"/setenv.sh
+fi
+
+# Execute the Launcher using the "tool-wrapper" target
+exec "$JAVA_HOME"/bin/java -classpath "$PRGDIR" LauncherBootstrap -launchfile catalina.xml -verbose tool-wrapper "$@"
diff --git a/container/catalina/src/bin/tool-wrapper.bat b/container/catalina/src/bin/tool-wrapper.bat
new file mode 100644
index 0000000..029fda7
--- /dev/null
+++ b/container/catalina/src/bin/tool-wrapper.bat
@@ -0,0 +1,59 @@
+@echo off
+if "%OS%" == "Windows_NT" setlocal
+rem ---------------------------------------------------------------------------
+rem Wrapper script for command line tools
+rem
+rem Environment Variable Prequisites
+rem
+rem CATALINA_HOME May point at your Catalina "build" directory.
+rem
+rem TOOL_OPTS (Optional) Java runtime options used when the "start",
+rem "stop", or "run" command is executed.
+rem
+rem JAVA_HOME Must point at your Java Development Kit installation.
+rem
+rem JAVA_OPTS (Optional) Java runtime options used when the "start",
+rem "stop", or "run" command is executed.
+rem
+rem $Id$
+rem ---------------------------------------------------------------------------
+
+rem Guess CATALINA_HOME if not defined
+if not "%CATALINA_HOME%" == "" goto gotHome
+set CATALINA_HOME=.
+if exist "%CATALINA_HOME%\bin\tool-wrapper.bat" goto okHome
+set CATALINA_HOME=..
+:gotHome
+if exist "%CATALINA_HOME%\bin\tool-wrapper.bat" goto okHome
+echo The CATALINA_HOME environment variable is not defined correctly
+echo This environment variable is needed to run this program
+goto end
+:okHome
+
+rem Get standard environment variables
+if exist "%CATALINA_HOME%\bin\setenv.bat" call "%CATALINA_HOME%\bin\setenv.bat"
+
+rem Get standard Java environment variables
+if exist "%CATALINA_HOME%\bin\setclasspath.bat" goto okSetclasspath
+echo Cannot find %CATALINA_HOME%\bin\setclasspath.bat
+echo This file is needed to run this program
+goto end
+:okSetclasspath
+set BASEDIR=%CATALINA_HOME%
+call "%CATALINA_HOME%\bin\setclasspath.bat"
+
+rem Add on extra jar files to CLASSPATH
+set CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\bootstrap.jar;"%BASEDIR%"\common\lib\jmx.jar
+
+rem Get remaining unshifted command line arguments and save them in the
+set CMD_LINE_ARGS=
+:setArgs
+if ""%1""=="""" goto doneSetArgs
+set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
+shift
+goto setArgs
+:doneSetArgs
+
+%_RUNJAVA% %JAVA_OPTS% %TOOL_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.home="%CATALINA_HOME%" org.apache.catalina.startup.Tool %CMD_LINE_ARGS%
+
+:end
diff --git a/container/catalina/src/bin/tool-wrapper.sh b/container/catalina/src/bin/tool-wrapper.sh
new file mode 100644
index 0000000..ee7b18a
--- /dev/null
+++ b/container/catalina/src/bin/tool-wrapper.sh
@@ -0,0 +1,78 @@
+#!/bin/sh
+# -----------------------------------------------------------------------------
+# Wrapper script for command line tools
+#
+# Environment Variable Prequisites
+#
+# CATALINA_HOME May point at your Catalina "build" directory.
+#
+# TOOL_OPTS (Optional) Java runtime options used when the "start",
+# "stop", or "run" command is executed.
+#
+# JAVA_HOME Must point at your Java Development Kit installation.
+#
+# JAVA_OPTS (Optional) Java runtime options used when the "start",
+# "stop", or "run" command is executed.
+#
+# $Id$
+# -----------------------------------------------------------------------------
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false
+case "`uname`" in
+CYGWIN*) cygwin=true;;
+esac
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ]; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+# Get standard environment variables
+PRGDIR=`dirname "$PRG"`
+CATALINA_HOME=`cd "$PRGDIR/.." ; pwd`
+if [ -r "$CATALINA_HOME"/bin/setenv.sh ]; then
+ . "$CATALINA_HOME"/bin/setenv.sh
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CATALINA_HOME" ] && CATALINA_HOME=`cygpath --unix "$CATALINA_HOME"`
+ [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# Get standard Java environment variables
+if [ -r "$CATALINA_HOME"/bin/setclasspath.sh ]; then
+ BASEDIR="$CATALINA_HOME"
+ . "$CATALINA_HOME"/bin/setclasspath.sh
+else
+ echo "Cannot find $CATALINA_HOME/bin/setclasspath.sh"
+ echo "This file is needed to run this program"
+ exit 1
+fi
+
+# Add on extra jar files to CLASSPATH
+CLASSPATH="$CLASSPATH":"$CATALINA_HOME"/bin/bootstrap.jar:"$BASEDIR"/common/lib/jmx.jar
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ CATALINA_HOME=`cygpath --path --windows "$CATALINA_HOME"`
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+fi
+
+# ----- Execute The Requested Command -----------------------------------------
+
+exec "$_RUNJAVA" $JAVA_OPTS $TOOL_OPTS \
+ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
+ -Dcatalina.home="$CATALINA_HOME" \
+ org.apache.catalina.startup.Tool "$@"
diff --git a/container/catalina/src/bin/version.bat b/container/catalina/src/bin/version.bat
new file mode 100755
index 0000000..b14be9f
--- /dev/null
+++ b/container/catalina/src/bin/version.bat
@@ -0,0 +1,44 @@
+@echo off
+if "%OS%" == "Windows_NT" setlocal
+rem ---------------------------------------------------------------------------
+rem Version script for the CATALINA Server
+rem
+rem $Id$
+rem ---------------------------------------------------------------------------
+
+rem Guess CATALINA_HOME if not defined
+set CURRENT_DIR=%cd%
+if not "%CATALINA_HOME%" == "" goto gotHome
+set CATALINA_HOME=%CURRENT_DIR%
+if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
+cd ..
+set CATALINA_HOME=%cd%
+cd %CURRENT_DIR%
+:gotHome
+if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
+echo The CATALINA_HOME environment variable is not defined correctly
+echo This environment variable is needed to run this program
+goto end
+:okHome
+
+set EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat
+
+rem Check that target executable exists
+if exist "%EXECUTABLE%" goto okExec
+echo Cannot find %EXECUTABLE%
+echo This file is needed to run this program
+goto end
+:okExec
+
+rem Get remaining unshifted command line arguments and save them in the
+set CMD_LINE_ARGS=
+:setArgs
+if ""%1""=="""" goto doneSetArgs
+set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
+shift
+goto setArgs
+:doneSetArgs
+
+call "%EXECUTABLE%" version %CMD_LINE_ARGS%
+
+:end
diff --git a/container/catalina/src/bin/version.sh b/container/catalina/src/bin/version.sh
new file mode 100755
index 0000000..751a55e
--- /dev/null
+++ b/container/catalina/src/bin/version.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+# -----------------------------------------------------------------------------
+# Version Script for the CATALINA Server
+#
+# $Id$
+# -----------------------------------------------------------------------------
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+PRGDIR=`dirname "$PRG"`
+EXECUTABLE=catalina.sh
+
+# Check that target executable exists
+if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
+ echo "Cannot find $PRGDIR/$EXECUTABLE"
+ echo "This file is needed to run this program"
+ exit 1
+fi
+
+exec "$PRGDIR"/"$EXECUTABLE" version "$@"
diff --git a/container/catalina/src/conf/catalina.policy b/container/catalina/src/conf/catalina.policy
new file mode 100644
index 0000000..2da9748
--- /dev/null
+++ b/container/catalina/src/conf/catalina.policy
@@ -0,0 +1,162 @@
+// ============================================================================
+// catalina.corepolicy - Security Policy Permissions for Tomcat 5
+//
+// This file contains a default set of security policies to be enforced (by the
+// JVM) when Catalina is executed with the "-security" option. In addition
+// to the permissions granted here, the following additional permissions are
+// granted to the codebase specific to each web application:
+//
+// * Read access to the document root directory
+//
+// $Id$
+// ============================================================================
+
+
+// ========== SYSTEM CODE PERMISSIONS =========================================
+
+
+// These permissions apply to javac
+grant codeBase "file:${java.home}/lib/-" {
+ permission java.security.AllPermission;
+};
+
+// These permissions apply to all shared system extensions
+grant codeBase "file:${java.home}/jre/lib/ext/-" {
+ permission java.security.AllPermission;
+};
+
+// These permissions apply to javac when ${java.home] points at $JAVA_HOME/jre
+grant codeBase "file:${java.home}/../lib/-" {
+ permission java.security.AllPermission;
+};
+
+// These permissions apply to all shared system extensions when
+// ${java.home} points at $JAVA_HOME/jre
+grant codeBase "file:${java.home}/lib/ext/-" {
+ permission java.security.AllPermission;
+};
+
+
+// ========== CATALINA CODE PERMISSIONS =======================================
+
+
+// These permissions apply to the launcher code
+grant codeBase "file:${catalina.home}/bin/commons-launcher.jar" {
+ permission java.security.AllPermission;
+};
+
+// These permissions apply to the daemon code
+grant codeBase "file:${catalina.home}/bin/commons-daemon.jar" {
+ permission java.security.AllPermission;
+};
+
+// These permissions apply to the commons-logging API
+grant codeBase "file:${catalina.home}/bin/commons-logging-api.jar" {
+ permission java.security.AllPermission;
+};
+
+// These permissions apply to the server startup code
+grant codeBase "file:${catalina.home}/bin/bootstrap.jar" {
+ permission java.security.AllPermission;
+};
+
+// These permissions apply to the JMX server
+grant codeBase "file:${catalina.home}/bin/jmx.jar" {
+ permission java.security.AllPermission;
+};
+
+// These permissions apply to the servlet API classes
+// and those that are shared across all class loaders
+// located in the "common" directory
+grant codeBase "file:${catalina.home}/common/-" {
+ permission java.security.AllPermission;
+};
+
+// These permissions apply to the container's core code, plus any additional
+// libraries installed in the "server" directory
+grant codeBase "file:${catalina.home}/server/-" {
+ permission java.security.AllPermission;
+};
+
+// ========== WEB APPLICATION PERMISSIONS =====================================
+
+
+// These permissions are granted by default to all web applications
+// In addition, a web application will be given a read FilePermission
+// and JndiPermission for all files and directories in its document root.
+grant {
+ // Required for JNDI lookup of named JDBC DataSource's and
+ // javamail named MimePart DataSource used to send mail
+ permission java.util.PropertyPermission "java.home", "read";
+ permission java.util.PropertyPermission "java.naming.*", "read";
+ permission java.util.PropertyPermission "javax.sql.*", "read";
+
+ // OS Specific properties to allow read access
+ permission java.util.PropertyPermission "os.name", "read";
+ permission java.util.PropertyPermission "os.version", "read";
+ permission java.util.PropertyPermission "os.arch", "read";
+ permission java.util.PropertyPermission "file.separator", "read";
+ permission java.util.PropertyPermission "path.separator", "read";
+ permission java.util.PropertyPermission "line.separator", "read";
+
+ // JVM properties to allow read access
+ permission java.util.PropertyPermission "java.version", "read";
+ permission java.util.PropertyPermission "java.vendor", "read";
+ permission java.util.PropertyPermission "java.vendor.url", "read";
+ permission java.util.PropertyPermission "java.class.version", "read";
+ permission java.util.PropertyPermission "java.specification.version", "read";
+ permission java.util.PropertyPermission "java.specification.vendor", "read";
+ permission java.util.PropertyPermission "java.specification.name", "read";
+
+ permission java.util.PropertyPermission "java.vm.specification.version", "read";
+ permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
+ permission java.util.PropertyPermission "java.vm.specification.name", "read";
+ permission java.util.PropertyPermission "java.vm.version", "read";
+ permission java.util.PropertyPermission "java.vm.vendor", "read";
+ permission java.util.PropertyPermission "java.vm.name", "read";
+
+ // Required for OpenJMX
+ permission java.lang.RuntimePermission "getAttribute";
+
+ // Allow read of JAXP compliant XML parser debug
+ permission java.util.PropertyPermission "jaxp.debug", "read";
+
+ // Precompiled JSPs need access to this package.
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.runtime";
+ permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.runtime.*";
+
+};
+
+
+// You can assign additional permissions to particular web applications by
+// adding additional "grant" entries here, based on the code base for that
+// application, /WEB-INF/classes/, or /WEB-INF/lib/ jar files.
+//
+// Different permissions can be granted to JSP pages, classes loaded from
+// the /WEB-INF/classes/ directory, all jar files in the /WEB-INF/lib/
+// directory, or even to individual jar files in the /WEB-INF/lib/ directory.
+//
+// For instance, assume that the standard "examples" application
+// included a JDBC driver that needed to establish a network connection to the
+// corresponding database and used the scrape taglib to get the weather from
+// the NOAA web server. You might create a "grant" entries like this:
+//
+// The permissions granted to the context root directory apply to JSP pages.
+// grant codeBase "file:${catalina.home}/webapps/examples/-" {
+// permission java.net.SocketPermission "dbhost.mycompany.com:5432", "connect";
+// permission java.net.SocketPermission "*.noaa.gov:80", "connect";
+// };
+//
+// The permissions granted to the context WEB-INF/classes directory
+// grant codeBase "file:${catalina.home}/webapps/examples/WEB-INF/classes/-" {
+// };
+//
+// The permission granted to your JDBC driver
+// grant codeBase "jar:file:${catalina.home}/webapps/examples/WEB-INF/lib/driver.jar!/-" {
+// permission java.net.SocketPermission "dbhost.mycompany.com:5432", "connect";
+// };
+// The permission granted to the scrape taglib
+// grant codeBase "jar:file:${catalina.home}/webapps/examples/WEB-INF/lib/scrape.jar!/-" {
+// permission java.net.SocketPermission "*.noaa.gov:80", "connect";
+// };
+
diff --git a/container/catalina/src/conf/catalina.properties b/container/catalina/src/conf/catalina.properties
new file mode 100644
index 0000000..653294d
--- /dev/null
+++ b/container/catalina/src/conf/catalina.properties
@@ -0,0 +1,57 @@
+#
+# List of comma-separated packages that start with or equal this string
+# will cause a security exception to be thrown when
+# passed to checkPackageAccess unless the
+# corresponding RuntimePermission ("accessClassInPackage."+package) has
+# been granted.
+package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.,sun.beans.
+#
+# List of comma-separated packages that start with or equal this string
+# will cause a security exception to be thrown when
+# passed to checkPackageDefinition unless the
+# corresponding RuntimePermission ("defineClassInPackage."+package) has
+# been granted.
+#
+# by default, no packages are restricted for definition, and none of
+# the class loaders supplied with the JDK call checkPackageDefinition.
+#
+package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.
+
+#
+#
+# List of comma-separated paths defining the contents of the "common"
+# classloader. Prefixes should be used to define what is the repository type.
+# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute.
+# If left as blank,the JVM system loader will be used as Catalina's "common"
+# loader.
+# Examples:
+# "foo": Add this folder as a class repository
+# "foo/*.jar": Add all the JARs of the specified folder as class
+# repositories
+# "foo/bar.jar": Add bar.jar as a class repository
+common.loader=${catalina.home}/common/classes,${catalina.home}/common/i18n/*.jar,${catalina.home}/common/endorsed/*.jar,${catalina.home}/common/lib/*.jar
+
+#
+# List of comma-separated paths defining the contents of the "server"
+# classloader. Prefixes should be used to define what is the repository type.
+# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute.
+# If left as blank, the "common" loader will be used as Catalina's "server"
+# loader.
+# Examples:
+# "foo": Add this folder as a class repository
+# "foo/*.jar": Add all the JARs of the specified folder as class
+# repositories
+# "foo/bar.jar": Add bar.jar as a class repository
+server.loader=${catalina.home}/server/classes,${catalina.home}/server/lib/*.jar
+
+#
+# List of comma-separated paths defining the contents of the "shared"
+# classloader. Prefixes should be used to define what is the repository type.
+# Path may be relative to the CATALINA_BASE path or absolute. If left as blank,
+# the "common" loader will be used as Catalina's "shared" loader.
+# Examples:
+# "foo": Add this folder as a class repository
+# "foo/*.jar": Add all the JARs of the specified folder as class
+# repositories
+# "foo/bar.jar": Add bar.jar as a class repository
+shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar
diff --git a/container/catalina/src/conf/context.xml b/container/catalina/src/conf/context.xml
new file mode 100644
index 0000000..f4c4455
--- /dev/null
+++ b/container/catalina/src/conf/context.xml
@@ -0,0 +1,13 @@
+<!-- The contents of this file will be loaded for each web application -->
+<Context>
+
+ <!-- Default set of monitored resources -->
+ <WatchedResource>WEB-INF/web.xml</WatchedResource>
+ <WatchedResource>META-INF/context.xml</WatchedResource>
+
+ <!-- Uncomment this to disable session persistence across Tomcat restarts -->
+ <!--
+ <Manager pathname="" />
+ -->
+
+</Context>
\ No newline at end of file
diff --git a/container/catalina/src/conf/server-minimal.xml b/container/catalina/src/conf/server-minimal.xml
new file mode 100644
index 0000000..7b542b6
--- /dev/null
+++ b/container/catalina/src/conf/server-minimal.xml
@@ -0,0 +1,25 @@
+<Server port="8005" shutdown="SHUTDOWN">
+
+ <GlobalNamingResources>
+ <!-- Used by Manager webapp -->
+ <Resource name="UserDatabase" auth="Container"
+ type="org.apache.catalina.UserDatabase"
+ description="User database that can be updated and saved"
+ factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
+ pathname="conf/tomcat-users.xml" />
+ </GlobalNamingResources>
+
+ <Service name="Catalina">
+ <Connector port="8080" />
+
+ <!-- This is here for compatibility only, not required -->
+ <Connector port="8009" protocol="AJP/1.3" />
+
+ <Engine name="Catalina" defaultHost="localhost">
+ <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
+ resourceName="UserDatabase" />
+ <Host name="localhost" appBase="webapps" />
+ </Engine>
+
+ </Service>
+</Server>
diff --git a/container/catalina/src/conf/server.xml b/container/catalina/src/conf/server.xml
new file mode 100644
index 0000000..4fedef5
--- /dev/null
+++ b/container/catalina/src/conf/server.xml
@@ -0,0 +1,359 @@
+<!-- Example Server Configuration File -->
+<!-- Note that component elements are nested corresponding to their
+ parent-child relationships with each other -->
+
+<!-- A "Server" is a singleton element that represents the entire JVM,
+ which may contain one or more "Service" instances. The Server
+ listens for a shutdown command on the indicated port.
+
+ Note: A "Server" is not itself a "Container", so you may not
+ define subcomponents such as "Valves" or "Loggers" at this level.
+ -->
+
+<Server port="8005" shutdown="SHUTDOWN" debug="0">
+
+
+ <!-- Comment these entries out to disable JMX MBeans support -->
+ <!-- You may also configure custom components (e.g. Valves/Realms) by
+ including your own mbean-descriptor file(s), and setting the
+ "descriptors" attribute to point to a ';' seperated list of paths
+ (in the ClassLoader sense) of files to add to the default list.
+ e.g. descriptors="/com/myfirm/mypackage/mbean-descriptor.xml"
+ -->
+ <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
+ debug="0"/>
+ <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
+ debug="0"/>
+
+ <!-- Global JNDI resources -->
+ <GlobalNamingResources>
+
+ <!-- Test entry for demonstration purposes -->
+ <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
+
+ <!-- Editable user database that can also be used by
+ UserDatabaseRealm to authenticate users -->
+ <Resource name="UserDatabase" auth="Container"
+ type="org.apache.catalina.UserDatabase"
+ description="User database that can be updated and saved"
+ factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
+ pathname="conf/tomcat-users.xml" />
+
+ </GlobalNamingResources>
+
+ <!-- A "Service" is a collection of one or more "Connectors" that share
+ a single "Container" (and therefore the web applications visible
+ within that Container). Normally, that Container is an "Engine",
+ but this is not required.
+
+ Note: A "Service" is not itself a "Container", so you may not
+ define subcomponents such as "Valves" or "Loggers" at this level.
+ -->
+
+ <!-- Define the Tomcat Stand-Alone Service -->
+ <Service name="Catalina">
+
+ <!-- A "Connector" represents an endpoint by which requests are received
+ and responses are returned. Each Connector passes requests on to the
+ associated "Container" (normally an Engine) for processing.
+
+ By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
+ You can also enable an SSL HTTP/1.1 Connector on port 8443 by
+ following the instructions below and uncommenting the second Connector
+ entry. SSL support requires the following steps (see the SSL Config
+ HOWTO in the Tomcat 5 documentation bundle for more detailed
+ instructions):
+ * If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
+ later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".
+ * Execute:
+ %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
+ $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)
+ with a password value of "changeit" for both the certificate and
+ the keystore itself.
+
+ By default, DNS lookups are enabled when a web application calls
+ request.getRemoteHost(). This can have an adverse impact on
+ performance, so you can disable it by setting the
+ "enableLookups" attribute to "false". When DNS lookups are disabled,
+ request.getRemoteHost() will return the String version of the
+ IP address of the remote client.
+ -->
+
+ <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
+ <Connector port="8080"
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+ enableLookups="false" redirectPort="8443" acceptCount="100"
+ debug="0" connectionTimeout="20000"
+ disableUploadTimeout="true" />
+ <!-- Note : To disable connection timeouts, set connectionTimeout value
+ to 0 -->
+
+ <!-- Note : To use gzip compression you could set the following properties :
+
+ compression="on"
+ compressionMinSize="2048"
+ noCompressionUserAgents="gozilla, traviata"
+ compressableMimeType="text/html,text/xml"
+ -->
+
+ <!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
+ <!--
+ <Connector port="8443"
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+ enableLookups="false" disableUploadTimeout="true"
+ acceptCount="100" debug="0" scheme="https" secure="true"
+ clientAuth="false" sslProtocol="TLS" />
+ -->
+
+ <!-- Define an AJP 1.3 Connector on port 8009 -->
+ <Connector port="8009"
+ enableLookups="false" redirectPort="8443" debug="0"
+ protocol="AJP/1.3" />
+
+ <!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
+ <!-- See proxy documentation for more information about using this. -->
+ <!--
+ <Connector port="8082"
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+ enableLookups="false"
+ acceptCount="100" debug="0" connectionTimeout="20000"
+ proxyPort="80" disableUploadTimeout="true" />
+ -->
+
+ <!-- An Engine represents the entry point (within Catalina) that processes
+ every request. The Engine implementation for Tomcat stand alone
+ analyzes the HTTP headers included with the request, and passes them
+ on to the appropriate Host (virtual host). -->
+
+ <!-- You should set jvmRoute to support load-balancing via AJP ie :
+ <Engine name="Standalone" defaultHost="localhost" debug="0" jvmRoute="jvm1">
+ -->
+
+ <!-- Define the top level container in our container hierarchy -->
+ <Engine name="Catalina" defaultHost="localhost" debug="0">
+
+ <!-- The request dumper valve dumps useful debugging information about
+ the request headers and cookies that were received, and the response
+ headers and cookies that were sent, for all requests received by
+ this instance of Tomcat. If you care only about requests to a
+ particular virtual host, or a particular application, nest this
+ element inside the corresponding <Host> or <Context> entry instead.
+
+ For a similar mechanism that is portable to all Servlet 2.4
+ containers, check out the "RequestDumperFilter" Filter in the
+ example application (the source for this filter may be found in
+ "$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").
+
+ Request dumping is disabled by default. Uncomment the following
+ element to enable it. -->
+ <!--
+ <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
+ -->
+
+ <!-- Because this Realm is here, an instance will be shared globally -->
+
+ <!-- This Realm uses the UserDatabase configured in the global JNDI
+ resources under the key "UserDatabase". Any edits
+ that are performed against this UserDatabase are immediately
+ available for use by the Realm. -->
+ <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
+ debug="0" resourceName="UserDatabase"/>
+
+ <!-- Comment out the old realm but leave here for now in case we
+ need to go back quickly -->
+ <!--
+ <Realm className="org.apache.catalina.realm.MemoryRealm" />
+ -->
+
+ <!-- Replace the above Realm with one of the following to get a Realm
+ stored in a database and accessed via JDBC -->
+
+ <!--
+ <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
+ driverName="org.gjt.mm.mysql.Driver"
+ connectionURL="jdbc:mysql://localhost/authority"
+ connectionName="test" connectionPassword="test"
+ userTable="users" userNameCol="user_name" userCredCol="user_pass"
+ userRoleTable="user_roles" roleNameCol="role_name" />
+ -->
+
+ <!--
+ <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
+ driverName="oracle.jdbc.driver.OracleDriver"
+ connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
+ connectionName="scott" connectionPassword="tiger"
+ userTable="users" userNameCol="user_name" userCredCol="user_pass"
+ userRoleTable="user_roles" roleNameCol="role_name" />
+ -->
+
+ <!--
+ <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
+ driverName="sun.jdbc.odbc.JdbcOdbcDriver"
+ connectionURL="jdbc:odbc:CATALINA"
+ userTable="users" userNameCol="user_name" userCredCol="user_pass"
+ userRoleTable="user_roles" roleNameCol="role_name" />
+ -->
+
+ <!-- Define the default virtual host
+ Note: XML Schema validation will not work with Xerces 2.2.
+ -->
+ <Host name="localhost" debug="0" appBase="webapps"
+ unpackWARs="true" autoDeploy="true"
+ xmlValidation="false" xmlNamespaceAware="false">
+
+ <!-- Defines a cluster for this node,
+ By defining this element, means that every manager will be changed.
+ So when running a cluster, only make sure that you have webapps in there
+ that need to be clustered and remove the other ones.
+ A cluster has the following parameters:
+
+ className = the fully qualified name of the cluster class
+
+ name = a descriptive name for your cluster, can be anything
+
+ debug = the debug level, higher means more output
+
+ mcastAddr = the multicast address, has to be the same for all the nodes
+
+ mcastPort = the multicast port, has to be the same for all the nodes
+
+ mcastBindAddr = bind the multicast socket to a specific address
+
+ mcastTTL = the multicast TTL if you want to limit your broadcast
+
+ mcastSoTimeout = the multicast readtimeout
+
+ mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat
+
+ mcastDropTime = the number a milliseconds before a node is considered "dead" if no heartbeat is received
+
+ tcpThreadCount = the number of threads to handle incoming replication requests, optimal would be the same amount of threads as nodes
+
+ tcpListenAddress = the listen address (bind address) for TCP cluster request on this host,
+ in case of multiple ethernet cards.
+ auto means that address becomes
+ InetAddress.getLocalHost().getHostAddress()
+
+ tcpListenPort = the tcp listen port
+
+ tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS
+ has a wakup bug in java.nio. Set to 0 for no timeout
+
+ printToScreen = true means that managers will also print to std.out
+
+ expireSessionsOnShutdown = true means that
+
+ useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has been called.
+ false means to replicate the session after each request.
+ false means that replication would work for the following piece of code:
+ <%
+ HashMap map = (HashMap)session.getAttribute("map");
+ map.put("key","value");
+ %>
+ replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.
+ * Pooled means that the replication happens using several sockets in a synchronous way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To use this, also increase the nr of tcp threads that you have dealing with replication.
+ * Synchronous means that the thread that executes the request, is also the
+ thread the replicates the data to the other nodes, and will not return until all
+ nodes have received the information.
+ * Asynchronous means that there is a specific 'sender' thread for each cluster node,
+ so the request thread will queue the replication request into a "smart" queue,
+ and then return to the client.
+ The "smart" queue is a queue where when a session is added to the queue, and the same session
+ already exists in the queue from a previous request, that session will be replaced
+ in the queue instead of replicating two requests. This almost never happens, unless there is a
+ large network delay.
+ -->
+ <!--
+ When configuring for clustering, you also add in a valve to catch all the requests
+ coming in, at the end of the request, the session may or may not be replicated.
+ A session is replicated if and only if all the conditions are met:
+ 1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND
+ 2. a session exists (has been created)
+ 3. the request is not trapped by the "filter" attribute
+
+ The filter attribute is to filter out requests that could not modify the session,
+ hence we don't replicate the session after the end of this request.
+ The filter is negative, ie, anything you put in the filter, you mean to filter out,
+ ie, no replication will be done on requests that match one of the filters.
+ The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to.
+
+ filter=".*\.gif;.*\.js;" means that we will not replicate the session after requests with the URI
+ ending with .gif and .js are intercepted.
+
+ The deployer element can be used to deploy apps cluster wide.
+ Currently the deployment only deploys/undeploys to working members in the cluster
+ so no WARs are copied upons startup of a broken node.
+ The deployer watches a directory (watchDir) for WAR files when watchEnabled="true"
+ When a new war file is added the war gets deployed to the local instance,
+ and then deployed to the other instances in the cluster.
+ When a war file is deleted from the watchDir the war is undeployed locally
+ and cluster wide
+ -->
+
+ <!--
+ <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
+ managerClassName="org.apache.catalina.cluster.session.DeltaManager"
+ expireSessionsOnShutdown="false"
+ useDirtyFlag="true">
+
+ <Membership
+ className="org.apache.catalina.cluster.mcast.McastService"
+ mcastAddr="228.0.0.4"
+ mcastPort="45564"
+ mcastFrequency="500"
+ mcastDropTime="3000"/>
+
+ <Receiver
+ className="org.apache.catalina.cluster.tcp.ReplicationListener"
+ tcpListenAddress="auto"
+ tcpListenPort="4001"
+ tcpSelectorTimeout="100"
+ tcpThreadCount="6"/>
+
+ <Sender
+ className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
+ replicationMode="pooled"/>
+
+ <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
+ filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
+
+ <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
+ tempDir="/tmp/war-temp/"
+ deployDir="/tmp/war-deploy/"
+ watchDir="/tmp/war-listen/"
+ watchEnabled="false"/>
+ </Cluster>
+ -->
+
+
+
+ <!-- Normally, users must authenticate themselves to each web app
+ individually. Uncomment the following entry if you would like
+ a user to be authenticated the first time they encounter a
+ resource protected by a security constraint, and then have that
+ user identity maintained across *all* web applications contained
+ in this virtual host. -->
+ <!--
+ <Valve className="org.apache.catalina.authenticator.SingleSignOn"
+ debug="0"/>
+ -->
+
+ <!-- Access log processes all requests for this virtual host. By
+ default, log files are created in the "logs" directory relative to
+ $CATALINA_HOME. If you wish, you can specify a different
+ directory with the "directory" attribute. Specify either a relative
+ (to $CATALINA_HOME) or absolute path to the desired directory.
+ -->
+ <!--
+ <Valve className="org.apache.catalina.valves.AccessLogValve"
+ directory="logs" prefix="localhost_access_log." suffix=".txt"
+ pattern="common" resolveHosts="false"/>
+ -->
+
+ </Host>
+
+ </Engine>
+
+ </Service>
+
+</Server>
diff --git a/container/catalina/src/conf/tomcat-users.xml b/container/catalina/src/conf/tomcat-users.xml
new file mode 100644
index 0000000..388cfc9
--- /dev/null
+++ b/container/catalina/src/conf/tomcat-users.xml
@@ -0,0 +1,10 @@
+<!--
+ NOTE: By default, no user is included in the "manager" role required
+ to operate the "/manager" web application. If you wish to use this app,
+ you must define such a user - the username and password are arbitrary.
+-->
+<tomcat-users>
+ <user name="tomcat" password="tomcat" roles="tomcat" />
+ <user name="role1" password="tomcat" roles="role1" />
+ <user name="both" password="tomcat" roles="tomcat,role1" />
+</tomcat-users>
diff --git a/container/catalina/src/conf/web.xml b/container/catalina/src/conf/web.xml
new file mode 100644
index 0000000..cb0bc17
--- /dev/null
+++ b/container/catalina/src/conf/web.xml
@@ -0,0 +1,943 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <!-- ======================== Introduction ============================== -->
+ <!-- This document defines default values for *all* web applications -->
+ <!-- loaded into this instance of Tomcat. As each application is -->
+ <!-- deployed, this file is processed, followed by the -->
+ <!-- "/WEB-INF/web.xml" deployment descriptor from your own -->
+ <!-- applications. -->
+ <!-- -->
+ <!-- WARNING: Do not configure application-specific resources here! -->
+ <!-- They should go in the "/WEB-INF/web.xml" file in your application. -->
+
+
+ <!-- ================== Built In Servlet Definitions ==================== -->
+
+
+ <!-- The default servlet for all web applications, that serves static -->
+ <!-- resources. It processes all requests that are not mapped to other -->
+ <!-- servlets with servlet mappings (defined either here or in your own -->
+ <!-- web.xml file. This servlet supports the following initialization -->
+ <!-- parameters (default values are in square brackets): -->
+ <!-- -->
+ <!-- debug Debugging detail level for messages logged -->
+ <!-- by this servlet. [0] -->
+ <!-- -->
+ <!-- input Input buffer size (in bytes) when reading -->
+ <!-- resources to be served. [2048] -->
+ <!-- -->
+ <!-- listings Should directory listings be produced if there -->
+ <!-- is no welcome file in this directory? [true] -->
+ <!-- -->
+ <!-- output Output buffer size (in bytes) when writing -->
+ <!-- resources to be served. [2048] -->
+ <!-- -->
+ <!-- readonly Is this context "read only", so HTTP -->
+ <!-- commands like PUT and DELETE are -->
+ <!-- rejected? [true] -->
+ <!-- -->
+ <!-- readmeFile File name to display with the directory -->
+ <!-- contents. [null] -->
+ <!-- -->
+ <!-- For directory listing customization. Checks localXsltFile, then -->
+ <!-- globalXsltFile, then defaults to original behavior. -->
+ <!-- -->
+ <!-- localXsltFile Make directory listings an XML doc and -->
+ <!-- pass the result to this style sheet residing -->
+ <!-- in that directory. This overrides -->
+ <!-- globalXsltFile[null] -->
+ <!-- -->
+ <!-- globalXsltFile Site wide configuration version of -->
+ <!-- localXsltFile This argument is expected -->
+ <!-- to be a physical file. [null] -->
+ <!-- -->
+ <!-- -->
+
+ <servlet>
+ <servlet-name>default</servlet-name>
+ <servlet-class>
+ org.apache.catalina.servlets.DefaultServlet
+ </servlet-class>
+ <init-param>
+ <param-name>debug</param-name>
+ <param-value>0</param-value>
+ </init-param>
+ <init-param>
+ <param-name>listings</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+
+ <!-- The "invoker" servlet, which executes anonymous servlet classes -->
+ <!-- that have not been defined in a web.xml file. Traditionally, this -->
+ <!-- servlet is mapped to the URL pattern "/servlet/*", but you can map -->
+ <!-- it to other patterns as well. The extra path info portion of such a -->
+ <!-- request must be the fully qualified class name of a Java class that -->
+ <!-- implements Servlet (or extends HttpServlet), or the servlet name -->
+ <!-- of an existing servlet definition. This servlet supports the -->
+ <!-- following initialization parameters (default values are in square -->
+ <!-- brackets): -->
+ <!-- -->
+ <!-- debug Debugging detail level for messages logged -->
+ <!-- by this servlet. [0] -->
+
+<!--
+ <servlet>
+ <servlet-name>invoker</servlet-name>
+ <servlet-class>
+ org.apache.catalina.servlets.InvokerServlet
+ </servlet-class>
+ <init-param>
+ <param-name>debug</param-name>
+ <param-value>0</param-value>
+ </init-param>
+ <load-on-startup>2</load-on-startup>
+ </servlet>
+-->
+
+
+ <!-- The JSP page compiler and execution servlet, which is the mechanism -->
+ <!-- used by Tomcat to support JSP pages. Traditionally, this servlet -->
+ <!-- is mapped to the URL pattern "*.jsp". This servlet supports the -->
+ <!-- following initialization parameters (default values are in square -->
+ <!-- brackets): -->
+ <!-- -->
+ <!-- checkInterval If development is false and reloading is true, -->
+ <!-- background compiles are enabled. checkInterval -->
+ <!-- is the time in seconds between checks to see -->
+ <!-- if a JSP page needs to be recompiled. [300] -->
+ <!-- -->
+ <!-- compiler Which compiler Ant should use to compile JSP -->
+ <!-- pages. See the Ant documentation for more -->
+ <!-- information. [javac] -->
+ <!-- -->
+ <!-- classdebuginfo Should the class file be compiled with -->
+ <!-- debugging information? [true] -->
+ <!-- -->
+ <!-- classpath What class path should I use while compiling -->
+ <!-- generated servlets? [Created dynamically -->
+ <!-- based on the current web application] -->
+ <!-- -->
+ <!-- development Is Jasper used in development mode (will check -->
+ <!-- for JSP modification on every access)? [true] -->
+ <!-- -->
+ <!-- enablePooling Determines whether tag handler pooling is -->
+ <!-- enabled [true] -->
+ <!-- -->
+ <!-- fork Tell Ant to fork compiles of JSP pages so that -->
+ <!-- a separate JVM is used for JSP page compiles -->
+ <!-- from the one Tomcat is running in. [true] -->
+ <!-- -->
+ <!-- ieClassId The class-id value to be sent to Internet -->
+ <!-- Explorer when using <jsp:plugin> tags. -->
+ <!-- [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93] -->
+ <!-- -->
+ <!-- javaEncoding Java file encoding to use for generating java -->
+ <!-- source files. [UTF8] -->
+ <!-- -->
+ <!-- keepgenerated Should we keep the generated Java source code -->
+ <!-- for each page instead of deleting it? [true] -->
+ <!-- -->
+ <!-- mappedfile Should we generate static content with one -->
+ <!-- print statement per input line, to ease -->
+ <!-- debugging? [true] -->
+ <!-- -->
+ <!-- trimSpaces Should white spaces in template text between -->
+ <!-- actions or directives be trimmed? [false] -->
+ <!-- -->
+ <!-- reloading Should Jasper check for modified JSPs? [false] -->
+ <!-- -->
+ <!-- suppressSmap Should the generation of SMAP info for JSR45 -->
+ <!-- debugging be suppressed? [false] -->
+ <!-- -->
+ <!-- dumpSmap Should the SMAP info for JSR45 debugging be -->
+ <!-- dumped to a file? [false] -->
+ <!-- False if suppressSmap is true -->
+ <!-- -->
+ <!-- genStrAsCharArray Should text strings be generated as char -->
+ <!-- arrays, to improve performance in some cases? -->
+ <!-- [false] -->
+ <!-- -->
+ <!-- errorOnUseBeanInvalidClassAttribute -->
+ <!-- Should Jasper issue an error when the value of -->
+ <!-- the class attribute in an useBean action is -->
+ <!-- not a valid bean class? [true] -->
+ <!-- -->
+ <!-- scratchdir What scratch directory should we use when -->
+ <!-- compiling JSP pages? [default work directory -->
+ <!-- for the current web application] -->
+ <!-- -->
+ <!-- xpoweredBy Determines whether X-Powered-By response -->
+ <!-- header is added by generated servlet [false] -->
+ <!-- -->
+ <!-- If you wish to use Jikes to compile JSP pages: -->
+ <!-- Set the init parameter "compiler" to "jikes". Define -->
+ <!-- the property "-Dbuild.compiler.emacs=true" when starting Tomcat -->
+ <!-- by adding the above to your CATALINA_OPTS environment variable. -->
+ <!-- If you get an error reporting that jikes can't use UTF8 encoding, -->
+ <!-- try setting the init parameter "javaEncoding" to "ISO-8859-1". -->
+
+ <servlet>
+ <servlet-name>jsp</servlet-name>
+ <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
+ <init-param>
+ <param-name>fork</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>xpoweredBy</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <load-on-startup>3</load-on-startup>
+ </servlet>
+
+
+ <!-- Server Side Includes processing servlet, which processes SSI -->
+ <!-- directives in HTML pages consistent with similar support in web -->
+ <!-- servers like Apache. Traditionally, this servlet is mapped to the -->
+ <!-- URL pattern "*.shtml". This servlet supports the following -->
+ <!-- initialization parameters (default values are in square brackets): -->
+ <!-- -->
+ <!-- buffered Should output from this servlet be buffered? -->
+ <!-- (0=false, 1=true) [0] -->
+ <!-- -->
+ <!-- debug Debugging detail level for messages logged -->
+ <!-- by this servlet. [0] -->
+ <!-- -->
+ <!-- expires The number of seconds before a page with SSI -->
+ <!-- directives will expire. [No default] -->
+ <!-- -->
+ <!-- isVirtualWebappRelative -->
+ <!-- Should "virtual" paths be interpreted as -->
+ <!-- relative to the context root, instead of -->
+ <!-- the server root? (0=false, 1=true) [0] -->
+ <!-- -->
+ <!-- -->
+ <!-- IMPORTANT: To use the SSI servlet, you also need to rename the -->
+ <!-- $CATALINA_HOME/server/lib/servlets-ssi.renametojar file -->
+ <!-- to $CATALINA_HOME/server/lib/servlets-ssi.jar -->
+
+<!--
+ <servlet>
+ <servlet-name>ssi</servlet-name>
+ <servlet-class>
+ org.apache.catalina.ssi.SSIServlet
+ </servlet-class>
+ <init-param>
+ <param-name>buffered</param-name>
+ <param-value>1</param-value>
+ </init-param>
+ <init-param>
+ <param-name>debug</param-name>
+ <param-value>0</param-value>
+ </init-param>
+ <init-param>
+ <param-name>expires</param-name>
+ <param-value>666</param-value>
+ </init-param>
+ <init-param>
+ <param-name>isVirtualWebappRelative</param-name>
+ <param-value>0</param-value>
+ </init-param>
+ <load-on-startup>4</load-on-startup>
+ </servlet>
+-->
+
+
+ <!-- Common Gateway Includes (CGI) processing servlet, which supports -->
+ <!-- execution of external applications that conform to the CGI spec -->
+ <!-- requirements. Typically, this servlet is mapped to the URL pattern -->
+ <!-- "/cgi-bin/*", which means that any CGI applications that are -->
+ <!-- executed must be present within the web application. This servlet -->
+ <!-- supports the following initialization parameters (default values -->
+ <!-- are in square brackets): -->
+ <!-- -->
+ <!-- cgiPathPrefix The CGI search path will start at -->
+ <!-- webAppRootDir + File.separator + this prefix. -->
+ <!-- [WEB-INF/cgi] -->
+ <!-- -->
+ <!-- debug Debugging detail level for messages logged -->
+ <!-- by this servlet. [0] -->
+ <!-- -->
+ <!-- executable Name of the exectuable used to run the -->
+ <!-- script. [perl] -->
+ <!-- -->
+ <!-- parameterEncoding Name of parameter encoding to be used with -->
+ <!-- CGI servlet. -->
+ <!-- [System.getProperty("file.encoding","UTF-8")] -->
+ <!-- -->
+ <!-- passShellEnvironment Should the shell environment variables (if -->
+ <!-- any) be passed to the CGI script? [false] -->
+ <!-- -->
+ <!-- IMPORTANT: To use the CGI servlet, you also need to rename the -->
+ <!-- $CATALINA_HOME/server/lib/servlets-cgi.renametojar file -->
+ <!-- to $CATALINA_HOME/server/lib/servlets-cgi.jar -->
+
+<!--
+ <servlet>
+ <servlet-name>cgi</servlet-name>
+ <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
+ <init-param>
+ <param-name>debug</param-name>
+ <param-value>6</param-value>
+ </init-param>
+ <init-param>
+ <param-name>cgiPathPrefix</param-name>
+ <param-value>WEB-INF/cgi</param-value>
+ </init-param>
+ <load-on-startup>5</load-on-startup>
+ </servlet>
+-->
+
+
+ <!-- ================ Built In Servlet Mappings ========================= -->
+
+
+ <!-- The servlet mappings for the built in servlets defined above. Note -->
+ <!-- that, by default, the CGI and SSI servlets are *not* mapped. You -->
+ <!-- must uncomment these mappings (or add them to your application's own -->
+ <!-- web.xml deployment descriptor) to enable these services -->
+
+ <!-- The mapping for the default servlet -->
+ <servlet-mapping>
+ <servlet-name>default</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+
+ <!-- The mapping for the invoker servlet -->
+<!--
+ <servlet-mapping>
+ <servlet-name>invoker</servlet-name>
+ <url-pattern>/servlet/*</url-pattern>
+ </servlet-mapping>
+-->
+
+ <!-- The mapping for the JSP servlet -->
+ <servlet-mapping>
+ <servlet-name>jsp</servlet-name>
+ <url-pattern>*.jsp</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>jsp</servlet-name>
+ <url-pattern>*.jspx</url-pattern>
+ </servlet-mapping>
+
+ <!-- The mapping for the SSI servlet -->
+<!--
+ <servlet-mapping>
+ <servlet-name>ssi</servlet-name>
+ <url-pattern>*.shtml</url-pattern>
+ </servlet-mapping>
+-->
+
+ <!-- The mapping for the CGI Gateway servlet -->
+
+<!--
+ <servlet-mapping>
+ <servlet-name>cgi</servlet-name>
+ <url-pattern>/cgi-bin/*</url-pattern>
+ </servlet-mapping>
+-->
+
+
+ <!-- ==================== Default Session Configuration ================= -->
+ <!-- You can set the default session timeout (in minutes) for all newly -->
+ <!-- created sessions by modifying the value below. -->
+
+ <session-config>
+ <session-timeout>30</session-timeout>
+ </session-config>
+
+
+ <!-- ===================== Default MIME Type Mappings =================== -->
+ <!-- When serving static resources, Tomcat will automatically generate -->
+ <!-- a "Content-Type" header based on the resource's filename extension, -->
+ <!-- based on these mappings. Additional mappings can be added here (to -->
+ <!-- apply to all web applications), or in your own application's web.xml -->
+ <!-- deployment descriptor. -->
+
+ <mime-mapping>
+ <extension>abs</extension>
+ <mime-type>audio/x-mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ai</extension>
+ <mime-type>application/postscript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aif</extension>
+ <mime-type>audio/x-aiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aifc</extension>
+ <mime-type>audio/x-aiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aiff</extension>
+ <mime-type>audio/x-aiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>aim</extension>
+ <mime-type>application/x-aim</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>art</extension>
+ <mime-type>image/x-jg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>asf</extension>
+ <mime-type>video/x-ms-asf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>asx</extension>
+ <mime-type>video/x-ms-asf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>au</extension>
+ <mime-type>audio/basic</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>avi</extension>
+ <mime-type>video/x-msvideo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>avx</extension>
+ <mime-type>video/x-rad-screenplay</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>bcpio</extension>
+ <mime-type>application/x-bcpio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>bin</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>bmp</extension>
+ <mime-type>image/bmp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>body</extension>
+ <mime-type>text/html</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cdf</extension>
+ <mime-type>application/x-cdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cer</extension>
+ <mime-type>application/x-x509-ca-cert</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>class</extension>
+ <mime-type>application/java</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>cpio</extension>
+ <mime-type>application/x-cpio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>csh</extension>
+ <mime-type>application/x-csh</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>css</extension>
+ <mime-type>text/css</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dib</extension>
+ <mime-type>image/bmp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>doc</extension>
+ <mime-type>application/msword</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dtd</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dv</extension>
+ <mime-type>video/x-dv</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>dvi</extension>
+ <mime-type>application/x-dvi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>eps</extension>
+ <mime-type>application/postscript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>etx</extension>
+ <mime-type>text/x-setext</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>exe</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gif</extension>
+ <mime-type>image/gif</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gtar</extension>
+ <mime-type>application/x-gtar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>gz</extension>
+ <mime-type>application/x-gzip</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>hdf</extension>
+ <mime-type>application/x-hdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>hqx</extension>
+ <mime-type>application/mac-binhex40</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>htc</extension>
+ <mime-type>text/x-component</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>htm</extension>
+ <mime-type>text/html</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>html</extension>
+ <mime-type>text/html</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>hqx</extension>
+ <mime-type>application/mac-binhex40</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ief</extension>
+ <mime-type>image/ief</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jad</extension>
+ <mime-type>text/vnd.sun.j2me.app-descriptor</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jar</extension>
+ <mime-type>application/java-archive</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>java</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jnlp</extension>
+ <mime-type>application/x-java-jnlp-file</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jpe</extension>
+ <mime-type>image/jpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jpeg</extension>
+ <mime-type>image/jpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jpg</extension>
+ <mime-type>image/jpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>js</extension>
+ <mime-type>text/javascript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jsf</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>jspf</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>kar</extension>
+ <mime-type>audio/x-midi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>latex</extension>
+ <mime-type>application/x-latex</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>m3u</extension>
+ <mime-type>audio/x-mpegurl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mac</extension>
+ <mime-type>image/x-macpaint</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>man</extension>
+ <mime-type>application/x-troff-man</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>me</extension>
+ <mime-type>application/x-troff-me</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mid</extension>
+ <mime-type>audio/x-midi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>midi</extension>
+ <mime-type>audio/x-midi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mif</extension>
+ <mime-type>application/x-mif</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mov</extension>
+ <mime-type>video/quicktime</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>movie</extension>
+ <mime-type>video/x-sgi-movie</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mp1</extension>
+ <mime-type>audio/x-mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mp2</extension>
+ <mime-type>audio/x-mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mp3</extension>
+ <mime-type>audio/x-mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpa</extension>
+ <mime-type>audio/x-mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpe</extension>
+ <mime-type>video/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpeg</extension>
+ <mime-type>video/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpega</extension>
+ <mime-type>audio/x-mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpg</extension>
+ <mime-type>video/mpeg</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>mpv2</extension>
+ <mime-type>video/mpeg2</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ms</extension>
+ <mime-type>application/x-wais-source</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>nc</extension>
+ <mime-type>application/x-netcdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>oda</extension>
+ <mime-type>application/oda</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pbm</extension>
+ <mime-type>image/x-portable-bitmap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pct</extension>
+ <mime-type>image/pict</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pdf</extension>
+ <mime-type>application/pdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pgm</extension>
+ <mime-type>image/x-portable-graymap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pic</extension>
+ <mime-type>image/pict</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pict</extension>
+ <mime-type>image/pict</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pls</extension>
+ <mime-type>audio/x-scpls</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>png</extension>
+ <mime-type>image/png</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pnm</extension>
+ <mime-type>image/x-portable-anymap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pnt</extension>
+ <mime-type>image/x-macpaint</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ppm</extension>
+ <mime-type>image/x-portable-pixmap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ppt</extension>
+ <mime-type>application/powerpoint</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ps</extension>
+ <mime-type>application/postscript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>psd</extension>
+ <mime-type>image/x-photoshop</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qt</extension>
+ <mime-type>video/quicktime</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qti</extension>
+ <mime-type>image/x-quicktime</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>qtif</extension>
+ <mime-type>image/x-quicktime</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ras</extension>
+ <mime-type>image/x-cmu-raster</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rgb</extension>
+ <mime-type>image/x-rgb</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rm</extension>
+ <mime-type>application/vnd.rn-realmedia</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>roff</extension>
+ <mime-type>application/x-troff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rtf</extension>
+ <mime-type>application/rtf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>rtx</extension>
+ <mime-type>text/richtext</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sh</extension>
+ <mime-type>application/x-sh</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>shar</extension>
+ <mime-type>application/x-shar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>smf</extension>
+ <mime-type>audio/x-midi</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sit</extension>
+ <mime-type>application/x-stuffit</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>snd</extension>
+ <mime-type>audio/basic</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>src</extension>
+ <mime-type>application/x-wais-source</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sv4cpio</extension>
+ <mime-type>application/x-sv4cpio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>sv4crc</extension>
+ <mime-type>application/x-sv4crc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>swf</extension>
+ <mime-type>application/x-shockwave-flash</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>t</extension>
+ <mime-type>application/x-troff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tar</extension>
+ <mime-type>application/x-tar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tcl</extension>
+ <mime-type>application/x-tcl</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tex</extension>
+ <mime-type>application/x-tex</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>texi</extension>
+ <mime-type>application/x-texinfo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>texinfo</extension>
+ <mime-type>application/x-texinfo</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tif</extension>
+ <mime-type>image/tiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tiff</extension>
+ <mime-type>image/tiff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tr</extension>
+ <mime-type>application/x-troff</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>tsv</extension>
+ <mime-type>text/tab-separated-values</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>txt</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ulw</extension>
+ <mime-type>audio/basic</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ustar</extension>
+ <mime-type>application/x-ustar</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xbm</extension>
+ <mime-type>image/x-xbitmap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xht</extension>
+ <mime-type>application/xhtml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xhtml</extension>
+ <mime-type>application/xhtml+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xml</extension>
+ <mime-type>text/xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xpm</extension>
+ <mime-type>image/x-xpixmap</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xsl</extension>
+ <mime-type>text/xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xwd</extension>
+ <mime-type>image/x-xwindowdump</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wav</extension>
+ <mime-type>audio/x-wav</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>svg</extension>
+ <mime-type>image/svg+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>svgz</extension>
+ <mime-type>image/svg+xml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>vsd</extension>
+ <mime-type>application/x-visio</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- Wireless Bitmap -->
+ <extension>wbmp</extension>
+ <mime-type>image/vnd.wap.wbmp</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- WML Source -->
+ <extension>wml</extension>
+ <mime-type>text/vnd.wap.wml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- Compiled WML -->
+ <extension>wmlc</extension>
+ <mime-type>application/vnd.wap.wmlc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- WML Script Source -->
+ <extension>wmls</extension>
+ <mime-type>text/vnd.wap.wmlscript</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <!-- Compiled WML Script -->
+ <extension>wmlscriptc</extension>
+ <mime-type>application/vnd.wap.wmlscriptc</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>wrl</extension>
+ <mime-type>x-world/x-vrml</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>Z</extension>
+ <mime-type>application/x-compress</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>z</extension>
+ <mime-type>application/x-compress</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>zip</extension>
+ <mime-type>application/zip</mime-type>
+ </mime-mapping>
+
+
+ <!-- ==================== Default Welcome File List ===================== -->
+ <!-- When a request URI refers to a directory, the default servlet looks -->
+ <!-- for a "welcome file" within that directory and, if present, -->
+ <!-- to the corresponding resource URI for display. If no welcome file -->
+ <!-- is present, the default servlet either serves a directory listing, -->
+ <!-- or returns a 404 status, depending on how it is configured. -->
+ <!-- -->
+ <!-- If you define welcome files in your own application's web.xml -->
+ <!-- deployment descriptor, that list *replaces* the list configured -->
+ <!-- here, so be sure that you include any of the default values that -->
+ <!-- you wish to include. -->
+
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/container/catalina/src/share/org/apache/catalina/Authenticator.java b/container/catalina/src/share/org/apache/catalina/Authenticator.java
new file mode 100644
index 0000000..83b56dc
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Authenticator.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+/**
+ * An <b>Authenticator</b> is a component (usually a Valve or Container) that
+ * provides some sort of authentication service. The interface itself has no
+ * functional significance, but is used as a tagging mechanism so that other
+ * components can detect the presence (via an "instanceof Authenticator" test)
+ * of an already configured authentication service.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public interface Authenticator {
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Cluster.java b/container/catalina/src/share/org/apache/catalina/Cluster.java
new file mode 100644
index 0000000..2c00aa4
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Cluster.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.catalina;
+
+import java.io.IOException;
+import java.net.URL;
+/**
+ * A <b>Cluster</b> works as a Cluster client/server for the local host
+ * Different Cluster implementations can be used to support different
+ * ways to communicate within the Cluster. A Cluster implementation is
+ * responsible for setting up a way to communicate within the Cluster
+ * and also supply "ClientApplications" with <code>ClusterSender</code>
+ * used when sending information in the Cluster and
+ * <code>ClusterInfo</code> used for receiving information in the Cluster.
+ *
+ * @author Bip Thelin
+ * @author Remy Maucherat
+ * @author Filip Hanik
+ * @version $Revision$, $Date$
+ */
+
+public interface Cluster {
+
+ // ------------------------------------------------------------- Properties
+
+ /**
+ * Return descriptive information about this Cluster implementation and
+ * the corresponding version number, in the format
+ * <code><description>/<version></code>.
+ */
+ public String getInfo();
+
+ /**
+ * Return the name of the cluster that this Server is currently
+ * configured to operate within.
+ *
+ * @return The name of the cluster associated with this server
+ */
+ public String getClusterName();
+
+ /**
+ * Set the name of the cluster to join, if no cluster with
+ * this name is present create one.
+ *
+ * @param clusterName The clustername to join
+ */
+ public void setClusterName(String clusterName);
+
+ /**
+ * Set the Container associated with our Cluster
+ *
+ * @param container The Container to use
+ */
+ public void setContainer(Container container);
+
+ /**
+ * Get the Container associated with our Cluster
+ *
+ * @return The Container associated with our Cluster
+ */
+ public Container getContainer();
+
+ /**
+ * Set the protocol parameters.
+ *
+ * @param protocol The protocol used by the cluster
+ */
+ public void setProtocol(String protocol);
+
+ /**
+ * Get the protocol used by the cluster.
+ *
+ * @return The protocol
+ */
+ public String getProtocol();
+
+ // --------------------------------------------------------- Public Methods
+
+ /**
+ * Create a new manager which will use this cluster to replicate its
+ * sessions.
+ *
+ * @param name Name (key) of the application with which the manager is
+ * associated
+ */
+ public Manager createManager(String name);
+
+ // --------------------------------------------------------- Cluster Wide Deployments
+ /**
+ * Start an existing web application, attached to the specified context
+ * path in all the other nodes in the cluster.
+ * Only starts a web application if it is not running.
+ *
+ * @param contextPath The context path of the application to be started
+ *
+ * @exception IllegalArgumentException if the specified context path
+ * is malformed (it must be "" or start with a slash)
+ * @exception IllegalArgumentException if the specified context path does
+ * not identify a currently installed web application
+ * @exception IOException if an input/output error occurs during
+ * startup
+ */
+ public void startContext(String contextPath) throws IOException;
+
+
+ /**
+ * Install a new web application, whose web application archive is at the
+ * specified URL, into this container with the specified context path.
+ * A context path of "" (the empty string) should be used for the root
+ * application for this container. Otherwise, the context path must
+ * start with a slash.
+ * <p>
+ * If this application is successfully installed, a ContainerEvent of type
+ * <code>PRE_INSTALL_EVENT</code> will be sent to registered listeners
+ * before the associated Context is started, and a ContainerEvent of type
+ * <code>INSTALL_EVENT</code> will be sent to all registered listeners
+ * after the associated Context is started, with the newly created
+ * <code>Context</code> as an argument.
+ *
+ * @param contextPath The context path to which this application should
+ * be installed (must be unique)
+ * @param war A URL of type "jar:" that points to a WAR file, or type
+ * "file:" that points to an unpacked directory structure containing
+ * the web application to be installed
+ *
+ * @exception IllegalArgumentException if the specified context path
+ * is malformed (it must be "" or start with a slash)
+ * @exception IllegalStateException if the specified context path
+ * is already attached to an existing web application
+ */
+ public void installContext(String contextPath, URL war);
+
+ /**
+ * Stop an existing web application, attached to the specified context
+ * path. Only stops a web application if it is running.
+ *
+ * @param contextPath The context path of the application to be stopped
+ *
+ * @exception IllegalArgumentException if the specified context path
+ * is malformed (it must be "" or start with a slash)
+ * @exception IllegalArgumentException if the specified context path does
+ * not identify a currently installed web application
+ * @exception IOException if an input/output error occurs while stopping
+ * the web application
+ */
+ public void stop(String contextPath) throws IOException;
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Contained.java b/container/catalina/src/share/org/apache/catalina/Contained.java
new file mode 100644
index 0000000..a676b65
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Contained.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 1999-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+/**
+ * <p>Decoupling interface which specifies that an implementing class is
+ * associated with at most one <strong>Container</strong> instance.</p>
+ *
+ * @author Craig R. McClanahan
+ * @author Peter Donald
+ * @version $Revision$ $Date$
+ */
+
+public interface Contained {
+
+
+ //-------------------------------------------------------------- Properties
+
+
+ /**
+ * Return the <code>Container</code> with which this instance is associated
+ * (if any); otherwise return <code>null</code>.
+ */
+ public Container getContainer();
+
+
+ /**
+ * Set the <code>Container</code> with which this instance is associated.
+ *
+ * @param container The Container instance with which this instance is to
+ * be associated, or <code>null</code> to disassociate this instance
+ * from any Container
+ */
+ public void setContainer(Container container);
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Container.java b/container/catalina/src/share/org/apache/catalina/Container.java
new file mode 100644
index 0000000..5f144bc
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Container.java
@@ -0,0 +1,442 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+import java.beans.PropertyChangeListener;
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.naming.directory.DirContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+
+
+/**
+ * A <b>Container</b> is an object that can execute requests received from
+ * a client, and return responses based on those requests. A Container may
+ * optionally support a pipeline of Valves that process the request in an
+ * order configured at runtime, by implementing the <b>Pipeline</b> interface
+ * as well.
+ * <p>
+ * Containers will exist at several conceptual levels within Catalina. The
+ * following examples represent common cases:
+ * <ul>
+ * <li><b>Engine</b> - Representation of the entire Catalina servlet engine,
+ * most likely containing one or more subcontainers that are either Host
+ * or Context implementations, or other custom groups.
+ * <li><b>Host</b> - Representation of a virtual host containing a number
+ * of Contexts.
+ * <li><b>Context</b> - Representation of a single ServletContext, which will
+ * typically contain one or more Wrappers for the supported servlets.
+ * <li><b>Wrapper</b> - Representation of an individual servlet definition
+ * (which may support multiple servlet instances if the servlet itself
+ * implements SingleThreadModel).
+ * </ul>
+ * A given deployment of Catalina need not include Containers at all of the
+ * levels described above. For example, an administration application
+ * embedded within a network device (such as a router) might only contain
+ * a single Context and a few Wrappers, or even a single Wrapper if the
+ * application is relatively small. Therefore, Container implementations
+ * need to be designed so that they will operate correctly in the absence
+ * of parent Containers in a given deployment.
+ * <p>
+ * A Container may also be associated with a number of support components
+ * that provide functionality which might be shared (by attaching it to a
+ * parent Container) or individually customized. The following support
+ * components are currently recognized:
+ * <ul>
+ * <li><b>Loader</b> - Class loader to use for integrating new Java classes
+ * for this Container into the JVM in which Catalina is running.
+ * <li><b>Logger</b> - Implementation of the <code>log()</code> method
+ * signatures of the <code>ServletContext</code> interface.
+ * <li><b>Manager</b> - Manager for the pool of Sessions associated with
+ * this Container.
+ * <li><b>Realm</b> - Read-only interface to a security domain, for
+ * authenticating user identities and their corresponding roles.
+ * <li><b>Resources</b> - JNDI directory context enabling access to static
+ * resources, enabling custom linkages to existing server components when
+ * Catalina is embedded in a larger server.
+ * </ul>
+ *
+ * @author Craig R. McClanahan
+ * @author Remy Maucherat
+ * @version $Revision$ $Date$
+ */
+
+public interface Container {
+
+
+ // ----------------------------------------------------- Manifest Constants
+
+
+ /**
+ * The ContainerEvent event type sent when a child container is added
+ * by <code>addChild()</code>.
+ */
+ public static final String ADD_CHILD_EVENT = "addChild";
+
+
+ /**
+ * The ContainerEvent event type sent when a Mapper is added
+ * by <code>addMapper()</code>.
+ */
+ public static final String ADD_MAPPER_EVENT = "addMapper";
+
+
+ /**
+ * The ContainerEvent event type sent when a valve is added
+ * by <code>addValve()</code>, if this Container supports pipelines.
+ */
+ public static final String ADD_VALVE_EVENT = "addValve";
+
+
+ /**
+ * The ContainerEvent event type sent when a child container is removed
+ * by <code>removeChild()</code>.
+ */
+ public static final String REMOVE_CHILD_EVENT = "removeChild";
+
+
+ /**
+ * The ContainerEvent event type sent when a Mapper is removed
+ * by <code>removeMapper()</code>.
+ */
+ public static final String REMOVE_MAPPER_EVENT = "removeMapper";
+
+
+ /**
+ * The ContainerEvent event type sent when a valve is removed
+ * by <code>removeValve()</code>, if this Container supports pipelines.
+ */
+ public static final String REMOVE_VALVE_EVENT = "removeValve";
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return descriptive information about this Container implementation and
+ * the corresponding version number, in the format
+ * <code><description>/<version></code>.
+ */
+ public String getInfo();
+
+
+ /**
+ * Return the Loader with which this Container is associated. If there is
+ * no associated Loader, return the Loader associated with our parent
+ * Container (if any); otherwise, return <code>null</code>.
+ */
+ public Loader getLoader();
+
+
+ /**
+ * Set the Loader with which this Container is associated.
+ *
+ * @param loader The newly associated loader
+ */
+ public void setLoader(Loader loader);
+
+
+ /**
+ * Return the Logger with which this Container is associated. If there is
+ * no associated Logger, return the Logger associated with our parent
+ * Container (if any); otherwise return <code>null</code>.
+ */
+ public Log getLogger();
+
+
+ /**
+ * Return the Manager with which this Container is associated. If there is
+ * no associated Manager, return the Manager associated with our parent
+ * Container (if any); otherwise return <code>null</code>.
+ */
+ public Manager getManager();
+
+
+ /**
+ * Set the Manager with which this Container is associated.
+ *
+ * @param manager The newly associated Manager
+ */
+ public void setManager(Manager manager);
+
+
+ /**
+ * Return an object which may be utilized for mapping to this component.
+ */
+ public Object getMappingObject();
+
+
+ /**
+ * Return the JMX name associated with this container.
+ */
+ public String getObjectName();
+
+ /**
+ * Return the Pipeline object that manages the Valves associated with
+ * this Container.
+ */
+ public Pipeline getPipeline();
+
+
+ /**
+ * Return the Cluster with which this Container is associated. If there is
+ * no associated Cluster, return the Cluster associated with our parent
+ * Container (if any); otherwise return <code>null</code>.
+ */
+ public Cluster getCluster();
+
+
+ /**
+ * Set the Cluster with which this Container is associated.
+ *
+ * @param cluster the Cluster with which this Container is associated.
+ */
+ public void setCluster(Cluster cluster);
+
+
+ /**
+ * Get the delay between the invocation of the backgroundProcess method on
+ * this container and its children. Child containers will not be invoked
+ * if their delay value is not negative (which would mean they are using
+ * their own thread). Setting this to a positive value will cause
+ * a thread to be spawn. After waiting the specified amount of time,
+ * the thread will invoke the executePeriodic method on this container
+ * and all its children.
+ */
+ public int getBackgroundProcessorDelay();
+
+
+ /**
+ * Set the delay between the invocation of the execute method on this
+ * container and its children.
+ *
+ * @param delay The delay in seconds between the invocation of
+ * backgroundProcess methods
+ */
+ public void setBackgroundProcessorDelay(int delay);
+
+
+ /**
+ * Return a name string (suitable for use by humans) that describes this
+ * Container. Within the set of child containers belonging to a particular
+ * parent, Container names must be unique.
+ */
+ public String getName();
+
+
+ /**
+ * Set a name string (suitable for use by humans) that describes this
+ * Container. Within the set of child containers belonging to a particular
+ * parent, Container names must be unique.
+ *
+ * @param name New name of this container
+ *
+ * @exception IllegalStateException if this Container has already been
+ * added to the children of a parent Container (after which the name
+ * may not be changed)
+ */
+ public void setName(String name);
+
+
+ /**
+ * Return the Container for which this Container is a child, if there is
+ * one. If there is no defined parent, return <code>null</code>.
+ */
+ public Container getParent();
+
+
+ /**
+ * Set the parent Container to which this Container is being added as a
+ * child. This Container may refuse to become attached to the specified
+ * Container by throwing an exception.
+ *
+ * @param container Container to which this Container is being added
+ * as a child
+ *
+ * @exception IllegalArgumentException if this Container refuses to become
+ * attached to the specified Container
+ */
+ public void setParent(Container container);
+
+
+ /**
+ * Return the parent class loader (if any) for web applications.
+ */
+ public ClassLoader getParentClassLoader();
+
+
+ /**
+ * Set the parent class loader (if any) for web applications.
+ * This call is meaningful only <strong>before</strong> a Loader has
+ * been configured, and the specified value (if non-null) should be
+ * passed as an argument to the class loader constructor.
+ *
+ * @param parent The new parent class loader
+ */
+ public void setParentClassLoader(ClassLoader parent);
+
+
+ /**
+ * Return the Realm with which this Container is associated. If there is
+ * no associated Realm, return the Realm associated with our parent
+ * Container (if any); otherwise return <code>null</code>.
+ */
+ public Realm getRealm();
+
+
+ /**
+ * Set the Realm with which this Container is associated.
+ *
+ * @param realm The newly associated Realm
+ */
+ public void setRealm(Realm realm);
+
+
+ /**
+ * Return the Resources with which this Container is associated. If there
+ * is no associated Resources object, return the Resources associated with
+ * our parent Container (if any); otherwise return <code>null</code>.
+ */
+ public DirContext getResources();
+
+
+ /**
+ * Set the Resources object with which this Container is associated.
+ *
+ * @param resources The newly associated Resources
+ */
+ public void setResources(DirContext resources);
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Execute a periodic task, such as reloading, etc. This method will be
+ * invoked inside the classloading context of this container. Unexpected
+ * throwables will be caught and logged.
+ */
+ public void backgroundProcess();
+
+
+ /**
+ * Add a new child Container to those associated with this Container,
+ * if supported. Prior to adding this Container to the set of children,
+ * the child's <code>setParent()</code> method must be called, with this
+ * Container as an argument. This method may thrown an
+ * <code>IllegalArgumentException</code> if this Container chooses not
+ * to be attached to the specified Container, in which case it is not added
+ *
+ * @param child New child Container to be added
+ *
+ * @exception IllegalArgumentException if this exception is thrown by
+ * the <code>setParent()</code> method of the child Container
+ * @exception IllegalArgumentException if the new child does not have
+ * a name unique from that of existing children of this Container
+ * @exception IllegalStateException if this Container does not support
+ * child Containers
+ */
+ public void addChild(Container child);
+
+
+ /**
+ * Add a container event listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addContainerListener(ContainerListener listener);
+
+
+ /**
+ * Add a property change listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener);
+
+
+ /**
+ * Return the child Container, associated with this Container, with
+ * the specified name (if any); otherwise, return <code>null</code>
+ *
+ * @param name Name of the child Container to be retrieved
+ */
+ public Container findChild(String name);
+
+
+ /**
+ * Return the set of children Containers associated with this Container.
+ * If this Container has no children, a zero-length array is returned.
+ */
+ public Container[] findChildren();
+
+
+ /**
+ * Return the set of container listeners associated with this Container.
+ * If this Container has no registered container listeners, a zero-length
+ * array is returned.
+ */
+ public ContainerListener[] findContainerListeners();
+
+
+ /**
+ * Process the specified Request, and generate the corresponding Response,
+ * according to the design of this particular Container.
+ *
+ * @param request Request to be processed
+ * @param response Response to be produced
+ *
+ * @exception IOException if an input/output error occurred while
+ * processing
+ * @exception ServletException if a ServletException was thrown
+ * while processing this request
+ */
+ public void invoke(Request request, Response response)
+ throws IOException, ServletException;
+
+
+ /**
+ * Remove an existing child Container from association with this parent
+ * Container.
+ *
+ * @param child Existing child Container to be removed
+ */
+ public void removeChild(Container child);
+
+
+ /**
+ * Remove a container event listener from this component.
+ *
+ * @param listener The listener to remove
+ */
+ public void removeContainerListener(ContainerListener listener);
+
+
+ /**
+ * Remove a property change listener from this component.
+ *
+ * @param listener The listener to remove
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener);
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ContainerEvent.java b/container/catalina/src/share/org/apache/catalina/ContainerEvent.java
new file mode 100644
index 0000000..d0bf538
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ContainerEvent.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+import java.util.EventObject;
+
+
+/**
+ * General event for notifying listeners of significant changes on a Container.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public final class ContainerEvent
+ extends EventObject {
+
+
+ /**
+ * The Container on which this event occurred.
+ */
+ private Container container = null;
+
+
+ /**
+ * The event data associated with this event.
+ */
+ private Object data = null;
+
+
+ /**
+ * The event type this instance represents.
+ */
+ private String type = null;
+
+
+ /**
+ * Construct a new ContainerEvent with the specified parameters.
+ *
+ * @param container Container on which this event occurred
+ * @param type Event type
+ * @param data Event data
+ */
+ public ContainerEvent(Container container, String type, Object data) {
+
+ super(container);
+ this.container = container;
+ this.type = type;
+ this.data = data;
+
+ }
+
+
+ /**
+ * Return the event data of this event.
+ */
+ public Object getData() {
+
+ return (this.data);
+
+ }
+
+
+ /**
+ * Return the Container on which this event occurred.
+ */
+ public Container getContainer() {
+
+ return (this.container);
+
+ }
+
+
+ /**
+ * Return the event type of this event.
+ */
+ public String getType() {
+
+ return (this.type);
+
+ }
+
+
+ /**
+ * Return a string representation of this event.
+ */
+ public String toString() {
+
+ return ("ContainerEvent['" + getContainer() + "','" +
+ getType() + "','" + getData() + "']");
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ContainerListener.java b/container/catalina/src/share/org/apache/catalina/ContainerListener.java
new file mode 100644
index 0000000..14669b1
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ContainerListener.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+
+
+/**
+ * Interface defining a listener for significant Container generated events.
+ * Note that "container start" and "container stop" events are normally
+ * LifecycleEvents, not ContainerEvents.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public interface ContainerListener {
+
+
+ /**
+ * Acknowledge the occurrence of the specified event.
+ *
+ * @param event ContainerEvent that has occurred
+ */
+ public void containerEvent(ContainerEvent event);
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ContainerServlet.java b/container/catalina/src/share/org/apache/catalina/ContainerServlet.java
new file mode 100644
index 0000000..e0d4ab9
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ContainerServlet.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 1999-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+/**
+ * A <b>ContainerServlet</b> is a servlet that has access to Catalina
+ * internal functionality, and is loaded from the Catalina class loader
+ * instead of the web application class loader. The property setter
+ * methods must be called by the container whenever a new instance of
+ * this servlet is put into service.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public interface ContainerServlet {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return the Wrapper with which this Servlet is associated.
+ */
+ public Wrapper getWrapper();
+
+
+ /**
+ * Set the Wrapper with which this Servlet is associated.
+ *
+ * @param wrapper The new associated Wrapper
+ */
+ public void setWrapper(Wrapper wrapper);
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Context.java b/container/catalina/src/share/org/apache/catalina/Context.java
new file mode 100644
index 0000000..caf3157
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Context.java
@@ -0,0 +1,1040 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+import javax.servlet.ServletContext;
+
+import org.apache.tomcat.util.http.mapper.Mapper;
+
+import org.apache.catalina.deploy.ApplicationParameter;
+import org.apache.catalina.deploy.ErrorPage;
+import org.apache.catalina.deploy.FilterDef;
+import org.apache.catalina.deploy.FilterMap;
+import org.apache.catalina.deploy.LoginConfig;
+import org.apache.catalina.deploy.NamingResources;
+import org.apache.catalina.deploy.SecurityConstraint;
+import org.apache.catalina.util.CharsetMapper;
+
+
+/**
+ * A <b>Context</b> is a Container that represents a servlet context, and
+ * therefore an individual web application, in the Catalina servlet engine.
+ * It is therefore useful in almost every deployment of Catalina (even if a
+ * Connector attached to a web server (such as Apache) uses the web server's
+ * facilities to identify the appropriate Wrapper to handle this request.
+ * It also provides a convenient mechanism to use Interceptors that see
+ * every request processed by this particular web application.
+ * <p>
+ * The parent Container attached to a Context is generally a Host, but may
+ * be some other implementation, or may be omitted if it is not necessary.
+ * <p>
+ * The child containers attached to a Context are generally implementations
+ * of Wrapper (representing individual servlet definitions).
+ * <p>
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public interface Context extends Container {
+
+
+ // ----------------------------------------------------- Manifest Constants
+
+
+ /**
+ * The LifecycleEvent type sent when a context is reloaded.
+ */
+ public static final String RELOAD_EVENT = "reload";
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return the set of initialized application event listener objects,
+ * in the order they were specified in the web application deployment
+ * descriptor, for this application.
+ *
+ * @exception IllegalStateException if this method is called before
+ * this application has started, or after it has been stopped
+ */
+ public Object[] getApplicationEventListeners();
+
+
+ /**
+ * Store the set of initialized application event listener objects,
+ * in the order they were specified in the web application deployment
+ * descriptor, for this application.
+ *
+ * @param listeners The set of instantiated listener objects.
+ */
+ public void setApplicationEventListeners(Object listeners[]);
+
+
+ /**
+ * Return the set of initialized application lifecycle listener objects,
+ * in the order they were specified in the web application deployment
+ * descriptor, for this application.
+ *
+ * @exception IllegalStateException if this method is called before
+ * this application has started, or after it has been stopped
+ */
+ public Object[] getApplicationLifecycleListeners();
+
+
+ /**
+ * Store the set of initialized application lifecycle listener objects,
+ * in the order they were specified in the web application deployment
+ * descriptor, for this application.
+ *
+ * @param listeners The set of instantiated listener objects.
+ */
+ public void setApplicationLifecycleListeners(Object listeners[]);
+
+
+ /**
+ * Return the application available flag for this Context.
+ */
+ public boolean getAvailable();
+
+
+ /**
+ * Set the application available flag for this Context.
+ *
+ * @param available The new application available flag
+ */
+ public void setAvailable(boolean available);
+
+
+ /**
+ * Return the Locale to character set mapper for this Context.
+ */
+ public CharsetMapper getCharsetMapper();
+
+
+ /**
+ * Set the Locale to character set mapper for this Context.
+ *
+ * @param mapper The new mapper
+ */
+ public void setCharsetMapper(CharsetMapper mapper);
+
+
+ /**
+ * Return the path to a file to save this Context information.
+ */
+ public String getConfigFile();
+
+
+ /**
+ * Set the path to a file to save this Context information.
+ *
+ * @param configFile The path to a file to save this Context information.
+ */
+ public void setConfigFile(String configFile);
+
+
+ /**
+ * Return the "correctly configured" flag for this Context.
+ */
+ public boolean getConfigured();
+
+
+ /**
+ * Set the "correctly configured" flag for this Context. This can be
+ * set to false by startup listeners that detect a fatal configuration
+ * error to avoid the application from being made available.
+ *
+ * @param configured The new correctly configured flag
+ */
+ public void setConfigured(boolean configured);
+
+
+ /**
+ * Return the "use cookies for session ids" flag.
+ */
+ public boolean getCookies();
+
+
+ /**
+ * Set the "use cookies for session ids" flag.
+ *
+ * @param cookies The new flag
+ */
+ public void setCookies(boolean cookies);
+
+
+ /**
+ * Return the "allow crossing servlet contexts" flag.
+ */
+ public boolean getCrossContext();
+
+
+
+ /**
+ * Return the alternate Deployment Descriptor name.
+ */
+ public String getAltDDName();
+
+
+ /**
+ * Set an alternate Deployment Descriptor name.
+ */
+ public void setAltDDName(String altDDName) ;
+
+
+ /**
+ * Set the "allow crossing servlet contexts" flag.
+ *
+ * @param crossContext The new cross contexts flag
+ */
+ public void setCrossContext(boolean crossContext);
+
+
+ /**
+ * Return the display name of this web application.
+ */
+ public String getDisplayName();
+
+
+ /**
+ * Set the display name of this web application.
+ *
+ * @param displayName The new display name
+ */
+ public void setDisplayName(String displayName);
+
+
+ /**
+ * Return the distributable flag for this web application.
+ */
+ public boolean getDistributable();
+
+
+ /**
+ * Set the distributable flag for this web application.
+ *
+ * @param distributable The new distributable flag
+ */
+ public void setDistributable(boolean distributable);
+
+
+ /**
+ * Return the document root for this Context. This can be an absolute
+ * pathname, a relative pathname, or a URL.
+ */
+ public String getDocBase();
+
+
+ /**
+ * Set the document root for this Context. This can be an absolute
+ * pathname, a relative pathname, or a URL.
+ *
+ * @param docBase The new document root
+ */
+ public void setDocBase(String docBase);
+
+
+ /**
+ * Return the login configuration descriptor for this web application.
+ */
+ public LoginConfig getLoginConfig();
+
+
+ /**
+ * Set the login configuration descriptor for this web application.
+ *
+ * @param config The new login configuration
+ */
+ public void setLoginConfig(LoginConfig config);
+
+
+ /**
+ * Get the request dispatcher mapper.
+ */
+ public Mapper getMapper();
+
+
+ /**
+ * Return the naming resources associated with this web application.
+ */
+ public NamingResources getNamingResources();
+
+
+ /**
+ * Set the naming resources for this web application.
+ *
+ * @param namingResources The new naming resources
+ */
+ public void setNamingResources(NamingResources namingResources);
+
+
+ /**
+ * Return the context path for this web application.
+ */
+ public String getPath();
+
+
+ /**
+ * Set the context path for this web application.
+ *
+ * @param path The new context path
+ */
+ public void setPath(String path);
+
+
+ /**
+ * Return the public identifier of the deployment descriptor DTD that is
+ * currently being parsed.
+ */
+ public String getPublicId();
+
+
+ /**
+ * Set the public identifier of the deployment descriptor DTD that is
+ * currently being parsed.
+ *
+ * @param publicId The public identifier
+ */
+ public void setPublicId(String publicId);
+
+
+ /**
+ * Return the reloadable flag for this web application.
+ */
+ public boolean getReloadable();
+
+
+ /**
+ * Set the reloadable flag for this web application.
+ *
+ * @param reloadable The new reloadable flag
+ */
+ public void setReloadable(boolean reloadable);
+
+
+ /**
+ * Return the override flag for this web application.
+ */
+ public boolean getOverride();
+
+
+ /**
+ * Set the override flag for this web application.
+ *
+ * @param override The new override flag
+ */
+ public void setOverride(boolean override);
+
+
+ /**
+ * Return the privileged flag for this web application.
+ */
+ public boolean getPrivileged();
+
+
+ /**
+ * Set the privileged flag for this web application.
+ *
+ * @param privileged The new privileged flag
+ */
+ public void setPrivileged(boolean privileged);
+
+
+ /**
+ * Return the servlet context for which this Context is a facade.
+ */
+ public ServletContext getServletContext();
+
+
+ /**
+ * Return the default session timeout (in minutes) for this
+ * web application.
+ */
+ public int getSessionTimeout();
+
+
+ /**
+ * Set the default session timeout (in minutes) for this
+ * web application.
+ *
+ * @param timeout The new default session timeout
+ */
+ public void setSessionTimeout(int timeout);
+
+
+ /**
+ * Return the value of the swallowOutput flag.
+ */
+ public boolean getSwallowOutput();
+
+
+ /**
+ * Set the value of the swallowOutput flag. If set to true, the system.out
+ * and system.err will be redirected to the logger during a servlet
+ * execution.
+ *
+ * @param swallowOutput The new value
+ */
+ public void setSwallowOutput(boolean swallowOutput);
+
+
+ /**
+ * Return the Java class name of the Wrapper implementation used
+ * for servlets registered in this Context.
+ */
+ public String getWrapperClass();
+
+
+ /**
+ * Set the Java class name of the Wrapper implementation used
+ * for servlets registered in this Context.
+ *
+ * @param wrapperClass The new wrapper class
+ */
+ public void setWrapperClass(String wrapperClass);
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Add a new Listener class name to the set of Listeners
+ * configured for this application.
+ *
+ * @param listener Java class name of a listener class
+ */
+ public void addApplicationListener(String listener);
+
+
+ /**
+ * Add a new application parameter for this application.
+ *
+ * @param parameter The new application parameter
+ */
+ public void addApplicationParameter(ApplicationParameter parameter);
+
+
+ /**
+ * Add a security constraint to the set for this web application.
+ */
+ public void addConstraint(SecurityConstraint constraint);
+
+
+ /**
+ * Add an error page for the specified error or Java exception.
+ *
+ * @param errorPage The error page definition to be added
+ */
+ public void addErrorPage(ErrorPage errorPage);
+
+
+ /**
+ * Add a filter definition to this Context.
+ *
+ * @param filterDef The filter definition to be added
+ */
+ public void addFilterDef(FilterDef filterDef);
+
+
+ /**
+ * Add a filter mapping to this Context.
+ *
+ * @param filterMap The filter mapping to be added
+ */
+ public void addFilterMap(FilterMap filterMap);
+
+
+ /**
+ * Add the classname of an InstanceListener to be added to each
+ * Wrapper appended to this Context.
+ *
+ * @param listener Java class name of an InstanceListener class
+ */
+ public void addInstanceListener(String listener);
+
+
+ /**
+ * Add the given URL pattern as a jsp-property-group. This maps
+ * resources that match the given pattern so they will be passed
+ * to the JSP container. Though there are other elements in the
+ * property group, we only care about the URL pattern here. The
+ * JSP container will parse the rest.
+ *
+ * @param pattern URL pattern to be mapped
+ */
+ public void addJspMapping(String pattern);
+
+
+ /**
+ * Add a Locale Encoding Mapping (see Sec 5.4 of Servlet spec 2.4)
+ *
+ * @param locale locale to map an encoding for
+ * @param encoding encoding to be used for a give locale
+ */
+ public void addLocaleEncodingMappingParameter(String locale, String encoding);
+
+
+ /**
+ * Add a new MIME mapping, replacing any existing mapping for
+ * the specified extension.
+ *
+ * @param extension Filename extension being mapped
+ * @param mimeType Corresponding MIME type
+ */
+ public void addMimeMapping(String extension, String mimeType);
+
+
+ /**
+ * Add a new context initialization parameter, replacing any existing
+ * value for the specified name.
+ *
+ * @param name Name of the new parameter
+ * @param value Value of the new parameter
+ */
+ public void addParameter(String name, String value);
+
+
+ /**
+ * Add a security role reference for this web application.
+ *
+ * @param role Security role used in the application
+ * @param link Actual security role to check for
+ */
+ public void addRoleMapping(String role, String link);
+
+
+ /**
+ * Add a new security role for this web application.
+ *
+ * @param role New security role
+ */
+ public void addSecurityRole(String role);
+
+
+ /**
+ * Add a new servlet mapping, replacing any existing mapping for
+ * the specified pattern.
+ *
+ * @param pattern URL pattern to be mapped
+ * @param name Name of the corresponding servlet to execute
+ */
+ public void addServletMapping(String pattern, String name);
+
+
+ /**
+ * Add a JSP tag library for the specified URI.
+ *
+ * @param uri URI, relative to the web.xml file, of this tag library
+ * @param location Location of the tag library descriptor
+ */
+ public void addTaglib(String uri, String location);
+
+
+ /**
+ * Add a resource which will be watched for reloading by the host auto
+ * deployer. Note: this will not be used in embedded mode.
+ *
+ * @param name Path to the resource, relative to docBase
+ */
+ public void addWatchedResource(String name);
+
+
+ /**
+ * Add a new welcome file to the set recognized by this Context.
+ *
+ * @param name New welcome file name
+ */
+ public void addWelcomeFile(String name);
+
+
+ /**
+ * Add the classname of a LifecycleListener to be added to each
+ * Wrapper appended to this Context.
+ *
+ * @param listener Java class name of a LifecycleListener class
+ */
+ public void addWrapperLifecycle(String listener);
+
+
+ /**
+ * Add the classname of a ContainerListener to be added to each
+ * Wrapper appended to this Context.
+ *
+ * @param listener Java class name of a ContainerListener class
+ */
+ public void addWrapperListener(String listener);
+
+
+ /**
+ * Factory method to create and return a new Wrapper instance, of
+ * the Java implementation class appropriate for this Context
+ * implementation. The constructor of the instantiated Wrapper
+ * will have been called, but no properties will have been set.
+ */
+ public Wrapper createWrapper();
+
+
+ /**
+ * Return the set of application listener class names configured
+ * for this application.
+ */
+ public String[] findApplicationListeners();
+
+
+ /**
+ * Return the set of application parameters for this application.
+ */
+ public ApplicationParameter[] findApplicationParameters();
+
+
+ /**
+ * Return the set of security constraints for this web application.
+ * If there are none, a zero-length array is returned.
+ */
+ public SecurityConstraint[] findConstraints();
+
+
+ /**
+ * Return the error page entry for the specified HTTP error code,
+ * if any; otherwise return <code>null</code>.
+ *
+ * @param errorCode Error code to look up
+ */
+ public ErrorPage findErrorPage(int errorCode);
+
+
+ /**
+ * Return the error page entry for the specified Java exception type,
+ * if any; otherwise return <code>null</code>.
+ *
+ * @param exceptionType Exception type to look up
+ */
+ public ErrorPage findErrorPage(String exceptionType);
+
+
+
+ /**
+ * Return the set of defined error pages for all specified error codes
+ * and exception types.
+ */
+ public ErrorPage[] findErrorPages();
+
+
+ /**
+ * Return the filter definition for the specified filter name, if any;
+ * otherwise return <code>null</code>.
+ *
+ * @param filterName Filter name to look up
+ */
+ public FilterDef findFilterDef(String filterName);
+
+
+ /**
+ * Return the set of defined filters for this Context.
+ */
+ public FilterDef[] findFilterDefs();
+
+
+ /**
+ * Return the set of filter mappings for this Context.
+ */
+ public FilterMap[] findFilterMaps();
+
+
+ /**
+ * Return the set of InstanceListener classes that will be added to
+ * newly created Wrappers automatically.
+ */
+ public String[] findInstanceListeners();
+
+
+ /**
+ * Return the MIME type to which the specified extension is mapped,
+ * if any; otherwise return <code>null</code>.
+ *
+ * @param extension Extension to map to a MIME type
+ */
+ public String findMimeMapping(String extension);
+
+
+ /**
+ * Return the extensions for which MIME mappings are defined. If there
+ * are none, a zero-length array is returned.
+ */
+ public String[] findMimeMappings();
+
+
+ /**
+ * Return the value for the specified context initialization
+ * parameter name, if any; otherwise return <code>null</code>.
+ *
+ * @param name Name of the parameter to return
+ */
+ public String findParameter(String name);
+
+
+ /**
+ * Return the names of all defined context initialization parameters
+ * for this Context. If no parameters are defined, a zero-length
+ * array is returned.
+ */
+ public String[] findParameters();
+
+
+ /**
+ * For the given security role (as used by an application), return the
+ * corresponding role name (as defined by the underlying Realm) if there
+ * is one. Otherwise, return the specified role unchanged.
+ *
+ * @param role Security role to map
+ */
+ public String findRoleMapping(String role);
+
+
+ /**
+ * Return <code>true</code> if the specified security role is defined
+ * for this application; otherwise return <code>false</code>.
+ *
+ * @param role Security role to verify
+ */
+ public boolean findSecurityRole(String role);
+
+
+ /**
+ * Return the security roles defined for this application. If none
+ * have been defined, a zero-length array is returned.
+ */
+ public String[] findSecurityRoles();
+
+
+ /**
+ * Return the servlet name mapped by the specified pattern (if any);
+ * otherwise return <code>null</code>.
+ *
+ * @param pattern Pattern for which a mapping is requested
+ */
+ public String findServletMapping(String pattern);
+
+
+ /**
+ * Return the patterns of all defined servlet mappings for this
+ * Context. If no mappings are defined, a zero-length array is returned.
+ */
+ public String[] findServletMappings();
+
+
+ /**
+ * Return the context-relative URI of the error page for the specified
+ * HTTP status code, if any; otherwise return <code>null</code>.
+ *
+ * @param status HTTP status code to look up
+ */
+ public String findStatusPage(int status);
+
+
+ /**
+ * Return the set of HTTP status codes for which error pages have
+ * been specified. If none are specified, a zero-length array
+ * is returned.
+ */
+ public int[] findStatusPages();
+
+
+ /**
+ * Return the tag library descriptor location for the specified taglib
+ * URI, if any; otherwise, return <code>null</code>.
+ *
+ * @param uri URI, relative to the web.xml file
+ */
+ public String findTaglib(String uri);
+
+
+ /**
+ * Return the URIs of all tag libraries for which a tag library
+ * descriptor location has been specified. If none are specified,
+ * a zero-length array is returned.
+ */
+ public String[] findTaglibs();
+
+
+ /**
+ * Return the set of watched resources for this Context. If none are
+ * defined, a zero length array will be returned.
+ */
+ public String[] findWatchedResources();
+
+
+ /**
+ * Return <code>true</code> if the specified welcome file is defined
+ * for this Context; otherwise return <code>false</code>.
+ *
+ * @param name Welcome file to verify
+ */
+ public boolean findWelcomeFile(String name);
+
+
+ /**
+ * Return the set of welcome files defined for this Context. If none are
+ * defined, a zero-length array is returned.
+ */
+ public String[] findWelcomeFiles();
+
+
+ /**
+ * Return the set of LifecycleListener classes that will be added to
+ * newly created Wrappers automatically.
+ */
+ public String[] findWrapperLifecycles();
+
+
+ /**
+ * Return the set of ContainerListener classes that will be added to
+ * newly created Wrappers automatically.
+ */
+ public String[] findWrapperListeners();
+
+
+ /**
+ * Reload this web application, if reloading is supported.
+ *
+ * @exception IllegalStateException if the <code>reloadable</code>
+ * property is set to <code>false</code>.
+ */
+ public void reload();
+
+
+ /**
+ * Remove the specified application listener class from the set of
+ * listeners for this application.
+ *
+ * @param listener Java class name of the listener to be removed
+ */
+ public void removeApplicationListener(String listener);
+
+
+ /**
+ * Remove the application parameter with the specified name from
+ * the set for this application.
+ *
+ * @param name Name of the application parameter to remove
+ */
+ public void removeApplicationParameter(String name);
+
+
+ /**
+ * Remove the specified security constraint from this web application.
+ *
+ * @param constraint Constraint to be removed
+ */
+ public void removeConstraint(SecurityConstraint constraint);
+
+
+ /**
+ * Remove the error page for the specified error code or
+ * Java language exception, if it exists; otherwise, no action is taken.
+ *
+ * @param errorPage The error page definition to be removed
+ */
+ public void removeErrorPage(ErrorPage errorPage);
+
+
+ /**
+ * Remove the specified filter definition from this Context, if it exists;
+ * otherwise, no action is taken.
+ *
+ * @param filterDef Filter definition to be removed
+ */
+ public void removeFilterDef(FilterDef filterDef);
+
+
+ /**
+ * Remove a filter mapping from this Context.
+ *
+ * @param filterMap The filter mapping to be removed
+ */
+ public void removeFilterMap(FilterMap filterMap);
+
+
+ /**
+ * Remove a class name from the set of InstanceListener classes that
+ * will be added to newly created Wrappers.
+ *
+ * @param listener Class name of an InstanceListener class to be removed
+ */
+ public void removeInstanceListener(String listener);
+
+
+ /**
+ * Remove the MIME mapping for the specified extension, if it exists;
+ * otherwise, no action is taken.
+ *
+ * @param extension Extension to remove the mapping for
+ */
+ public void removeMimeMapping(String extension);
+
+
+ /**
+ * Remove the context initialization parameter with the specified
+ * name, if it exists; otherwise, no action is taken.
+ *
+ * @param name Name of the parameter to remove
+ */
+ public void removeParameter(String name);
+
+
+ /**
+ * Remove any security role reference for the specified name
+ *
+ * @param role Security role (as used in the application) to remove
+ */
+ public void removeRoleMapping(String role);
+
+
+ /**
+ * Remove any security role with the specified name.
+ *
+ * @param role Security role to remove
+ */
+ public void removeSecurityRole(String role);
+
+
+ /**
+ * Remove any servlet mapping for the specified pattern, if it exists;
+ * otherwise, no action is taken.
+ *
+ * @param pattern URL pattern of the mapping to remove
+ */
+ public void removeServletMapping(String pattern);
+
+
+ /**
+ * Remove the tag library location forthe specified tag library URI.
+ *
+ * @param uri URI, relative to the web.xml file
+ */
+ public void removeTaglib(String uri);
+
+
+ /**
+ * Remove the specified watched resource name from the list associated
+ * with this Context.
+ *
+ * @param name Name of the watched resource to be removed
+ */
+ public void removeWatchedResource(String name);
+
+
+ /**
+ * Remove the specified welcome file name from the list recognized
+ * by this Context.
+ *
+ * @param name Name of the welcome file to be removed
+ */
+ public void removeWelcomeFile(String name);
+
+
+ /**
+ * Remove a class name from the set of LifecycleListener classes that
+ * will be added to newly created Wrappers.
+ *
+ * @param listener Class name of a LifecycleListener class to be removed
+ */
+ public void removeWrapperLifecycle(String listener);
+
+
+ /**
+ * Remove a class name from the set of ContainerListener classes that
+ * will be added to newly created Wrappers.
+ *
+ * @param listener Class name of a ContainerListener class to be removed
+ */
+ public void removeWrapperListener(String listener);
+
+
+ /**
+ * Get the server.xml <context> attribute's xmlNamespaceAware.
+ * @return true if namespace awarenes is enabled.
+ *
+ */
+ public boolean getXmlNamespaceAware();
+
+
+ /**
+ * Get the server.xml <context> attribute's xmlValidation.
+ * @return true if validation is enabled.
+ *
+ */
+ public boolean getXmlValidation();
+
+
+ /**
+ * Set the validation feature of the XML parser used when
+ * parsing xml instances.
+ * @param xmlValidation true to enable xml instance validation
+ */
+ public void setXmlValidation(boolean xmlValidation);
+
+
+ /**
+ * Set the namespace aware feature of the XML parser used when
+ * parsing xml instances.
+ * @param xmlNamespaceAware true to enable namespace awareness
+ */
+ public void setXmlNamespaceAware(boolean xmlNamespaceAware);
+ /**
+ * Get the server.xml <context> attribute's xmlValidation.
+ * @return true if validation is enabled.
+ */
+
+
+ /**
+ * Set the validation feature of the XML parser used when
+ * parsing tlds files.
+ * @param tldValidation true to enable xml instance validation
+ */
+ public void setTldValidation(boolean tldValidation);
+
+
+ /**
+ * Get the server.xml <context> attribute's webXmlValidation.
+ * @return true if validation is enabled.
+ *
+ */
+ public boolean getTldValidation();
+
+
+ /**
+ * Get the server.xml <host> attribute's xmlNamespaceAware.
+ * @return true if namespace awarenes is enabled.
+ */
+ public boolean getTldNamespaceAware();
+
+
+ /**
+ * Set the namespace aware feature of the XML parser used when
+ * parsing xml instances.
+ * @param tldNamespaceAware true to enable namespace awareness
+ */
+ public void setTldNamespaceAware(boolean tldNamespaceAware);
+
+
+}
+
diff --git a/container/catalina/src/share/org/apache/catalina/Engine.java b/container/catalina/src/share/org/apache/catalina/Engine.java
new file mode 100644
index 0000000..a7d49eb
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Engine.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+/**
+ * An <b>Engine</b> is a Container that represents the entire Catalina servlet
+ * engine. It is useful in the following types of scenarios:
+ * <ul>
+ * <li>You wish to use Interceptors that see every single request processed
+ * by the entire engine.
+ * <li>You wish to run Catalina in with a standalone HTTP connector, but still
+ * want support for multiple virtual hosts.
+ * </ul>
+ * In general, you would not use an Engine when deploying Catalina connected
+ * to a web server (such as Apache), because the Connector will have
+ * utilized the web server's facilities to determine which Context (or
+ * perhaps even which Wrapper) should be utilized to process this request.
+ * <p>
+ * The child containers attached to an Engine are generally implementations
+ * of Host (representing a virtual host) or Context (representing individual
+ * an individual servlet context), depending upon the Engine implementation.
+ * <p>
+ * If used, an Engine is always the top level Container in a Catalina
+ * hierarchy. Therefore, the implementation's <code>setParent()</code> method
+ * should throw <code>IllegalArgumentException</code>.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public interface Engine extends Container {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return the default hostname for this Engine.
+ */
+ public String getDefaultHost();
+
+
+ /**
+ * Set the default hostname for this Engine.
+ *
+ * @param defaultHost The new default host
+ */
+ public void setDefaultHost(String defaultHost);
+
+
+ /**
+ * Retrieve the JvmRouteId for this engine.
+ */
+ public String getJvmRoute();
+
+
+ /**
+ * Set the JvmRouteId for this engine.
+ *
+ * @param jvmRouteId the (new) JVM Route ID. Each Engine within a cluster
+ * must have a unique JVM Route ID.
+ */
+ public void setJvmRoute(String jvmRouteId);
+
+
+ /**
+ * Return the <code>Service</code> with which we are associated (if any).
+ */
+ public Service getService();
+
+
+ /**
+ * Set the <code>Service</code> with which we are associated (if any).
+ *
+ * @param service The service that owns this Engine
+ */
+ public void setService(Service service);
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Globals.java b/container/catalina/src/share/org/apache/catalina/Globals.java
new file mode 100644
index 0000000..9b95dd3
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Globals.java
@@ -0,0 +1,317 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+/**
+ * Global constants that are applicable to multiple packages within Catalina.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public final class Globals {
+
+ /**
+ * The servlet context attribute under which we store the alternate
+ * deployment descriptor for this web application
+ */
+ public static final String ALT_DD_ATTR =
+ "org.apache.catalina.deploy.alt_dd";
+
+ /**
+ * The request attribute under which we store the array of X509Certificate
+ * objects representing the certificate chain presented by our client,
+ * if any.
+ */
+ public static final String CERTIFICATES_ATTR =
+ "javax.servlet.request.X509Certificate";
+
+ /**
+ * The request attribute under which we store the name of the cipher suite
+ * being used on an SSL connection (as an object of type
+ * java.lang.String).
+ */
+ public static final String CIPHER_SUITE_ATTR =
+ "javax.servlet.request.cipher_suite";
+
+
+ /**
+ * The servlet context attribute under which we store the class loader
+ * used for loading servlets (as an object of type java.lang.ClassLoader).
+ */
+ public static final String CLASS_LOADER_ATTR =
+ "org.apache.catalina.classloader";
+
+ /**
+ * Request dispatcher state.
+ */
+ public static final String DISPATCHER_TYPE_ATTR =
+ "org.apache.catalina.core.DISPATCHER_TYPE";
+
+ /**
+ * Request dispatcher path.
+ */
+ public static final String DISPATCHER_REQUEST_PATH_ATTR =
+ "org.apache.catalina.core.DISPATCHER_REQUEST_PATH";
+
+ /**
+ * The JNDI directory context which is associated with the context. This
+ * context can be used to manipulate static files.
+ */
+ public static final String RESOURCES_ATTR =
+ "org.apache.catalina.resources";
+
+
+ /**
+ * The servlet context attribute under which we store the class path
+ * for our application class loader (as an object of type String),
+ * delimited with the appropriate path delimiter for this platform.
+ */
+ public static final String CLASS_PATH_ATTR =
+ "org.apache.catalina.jsp_classpath";
+
+
+ /**
+ * The request attribute under which the original context path is stored
+ * on an included dispatcher request.
+ */
+ public static final String INCLUDE_CONTEXT_PATH_ATTR =
+ "javax.servlet.include.context_path";
+
+
+ /**
+ * The request attribute under which the original context path is stored
+ * on an forwarded dispatcher request.
+ */
+ public static final String FORWARD_CONTEXT_PATH_ATTR =
+ "javax.servlet.forward.context_path";
+
+
+ /**
+ * The request attribute under which we forward a Java exception
+ * (as an object of type Throwable) to an error page.
+ */
+ public static final String EXCEPTION_ATTR =
+ "javax.servlet.error.exception";
+
+
+ /**
+ * The request attribute under which we forward the request URI
+ * (as an object of type String) of the page on which an error occurred.
+ */
+ public static final String EXCEPTION_PAGE_ATTR =
+ "javax.servlet.error.request_uri";
+
+
+ /**
+ * The request attribute under which we forward a Java exception type
+ * (as an object of type Class) to an error page.
+ */
+ public static final String EXCEPTION_TYPE_ATTR =
+ "javax.servlet.error.exception_type";
+
+
+ /**
+ * The request attribute under which we forward an HTTP status message
+ * (as an object of type STring) to an error page.
+ */
+ public static final String ERROR_MESSAGE_ATTR =
+ "javax.servlet.error.message";
+
+
+ /**
+ * The request attribute under which the Invoker servlet will store
+ * the invoking servlet path, if it was used to execute a servlet
+ * indirectly instead of through a servlet mapping.
+ */
+ public static final String INVOKED_ATTR =
+ "org.apache.catalina.INVOKED";
+
+
+ /**
+ * The request attribute under which we expose the value of the
+ * <code><jsp-file></code> value associated with this servlet,
+ * if any.
+ */
+ public static final String JSP_FILE_ATTR =
+ "org.apache.catalina.jsp_file";
+
+
+ /**
+ * The request attribute under which we store the key size being used for
+ * this SSL connection (as an object of type java.lang.Integer).
+ */
+ public static final String KEY_SIZE_ATTR =
+ "javax.servlet.request.key_size";
+
+
+ /**
+ * The servlet context attribute under which the managed bean Registry
+ * will be stored for privileged contexts (if enabled).
+ */
+ public static final String MBEAN_REGISTRY_ATTR =
+ "org.apache.catalina.Registry";
+
+
+ /**
+ * The servlet context attribute under which the MBeanServer will be stored
+ * for privileged contexts (if enabled).
+ */
+ public static final String MBEAN_SERVER_ATTR =
+ "org.apache.catalina.MBeanServer";
+
+
+ /**
+ * The request attribute under which we store the servlet name on a
+ * named dispatcher request.
+ */
+ public static final String NAMED_DISPATCHER_ATTR =
+ "org.apache.catalina.NAMED";
+
+
+ /**
+ * The request attribute under which the original path info is stored
+ * on an included dispatcher request.
+ */
+ public static final String INCLUDE_PATH_INFO_ATTR =
+ "javax.servlet.include.path_info";
+
+
+ /**
+ * The request attribute under which the original path info is stored
+ * on an forwarded dispatcher request.
+ */
+ public static final String FORWARD_PATH_INFO_ATTR =
+ "javax.servlet.forward.path_info";
+
+
+ /**
+ * The request attribute under which the original query string is stored
+ * on an included dispatcher request.
+ */
+ public static final String INCLUDE_QUERY_STRING_ATTR =
+ "javax.servlet.include.query_string";
+
+
+ /**
+ * The request attribute under which the original query string is stored
+ * on an forwarded dispatcher request.
+ */
+ public static final String FORWARD_QUERY_STRING_ATTR =
+ "javax.servlet.forward.query_string";
+
+
+ /**
+ * The request attribute under which the original request URI is stored
+ * on an included dispatcher request.
+ */
+ public static final String INCLUDE_REQUEST_URI_ATTR =
+ "javax.servlet.include.request_uri";
+
+
+ /**
+ * The request attribute under which the original request URI is stored
+ * on an forwarded dispatcher request.
+ */
+ public static final String FORWARD_REQUEST_URI_ATTR =
+ "javax.servlet.forward.request_uri";
+
+
+ /**
+ * The request attribute under which we forward a servlet name to
+ * an error page.
+ */
+ public static final String SERVLET_NAME_ATTR =
+ "javax.servlet.error.servlet_name";
+
+
+ /**
+ * The request attribute under which the original servlet path is stored
+ * on an included dispatcher request.
+ */
+ public static final String INCLUDE_SERVLET_PATH_ATTR =
+ "javax.servlet.include.servlet_path";
+
+
+ /**
+ * The request attribute under which the original servlet path is stored
+ * on an forwarded dispatcher request.
+ */
+ public static final String FORWARD_SERVLET_PATH_ATTR =
+ "javax.servlet.forward.servlet_path";
+
+
+ /**
+ * The name of the cookie used to pass the session identifier back
+ * and forth with the client.
+ */
+ public static final String SESSION_COOKIE_NAME = "JSESSIONID";
+
+
+ /**
+ * The name of the path parameter used to pass the session identifier
+ * back and forth with the client.
+ */
+ public static final String SESSION_PARAMETER_NAME = "jsessionid";
+
+
+ /**
+ * The servlet context attribute under which we store a flag used
+ * to mark this request as having been processed by the SSIServlet.
+ * We do this because of the pathInfo mangling happening when using
+ * the CGIServlet in conjunction with the SSI servlet. (value stored
+ * as an object of type String)
+ */
+ public static final String SSI_FLAG_ATTR =
+ "org.apache.catalina.ssi.SSIServlet";
+
+
+ /**
+ * The request attribute under which we forward an HTTP status code
+ * (as an object of type Integer) to an error page.
+ */
+ public static final String STATUS_CODE_ATTR =
+ "javax.servlet.error.status_code";
+
+
+ /**
+ * The subject under which the AccessControlContext is running.
+ */
+ public static final String SUBJECT_ATTR =
+ "javax.security.auth.subject";
+
+
+ /**
+ * The servlet context attribute under which we record the set of
+ * welcome files (as an object of type String[]) for this application.
+ */
+ public static final String WELCOME_FILES_ATTR =
+ "org.apache.catalina.WELCOME_FILES";
+
+
+ /**
+ * The servlet context attribute under which we store a temporary
+ * working directory (as an object of type File) for use by servlets
+ * within this web application.
+ */
+ public static final String WORK_DIR_ATTR =
+ "javax.servlet.context.tempdir";
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Group.java b/container/catalina/src/share/org/apache/catalina/Group.java
new file mode 100644
index 0000000..cdb13b2
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Group.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+import java.security.Principal;
+import java.util.Iterator;
+
+
+/**
+ * <p>Abstract representation of a group of {@link User}s in a
+ * {@link UserDatabase}. Each user that is a member of this group
+ * inherits the {@link Role}s assigned to the group.</p>
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ * @since 4.1
+ */
+
+public interface Group extends Principal {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return the description of this group.
+ */
+ public String getDescription();
+
+
+ /**
+ * Set the description of this group.
+ *
+ * @param description The new description
+ */
+ public void setDescription(String description);
+
+
+ /**
+ * Return the group name of this group, which must be unique
+ * within the scope of a {@link UserDatabase}.
+ */
+ public String getGroupname();
+
+
+ /**
+ * Set the group name of this group, which must be unique
+ * within the scope of a {@link UserDatabase}.
+ *
+ * @param groupname The new group name
+ */
+ public void setGroupname(String groupname);
+
+
+ /**
+ * Return the set of {@link Role}s assigned specifically to this group.
+ */
+ public Iterator getRoles();
+
+
+ /**
+ * Return the {@link UserDatabase} within which this Group is defined.
+ */
+ public UserDatabase getUserDatabase();
+
+
+ /**
+ * Return the set of {@link User}s that are members of this group.
+ */
+ public Iterator getUsers();
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Add a new {@link Role} to those assigned specifically to this group.
+ *
+ * @param role The new role
+ */
+ public void addRole(Role role);
+
+
+ /**
+ * Is this group specifically assigned the specified {@link Role}?
+ *
+ * @param role The role to check
+ */
+ public boolean isInRole(Role role);
+
+
+ /**
+ * Remove a {@link Role} from those assigned to this group.
+ *
+ * @param role The old role
+ */
+ public void removeRole(Role role);
+
+
+ /**
+ * Remove all {@link Role}s from those assigned to this group.
+ */
+ public void removeRoles();
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Host.java b/container/catalina/src/share/org/apache/catalina/Host.java
new file mode 100644
index 0000000..db5ce2b
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Host.java
@@ -0,0 +1,218 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+
+/**
+ * A <b>Host</b> is a Container that represents a virtual host in the
+ * Catalina servlet engine. It is useful in the following types of scenarios:
+ * <ul>
+ * <li>You wish to use Interceptors that see every single request processed
+ * by this particular virtual host.
+ * <li>You wish to run Catalina in with a standalone HTTP connector, but still
+ * want support for multiple virtual hosts.
+ * </ul>
+ * In general, you would not use a Host when deploying Catalina connected
+ * to a web server (such as Apache), because the Connector will have
+ * utilized the web server's facilities to determine which Context (or
+ * perhaps even which Wrapper) should be utilized to process this request.
+ * <p>
+ * The parent Container attached to a Host is generally an Engine, but may
+ * be some other implementation, or may be omitted if it is not necessary.
+ * <p>
+ * The child containers attached to a Host are generally implementations
+ * of Context (representing an individual servlet context).
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public interface Host extends Container {
+
+
+ // ----------------------------------------------------- Manifest Constants
+
+
+ /**
+ * The ContainerEvent event type sent when a new alias is added
+ * by <code>addAlias()</code>.
+ */
+ public static final String ADD_ALIAS_EVENT = "addAlias";
+
+
+ /**
+ * The ContainerEvent event type sent when an old alias is removed
+ * by <code>removeAlias()</code>.
+ */
+ public static final String REMOVE_ALIAS_EVENT = "removeAlias";
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return the application root for this Host. This can be an absolute
+ * pathname, a relative pathname, or a URL.
+ */
+ public String getAppBase();
+
+
+ /**
+ * Set the application root for this Host. This can be an absolute
+ * pathname, a relative pathname, or a URL.
+ *
+ * @param appBase The new application root
+ */
+ public void setAppBase(String appBase);
+
+
+ /**
+ * Return the value of the auto deploy flag. If true, it indicates that
+ * this host's child webapps should be discovred and automatically
+ * deployed dynamically.
+ */
+ public boolean getAutoDeploy();
+
+
+ /**
+ * Set the auto deploy flag value for this host.
+ *
+ * @param autoDeploy The new auto deploy flag
+ */
+ public void setAutoDeploy(boolean autoDeploy);
+
+
+ /**
+ * Return the Java class name of the context configuration class
+ * for new web applications.
+ */
+ public String getConfigClass();
+
+
+ /**
+ * Set the Java class name of the context configuration class
+ * for new web applications.
+ *
+ * @param configClass The new context configuration class
+ */
+ public void setConfigClass(String configClass);
+
+
+ /**
+ * Return the value of the deploy on startup flag. If true, it indicates
+ * that this host's child webapps should be discovred and automatically
+ * deployed.
+ */
+ public boolean getDeployOnStartup();
+
+
+ /**
+ * Set the deploy on startup flag value for this host.
+ *
+ * @param deployOnStartup The new deploy on startup flag
+ */
+ public void setDeployOnStartup(boolean deployOnStartup);
+
+
+ /**
+ * Return the canonical, fully qualified, name of the virtual host
+ * this Container represents.
+ */
+ public String getName();
+
+
+ /**
+ * Set the canonical, fully qualified, name of the virtual host
+ * this Container represents.
+ *
+ * @param name Virtual host name
+ *
+ * @exception IllegalArgumentException if name is null
+ */
+ public void setName(String name);
+
+
+ /**
+ * Get the server.xml <host> attribute's xmlNamespaceAware.
+ * @return true if namespace awarenes is enabled.
+ *
+ */
+ public boolean getXmlNamespaceAware();
+
+
+ /**
+ * Get the server.xml <host> attribute's xmlValidation.
+ * @return true if validation is enabled.
+ *
+ */
+ public boolean getXmlValidation();
+
+
+ /**
+ * Set the validation feature of the XML parser used when
+ * parsing xml instances.
+ * @param xmlValidation true to enable xml instance validation
+ */
+ public void setXmlValidation(boolean xmlValidation);
+
+
+ /**
+ * Set the namespace aware feature of the XML parser used when
+ * parsing xml instances.
+ * @param xmlNamespaceAware true to enable namespace awareness
+ */
+ public void setXmlNamespaceAware(boolean xmlNamespaceAware);
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Add an alias name that should be mapped to this same Host.
+ *
+ * @param alias The alias to be added
+ */
+ public void addAlias(String alias);
+
+
+ /**
+ * Return the set of alias names for this Host. If none are defined,
+ * a zero length array is returned.
+ */
+ public String[] findAliases();
+
+
+ /**
+ * Return the Context that would be used to process the specified
+ * host-relative request URI, if any; otherwise return <code>null</code>.
+ *
+ * @param uri Request URI to be mapped
+ */
+ public Context map(String uri);
+
+
+ /**
+ * Remove the specified alias name from the aliases for this Host.
+ *
+ * @param alias Alias name to be removed
+ */
+ public void removeAlias(String alias);
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/InstanceEvent.java b/container/catalina/src/share/org/apache/catalina/InstanceEvent.java
new file mode 100644
index 0000000..f7d9480
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/InstanceEvent.java
@@ -0,0 +1,448 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+import java.util.EventObject;
+import javax.servlet.Filter;
+import javax.servlet.Servlet;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+
+/**
+ * General event for notifying listeners of significant events related to
+ * a specific instance of a Servlet, or a specific instance of a Filter,
+ * as opposed to the Wrapper component that manages it.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public final class InstanceEvent
+ extends EventObject {
+
+
+ // ----------------------------------------------------- Manifest Constants
+
+
+ /**
+ * The event indicating that the <code>init()</code> method is about
+ * to be called for this instance.
+ */
+ public static final String BEFORE_INIT_EVENT = "beforeInit";
+
+
+ /**
+ * The event indicating that the <code>init()</code> method has returned.
+ */
+ public static final String AFTER_INIT_EVENT = "afterInit";
+
+
+ /**
+ * The event indicating that the <code>service()</code> method is about
+ * to be called on a servlet. The <code>servlet</code> property contains
+ * the servlet being called, and the <code>request</code> and
+ * <code>response</code> properties contain the current request and
+ * response being processed.
+ */
+ public static final String BEFORE_SERVICE_EVENT = "beforeService";
+
+
+ /**
+ * The event indicating that the <code>service()</code> method has
+ * returned. The <code>servlet</code> property contains the servlet
+ * that was called, and the <code>request</code> and
+ * <code>response</code> properties contain the current request and
+ * response being processed.
+ */
+ public static final String AFTER_SERVICE_EVENT = "afterService";
+
+
+ /**
+ * The event indicating that the <code>destroy</code> method is about
+ * to be called for this instance.
+ */
+ public static final String BEFORE_DESTROY_EVENT = "beforeDestroy";
+
+
+ /**
+ * The event indicating that the <code>destroy()</code> method has
+ * returned.
+ */
+ public static final String AFTER_DESTROY_EVENT = "afterDestroy";
+
+
+ /**
+ * The event indicating that the <code>service()</code> method of a
+ * servlet accessed via a request dispatcher is about to be called.
+ * The <code>servlet</code> property contains a reference to the
+ * dispatched-to servlet instance, and the <code>request</code> and
+ * <code>response</code> properties contain the current request and
+ * response being processed. The <code>wrapper</code> property will
+ * contain a reference to the dispatched-to Wrapper.
+ */
+ public static final String BEFORE_DISPATCH_EVENT = "beforeDispatch";
+
+
+ /**
+ * The event indicating that the <code>service()</code> method of a
+ * servlet accessed via a request dispatcher has returned. The
+ * <code>servlet</code> property contains a reference to the
+ * dispatched-to servlet instance, and the <code>request</code> and
+ * <code>response</code> properties contain the current request and
+ * response being processed. The <code>wrapper</code> property will
+ * contain a reference to the dispatched-to Wrapper.
+ */
+ public static final String AFTER_DISPATCH_EVENT = "afterDispatch";
+
+
+ /**
+ * The event indicating that the <code>doFilter()</code> method of a
+ * Filter is about to be called. The <code>filter</code> property
+ * contains a reference to the relevant filter instance, and the
+ * <code>request</code> and <code>response</code> properties contain
+ * the current request and response being processed.
+ */
+ public static final String BEFORE_FILTER_EVENT = "beforeFilter";
+
+
+ /**
+ * The event indicating that the <code>doFilter()</code> method of a
+ * Filter has returned. The <code>filter</code> property contains
+ * a reference to the relevant filter instance, and the
+ * <code>request</code> and <code>response</code> properties contain
+ * the current request and response being processed.
+ */
+ public static final String AFTER_FILTER_EVENT = "afterFilter";
+
+
+ // ----------------------------------------------------------- Constructors
+
+
+ /**
+ * Construct a new InstanceEvent with the specified parameters. This
+ * constructor is used for filter lifecycle events.
+ *
+ * @param wrapper Wrapper managing this servlet instance
+ * @param filter Filter instance for which this event occurred
+ * @param type Event type (required)
+ */
+ public InstanceEvent(Wrapper wrapper, Filter filter, String type) {
+
+ super(wrapper);
+ this.wrapper = wrapper;
+ this.filter = filter;
+ this.servlet = null;
+ this.type = type;
+
+ }
+
+
+ /**
+ * Construct a new InstanceEvent with the specified parameters. This
+ * constructor is used for filter lifecycle events.
+ *
+ * @param wrapper Wrapper managing this servlet instance
+ * @param filter Filter instance for which this event occurred
+ * @param type Event type (required)
+ * @param exception Exception that occurred
+ */
+ public InstanceEvent(Wrapper wrapper, Filter filter, String type,
+ Throwable exception) {
+
+ super(wrapper);
+ this.wrapper = wrapper;
+ this.filter = filter;
+ this.servlet = null;
+ this.type = type;
+ this.exception = exception;
+
+ }
+
+
+ /**
+ * Construct a new InstanceEvent with the specified parameters. This
+ * constructor is used for filter processing events.
+ *
+ * @param wrapper Wrapper managing this servlet instance
+ * @param filter Filter instance for which this event occurred
+ * @param type Event type (required)
+ * @param request Servlet request we are processing
+ * @param response Servlet response we are processing
+ */
+ public InstanceEvent(Wrapper wrapper, Filter filter, String type,
+ ServletRequest request, ServletResponse response) {
+
+ super(wrapper);
+ this.wrapper = wrapper;
+ this.filter = filter;
+ this.servlet = null;
+ this.type = type;
+ this.request = request;
+ this.response = response;
+
+ }
+
+
+ /**
+ * Construct a new InstanceEvent with the specified parameters. This
+ * constructor is used for filter processing events.
+ *
+ * @param wrapper Wrapper managing this servlet instance
+ * @param filter Filter instance for which this event occurred
+ * @param type Event type (required)
+ * @param request Servlet request we are processing
+ * @param response Servlet response we are processing
+ * @param exception Exception that occurred
+ */
+ public InstanceEvent(Wrapper wrapper, Filter filter, String type,
+ ServletRequest request, ServletResponse response,
+ Throwable exception) {
+
+ super(wrapper);
+ this.wrapper = wrapper;
+ this.filter = filter;
+ this.servlet = null;
+ this.type = type;
+ this.request = request;
+ this.response = response;
+ this.exception = exception;
+
+ }
+
+
+ /**
+ * Construct a new InstanceEvent with the specified parameters. This
+ * constructor is used for processing servlet lifecycle events.
+ *
+ * @param wrapper Wrapper managing this servlet instance
+ * @param servlet Servlet instance for which this event occurred
+ * @param type Event type (required)
+ */
+ public InstanceEvent(Wrapper wrapper, Servlet servlet, String type) {
+
+ super(wrapper);
+ this.wrapper = wrapper;
+ this.filter = null;
+ this.servlet = servlet;
+ this.type = type;
+
+ }
+
+
+ /**
+ * Construct a new InstanceEvent with the specified parameters. This
+ * constructor is used for processing servlet lifecycle events.
+ *
+ * @param wrapper Wrapper managing this servlet instance
+ * @param servlet Servlet instance for which this event occurred
+ * @param type Event type (required)
+ * @param exception Exception that occurred
+ */
+ public InstanceEvent(Wrapper wrapper, Servlet servlet, String type,
+ Throwable exception) {
+
+ super(wrapper);
+ this.wrapper = wrapper;
+ this.filter = null;
+ this.servlet = servlet;
+ this.type = type;
+ this.exception = exception;
+
+ }
+
+
+ /**
+ * Construct a new InstanceEvent with the specified parameters. This
+ * constructor is used for processing servlet processing events.
+ *
+ * @param wrapper Wrapper managing this servlet instance
+ * @param servlet Servlet instance for which this event occurred
+ * @param type Event type (required)
+ * @param request Servlet request we are processing
+ * @param response Servlet response we are processing
+ */
+ public InstanceEvent(Wrapper wrapper, Servlet servlet, String type,
+ ServletRequest request, ServletResponse response) {
+
+ super(wrapper);
+ this.wrapper = wrapper;
+ this.filter = null;
+ this.servlet = servlet;
+ this.type = type;
+ this.request = request;
+ this.response = response;
+
+ }
+
+
+ /**
+ * Construct a new InstanceEvent with the specified parameters. This
+ * constructor is used for processing servlet processing events.
+ *
+ * @param wrapper Wrapper managing this servlet instance
+ * @param servlet Servlet instance for which this event occurred
+ * @param type Event type (required)
+ * @param request Servlet request we are processing
+ * @param response Servlet response we are processing
+ * @param exception Exception that occurred
+ */
+ public InstanceEvent(Wrapper wrapper, Servlet servlet, String type,
+ ServletRequest request, ServletResponse response,
+ Throwable exception) {
+
+ super(wrapper);
+ this.wrapper = wrapper;
+ this.filter = null;
+ this.servlet = servlet;
+ this.type = type;
+ this.request = request;
+ this.response = response;
+ this.exception = exception;
+
+ }
+
+
+ // ----------------------------------------------------- Instance Variables
+
+
+ /**
+ * The exception that was thrown during the processing being reported
+ * by this event (AFTER_INIT_EVENT, AFTER_SERVICE_EVENT,
+ * AFTER_DESTROY_EVENT, AFTER_DISPATCH_EVENT, and AFTER_FILTER_EVENT only).
+ */
+ private Throwable exception = null;
+
+
+ /**
+ * The Filter instance for which this event occurred (BEFORE_FILTER_EVENT
+ * and AFTER_FILTER_EVENT only).
+ */
+ private Filter filter = null;
+
+
+ /**
+ * The servlet request being processed (BEFORE_FILTER_EVENT,
+ * AFTER_FILTER_EVENT, BEFORE_SERVICE_EVENT, and AFTER_SERVICE_EVENT).
+ */
+ private ServletRequest request = null;
+
+
+ /**
+ * The servlet response being processed (BEFORE_FILTER_EVENT,
+ * AFTER_FILTER_EVENT, BEFORE_SERVICE_EVENT, and AFTER_SERVICE_EVENT).
+ */
+ private ServletResponse response = null;
+
+
+ /**
+ * The Servlet instance for which this event occurred (not present on
+ * BEFORE_FILTER_EVENT or AFTER_FILTER_EVENT events).
+ */
+ private Servlet servlet = null;
+
+
+ /**
+ * The event type this instance represents.
+ */
+ private String type = null;
+
+
+ /**
+ * The Wrapper managing the servlet instance for which this event occurred.
+ */
+ private Wrapper wrapper = null;
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return the exception that occurred during the processing
+ * that was reported by this event.
+ */
+ public Throwable getException() {
+
+ return (this.exception);
+
+ }
+
+
+ /**
+ * Return the filter instance for which this event occurred.
+ */
+ public Filter getFilter() {
+
+ return (this.filter);
+
+ }
+
+
+ /**
+ * Return the servlet request for which this event occurred.
+ */
+ public ServletRequest getRequest() {
+
+ return (this.request);
+
+ }
+
+
+ /**
+ * Return the servlet response for which this event occurred.
+ */
+ public ServletResponse getResponse() {
+
+ return (this.response);
+
+ }
+
+
+ /**
+ * Return the servlet instance for which this event occurred.
+ */
+ public Servlet getServlet() {
+
+ return (this.servlet);
+
+ }
+
+
+ /**
+ * Return the event type of this event.
+ */
+ public String getType() {
+
+ return (this.type);
+
+ }
+
+
+ /**
+ * Return the Wrapper managing the servlet instance for which this
+ * event occurred.
+ */
+ public Wrapper getWrapper() {
+
+ return (this.wrapper);
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/InstanceListener.java b/container/catalina/src/share/org/apache/catalina/InstanceListener.java
new file mode 100644
index 0000000..4eebf36
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/InstanceListener.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+/**
+ * Interface defining a listener for significant events related to a
+ * specific servlet instance, rather than to the Wrapper component that
+ * is managing that instance.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public interface InstanceListener {
+
+
+ /**
+ * Acknowledge the occurrence of the specified event.
+ *
+ * @param event InstanceEvent that has occurred
+ */
+ public void instanceEvent(InstanceEvent event);
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Lifecycle.java b/container/catalina/src/share/org/apache/catalina/Lifecycle.java
new file mode 100644
index 0000000..0413b5d
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Lifecycle.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+/**
+ * Common interface for component life cycle methods. Catalina components
+ * may, but are not required to, implement this interface (as well as the
+ * appropriate interface(s) for the functionality they support) in order to
+ * provide a consistent mechanism to start and stop the component.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public interface Lifecycle {
+
+
+ // ----------------------------------------------------- Manifest Constants
+
+
+ /**
+ * The LifecycleEvent type for the "component init" event.
+ */
+ public static final String INIT_EVENT = "init";
+
+
+ /**
+ * The LifecycleEvent type for the "component start" event.
+ */
+ public static final String START_EVENT = "start";
+
+
+ /**
+ * The LifecycleEvent type for the "component before start" event.
+ */
+ public static final String BEFORE_START_EVENT = "before_start";
+
+
+ /**
+ * The LifecycleEvent type for the "component after start" event.
+ */
+ public static final String AFTER_START_EVENT = "after_start";
+
+
+ /**
+ * The LifecycleEvent type for the "component stop" event.
+ */
+ public static final String STOP_EVENT = "stop";
+
+
+ /**
+ * The LifecycleEvent type for the "component before stop" event.
+ */
+ public static final String BEFORE_STOP_EVENT = "before_stop";
+
+
+ /**
+ * The LifecycleEvent type for the "component after stop" event.
+ */
+ public static final String AFTER_STOP_EVENT = "after_stop";
+
+
+ /**
+ * The LifecycleEvent type for the "component destroy" event.
+ */
+ public static final String DESTROY_EVENT = "destroy";
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Add a LifecycleEvent listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addLifecycleListener(LifecycleListener listener);
+
+
+ /**
+ * Get the lifecycle listeners associated with this lifecycle. If this
+ * Lifecycle has no listeners registered, a zero-length array is returned.
+ */
+ public LifecycleListener[] findLifecycleListeners();
+
+
+ /**
+ * Remove a LifecycleEvent listener from this component.
+ *
+ * @param listener The listener to remove
+ */
+ public void removeLifecycleListener(LifecycleListener listener);
+
+
+ /**
+ * Prepare for the beginning of active use of the public methods of this
+ * component. This method should be called before any of the public
+ * methods of this component are utilized. It should also send a
+ * LifecycleEvent of type START_EVENT to any registered listeners.
+ *
+ * @exception LifecycleException if this component detects a fatal error
+ * that prevents this component from being used
+ */
+ public void start() throws LifecycleException;
+
+
+ /**
+ * Gracefully terminate the active use of the public methods of this
+ * component. This method should be the last one called on a given
+ * instance of this component. It should also send a LifecycleEvent
+ * of type STOP_EVENT to any registered listeners.
+ *
+ * @exception LifecycleException if this component detects a fatal error
+ * that needs to be reported
+ */
+ public void stop() throws LifecycleException;
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/LifecycleEvent.java b/container/catalina/src/share/org/apache/catalina/LifecycleEvent.java
new file mode 100644
index 0000000..ce345b4
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/LifecycleEvent.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+import java.util.EventObject;
+
+
+/**
+ * General event for notifying listeners of significant changes on a component
+ * that implements the Lifecycle interface. In particular, this will be useful
+ * on Containers, where these events replace the ContextInterceptor concept in
+ * Tomcat 3.x.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public final class LifecycleEvent
+ extends EventObject {
+
+
+ // ----------------------------------------------------------- Constructors
+
+
+ /**
+ * Construct a new LifecycleEvent with the specified parameters.
+ *
+ * @param lifecycle Component on which this event occurred
+ * @param type Event type (required)
+ */
+ public LifecycleEvent(Lifecycle lifecycle, String type) {
+
+ this(lifecycle, type, null);
+
+ }
+
+
+ /**
+ * Construct a new LifecycleEvent with the specified parameters.
+ *
+ * @param lifecycle Component on which this event occurred
+ * @param type Event type (required)
+ * @param data Event data (if any)
+ */
+ public LifecycleEvent(Lifecycle lifecycle, String type, Object data) {
+
+ super(lifecycle);
+ this.lifecycle = lifecycle;
+ this.type = type;
+ this.data = data;
+
+ }
+
+
+ // ----------------------------------------------------- Instance Variables
+
+
+ /**
+ * The event data associated with this event.
+ */
+ private Object data = null;
+
+
+ /**
+ * The Lifecycle on which this event occurred.
+ */
+ private Lifecycle lifecycle = null;
+
+
+ /**
+ * The event type this instance represents.
+ */
+ private String type = null;
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return the event data of this event.
+ */
+ public Object getData() {
+
+ return (this.data);
+
+ }
+
+
+ /**
+ * Return the Lifecycle on which this event occurred.
+ */
+ public Lifecycle getLifecycle() {
+
+ return (this.lifecycle);
+
+ }
+
+
+ /**
+ * Return the event type of this event.
+ */
+ public String getType() {
+
+ return (this.type);
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/LifecycleException.java b/container/catalina/src/share/org/apache/catalina/LifecycleException.java
new file mode 100644
index 0000000..00ea305
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/LifecycleException.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+/**
+ * General purpose exception that is thrown to indicate a lifecycle related
+ * problem. Such exceptions should generally be considered fatal to the
+ * operation of the application containing this component.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public final class LifecycleException extends Exception {
+
+
+ //------------------------------------------------------------ Constructors
+
+
+ /**
+ * Construct a new LifecycleException with no other information.
+ */
+ public LifecycleException() {
+
+ this(null, null);
+
+ }
+
+
+ /**
+ * Construct a new LifecycleException for the specified message.
+ *
+ * @param message Message describing this exception
+ */
+ public LifecycleException(String message) {
+
+ this(message, null);
+
+ }
+
+
+ /**
+ * Construct a new LifecycleException for the specified throwable.
+ *
+ * @param throwable Throwable that caused this exception
+ */
+ public LifecycleException(Throwable throwable) {
+
+ this(null, throwable);
+
+ }
+
+
+ /**
+ * Construct a new LifecycleException for the specified message
+ * and throwable.
+ *
+ * @param message Message describing this exception
+ * @param throwable Throwable that caused this exception
+ */
+ public LifecycleException(String message, Throwable throwable) {
+
+ super();
+ this.message = message;
+ this.throwable = throwable;
+
+ }
+
+
+ //------------------------------------------------------ Instance Variables
+
+
+ /**
+ * The error message passed to our constructor (if any)
+ */
+ protected String message = null;
+
+
+ /**
+ * The underlying exception or error passed to our constructor (if any)
+ */
+ protected Throwable throwable = null;
+
+
+ //---------------------------------------------------------- Public Methods
+
+
+ /**
+ * Returns the message associated with this exception, if any.
+ */
+ public String getMessage() {
+
+ return (message);
+
+ }
+
+
+ /**
+ * Returns the throwable that caused this exception, if any.
+ */
+ public Throwable getThrowable() {
+
+ return (throwable);
+
+ }
+
+
+ /**
+ * Return a formatted string that describes this exception.
+ */
+ public String toString() {
+
+ StringBuffer sb = new StringBuffer("LifecycleException: ");
+ if (message != null) {
+ sb.append(message);
+ if (throwable != null) {
+ sb.append(": ");
+ }
+ }
+ if (throwable != null) {
+ sb.append(throwable.toString());
+ }
+ return (sb.toString());
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/LifecycleListener.java b/container/catalina/src/share/org/apache/catalina/LifecycleListener.java
new file mode 100644
index 0000000..bde3ac8
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/LifecycleListener.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+
+
+/**
+ * Interface defining a listener for significant events (including "component
+ * start" and "component stop" generated by a component that implements the
+ * Lifecycle interface.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public interface LifecycleListener {
+
+
+ /**
+ * Acknowledge the occurrence of the specified event.
+ *
+ * @param event LifecycleEvent that has occurred
+ */
+ public void lifecycleEvent(LifecycleEvent event);
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Loader.java b/container/catalina/src/share/org/apache/catalina/Loader.java
new file mode 100644
index 0000000..bf98d36
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Loader.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+import java.beans.PropertyChangeListener;
+
+
+/**
+ * A <b>Loader</b> represents a Java ClassLoader implementation that can
+ * be used by a Container to load class files (within a repository associated
+ * with the Loader) that are designed to be reloaded upon request, as well as
+ * a mechanism to detect whether changes have occurred in the underlying
+ * repository.
+ * <p>
+ * In order for a <code>Loader</code> implementation to successfully operate
+ * with a <code>Context</code> implementation that implements reloading, it
+ * must obey the following constraints:
+ * <ul>
+ * <li>Must implement <code>Lifecycle</code> so that the Context can indicate
+ * that a new class loader is required.
+ * <li>The <code>start()</code> method must unconditionally create a new
+ * <code>ClassLoader</code> implementation.
+ * <li>The <code>stop()</code> method must throw away its reference to the
+ * <code>ClassLoader</code> previously utilized, so that the class loader,
+ * all classes loaded by it, and all objects of those classes, can be
+ * garbage collected.
+ * <li>Must allow a call to <code>stop()</code> to be followed by a call to
+ * <code>start()</code> on the same <code>Loader</code> instance.
+ * <li>Based on a policy chosen by the implementation, must call the
+ * <code>Context.reload()</code> method on the owning <code>Context</code>
+ * when a change to one or more of the class files loaded by this class
+ * loader is detected.
+ * </ul>
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public interface Loader {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return the Java class loader to be used by this Container.
+ */
+ public ClassLoader getClassLoader();
+
+
+ /**
+ * Return the Container with which this Loader has been associated.
+ */
+ public Container getContainer();
+
+
+ /**
+ * Set the Container with which this Loader has been associated.
+ *
+ * @param container The associated Container
+ */
+ public void setContainer(Container container);
+
+
+ /**
+ * Return the "follow standard delegation model" flag used to configure
+ * our ClassLoader.
+ */
+ public boolean getDelegate();
+
+
+ /**
+ * Set the "follow standard delegation model" flag used to configure
+ * our ClassLoader.
+ *
+ * @param delegate The new flag
+ */
+ public void setDelegate(boolean delegate);
+
+
+ /**
+ * Return descriptive information about this Loader implementation and
+ * the corresponding version number, in the format
+ * <code><description>/<version></code>.
+ */
+ public String getInfo();
+
+
+ /**
+ * Return the reloadable flag for this Loader.
+ */
+ public boolean getReloadable();
+
+
+ /**
+ * Set the reloadable flag for this Loader.
+ *
+ * @param reloadable The new reloadable flag
+ */
+ public void setReloadable(boolean reloadable);
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Add a property change listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener);
+
+
+ /**
+ * Add a new repository to the set of repositories for this class loader.
+ *
+ * @param repository Repository to be added
+ */
+ public void addRepository(String repository);
+
+
+ /**
+ * Return the set of repositories defined for this class loader.
+ * If none are defined, a zero-length array is returned.
+ */
+ public String[] findRepositories();
+
+
+ /**
+ * Has the internal repository associated with this Loader been modified,
+ * such that the loaded classes should be reloaded?
+ */
+ public boolean modified();
+
+
+ /**
+ * Remove a property change listener from this component.
+ *
+ * @param listener The listener to remove
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener);
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Manager.java b/container/catalina/src/share/org/apache/catalina/Manager.java
new file mode 100644
index 0000000..a3de4aa
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Manager.java
@@ -0,0 +1,325 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+import java.beans.PropertyChangeListener;
+import java.io.IOException;
+
+
+/**
+ * A <b>Manager</b> manages the pool of Sessions that are associated with a
+ * particular Container. Different Manager implementations may support
+ * value-added features such as the persistent storage of session data,
+ * as well as migrating sessions for distributable web applications.
+ * <p>
+ * In order for a <code>Manager</code> implementation to successfully operate
+ * with a <code>Context</code> implementation that implements reloading, it
+ * must obey the following constraints:
+ * <ul>
+ * <li>Must implement <code>Lifecycle</code> so that the Context can indicate
+ * that a restart is required.
+ * <li>Must allow a call to <code>stop()</code> to be followed by a call to
+ * <code>start()</code> on the same <code>Manager</code> instance.
+ * </ul>
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public interface Manager {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return the Container with which this Manager is associated.
+ */
+ public Container getContainer();
+
+
+ /**
+ * Set the Container with which this Manager is associated.
+ *
+ * @param container The newly associated Container
+ */
+ public void setContainer(Container container);
+
+
+ /**
+ * Return the distributable flag for the sessions supported by
+ * this Manager.
+ */
+ public boolean getDistributable();
+
+
+ /**
+ * Set the distributable flag for the sessions supported by this
+ * Manager. If this flag is set, all user data objects added to
+ * sessions associated with this manager must implement Serializable.
+ *
+ * @param distributable The new distributable flag
+ */
+ public void setDistributable(boolean distributable);
+
+
+ /**
+ * Return descriptive information about this Manager implementation and
+ * the corresponding version number, in the format
+ * <code><description>/<version></code>.
+ */
+ public String getInfo();
+
+
+ /**
+ * Return the default maximum inactive interval (in seconds)
+ * for Sessions created by this Manager.
+ */
+ public int getMaxInactiveInterval();
+
+
+ /**
+ * Set the default maximum inactive interval (in seconds)
+ * for Sessions created by this Manager.
+ *
+ * @param interval The new default value
+ */
+ public void setMaxInactiveInterval(int interval);
+
+
+ /**
+ * Gets the session id length (in bytes) of Sessions created by
+ * this Manager.
+ *
+ * @return The session id length
+ */
+ public int getSessionIdLength();
+
+
+ /**
+ * Sets the session id length (in bytes) for Sessions created by this
+ * Manager.
+ *
+ * @param idLength The session id length
+ */
+ public void setSessionIdLength(int idLength);
+
+
+ /**
+ * Returns the total number of sessions created by this manager.
+ *
+ * @return Total number of sessions created by this manager.
+ */
+ public int getSessionCounter();
+
+
+ /**
+ * Sets the total number of sessions created by this manager.
+ *
+ * @param sessionCounter Total number of sessions created by this manager.
+ */
+ public void setSessionCounter(int sessionCounter);
+
+
+ /**
+ * Gets the maximum number of sessions that have been active at the same
+ * time.
+ *
+ * @return Maximum number of sessions that have been active at the same
+ * time
+ */
+ public int getMaxActive();
+
+
+ /**
+ * (Re)sets the maximum number of sessions that have been active at the
+ * same time.
+ *
+ * @param maxActive Maximum number of sessions that have been active at
+ * the same time.
+ */
+ public void setMaxActive(int maxActive);
+
+
+ /**
+ * Gets the number of currently active sessions.
+ *
+ * @return Number of currently active sessions
+ */
+ public int getActiveSessions();
+
+
+ /**
+ * Gets the number of sessions that have expired.
+ *
+ * @return Number of sessions that have expired
+ */
+ public int getExpiredSessions();
+
+
+ /**
+ * Sets the number of sessions that have expired.
+ *
+ * @param expiredSessions Number of sessions that have expired
+ */
+ public void setExpiredSessions(int expiredSessions);
+
+
+ /**
+ * Gets the number of sessions that were not created because the maximum
+ * number of active sessions was reached.
+ *
+ * @return Number of rejected sessions
+ */
+ public int getRejectedSessions();
+
+
+ /**
+ * Sets the number of sessions that were not created because the maximum
+ * number of active sessions was reached.
+ *
+ * @param rejectedSessions Number of rejected sessions
+ */
+ public void setRejectedSessions(int rejectedSessions);
+
+
+ /**
+ * Gets the longest time (in seconds) that an expired session had been
+ * alive.
+ *
+ * @return Longest time (in seconds) that an expired session had been
+ * alive.
+ */
+ public int getSessionMaxAliveTime();
+
+
+ /**
+ * Sets the longest time (in seconds) that an expired session had been
+ * alive.
+ *
+ * @param sessionMaxAliveTime Longest time (in seconds) that an expired
+ * session had been alive.
+ */
+ public void setSessionMaxAliveTime(int sessionMaxAliveTime);
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Add this Session to the set of active Sessions for this Manager.
+ *
+ * @param session Session to be added
+ */
+ public void add(Session session);
+
+
+ /**
+ * Add a property change listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener);
+
+ /**
+ * Get a session from the recycled ones or create a new empty one.
+ * The PersistentManager manager does not need to create session data
+ * because it reads it from the Store.
+ */
+ public Session createEmptySession();
+
+ /**
+ * Construct and return a new session object, based on the default
+ * settings specified by this Manager's properties. The session
+ * id will be assigned by this method, and available via the getId()
+ * method of the returned session. If a new session cannot be created
+ * for any reason, return <code>null</code>.
+ *
+ * @exception IllegalStateException if a new session cannot be
+ * instantiated for any reason
+ */
+ public Session createSession();
+
+
+ /**
+ * Return the active Session, associated with this Manager, with the
+ * specified session id (if any); otherwise return <code>null</code>.
+ *
+ * @param id The session id for the session to be returned
+ *
+ * @exception IllegalStateException if a new session cannot be
+ * instantiated for any reason
+ * @exception IOException if an input/output error occurs while
+ * processing this request
+ */
+ public Session findSession(String id) throws IOException;
+
+
+ /**
+ * Return the set of active Sessions associated with this Manager.
+ * If this Manager has no active Sessions, a zero-length array is returned.
+ */
+ public Session[] findSessions();
+
+
+ /**
+ * Load any currently active sessions that were previously unloaded
+ * to the appropriate persistence mechanism, if any. If persistence is not
+ * supported, this method returns without doing anything.
+ *
+ * @exception ClassNotFoundException if a serialized class cannot be
+ * found during the reload
+ * @exception IOException if an input/output error occurs
+ */
+ public void load() throws ClassNotFoundException, IOException;
+
+
+ /**
+ * Remove this Session from the active Sessions for this Manager.
+ *
+ * @param session Session to be removed
+ */
+ public void remove(Session session);
+
+
+ /**
+ * Remove a property change listener from this component.
+ *
+ * @param listener The listener to remove
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener);
+
+
+ /**
+ * Save any currently active sessions in the appropriate persistence
+ * mechanism, if any. If persistence is not supported, this method
+ * returns without doing anything.
+ *
+ * @exception IOException if an input/output error occurs
+ */
+ public void unload() throws IOException;
+
+ /**
+ * This method will be invoked by the context/container on a periodic
+ * basis and allows the manager to implement
+ * a method that executes periodic tasks, such as expiring sessions etc.
+ */
+ public void backgroundProcess();
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Pipeline.java b/container/catalina/src/share/org/apache/catalina/Pipeline.java
new file mode 100644
index 0000000..8634aeb
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Pipeline.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright 1999-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+/**
+ * <p>Interface describing a collection of Valves that should be executed
+ * in sequence when the <code>invoke()</code> method is invoked. It is
+ * required that a Valve somewhere in the pipeline (usually the last one)
+ * must process the request and create the corresponding response, rather
+ * than trying to pass the request on.</p>
+ *
+ * <p>There is generally a single Pipeline instance associated with each
+ * Container. The container's normal request processing functionality is
+ * generally encapsulated in a container-specific Valve, which should always
+ * be executed at the end of a pipeline. To facilitate this, the
+ * <code>setBasic()</code> method is provided to set the Valve instance that
+ * will always be executed last. Other Valves will be executed in the order
+ * that they were added, before the basic Valve is executed.</p>
+ *
+ * @author Craig R. McClanahan
+ * @author Peter Donald
+ * @version $Revision$ $Date$
+ */
+
+public interface Pipeline {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * <p>Return the Valve instance that has been distinguished as the basic
+ * Valve for this Pipeline (if any).
+ */
+ public Valve getBasic();
+
+
+ /**
+ * <p>Set the Valve instance that has been distinguished as the basic
+ * Valve for this Pipeline (if any). Prioer to setting the basic Valve,
+ * the Valve's <code>setContainer()</code> will be called, if it
+ * implements <code>Contained</code>, with the owning Container as an
+ * argument. The method may throw an <code>IllegalArgumentException</code>
+ * if this Valve chooses not to be associated with this Container, or
+ * <code>IllegalStateException</code> if it is already associated with
+ * a different Container.</p>
+ *
+ * @param valve Valve to be distinguished as the basic Valve
+ */
+ public void setBasic(Valve valve);
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * <p>Add a new Valve to the end of the pipeline associated with this
+ * Container. Prior to adding the Valve, the Valve's
+ * <code>setContainer()</code> method will be called, if it implements
+ * <code>Contained</code>, with the owning Container as an argument.
+ * The method may throw an
+ * <code>IllegalArgumentException</code> if this Valve chooses not to
+ * be associated with this Container, or <code>IllegalStateException</code>
+ * if it is already associated with a different Container.</p>
+ *
+ * @param valve Valve to be added
+ *
+ * @exception IllegalArgumentException if this Container refused to
+ * accept the specified Valve
+ * @exception IllegalArgumentException if the specifie Valve refuses to be
+ * associated with this Container
+ * @exception IllegalStateException if the specified Valve is already
+ * associated with a different Container
+ */
+ public void addValve(Valve valve);
+
+
+ /**
+ * Return the set of Valves in the pipeline associated with this
+ * Container, including the basic Valve (if any). If there are no
+ * such Valves, a zero-length array is returned.
+ */
+ public Valve[] getValves();
+
+
+ /**
+ * Remove the specified Valve from the pipeline associated with this
+ * Container, if it is found; otherwise, do nothing. If the Valve is
+ * found and removed, the Valve's <code>setContainer(null)</code> method
+ * will be called if it implements <code>Contained</code>.
+ *
+ * @param valve Valve to be removed
+ */
+ public void removeValve(Valve valve);
+
+
+ /**
+ * <p>Return the Valve instance that has been distinguished as the basic
+ * Valve for this Pipeline (if any).
+ */
+ public Valve getFirst();
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Realm.java b/container/catalina/src/share/org/apache/catalina/Realm.java
new file mode 100644
index 0000000..2dcc405
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Realm.java
@@ -0,0 +1,190 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+import java.beans.PropertyChangeListener;
+import java.io.IOException;
+import java.security.Principal;
+import java.security.cert.X509Certificate;
+
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+import org.apache.catalina.deploy.SecurityConstraint;
+/**
+ * A <b>Realm</b> is a read-only facade for an underlying security realm
+ * used to authenticate individual users, and identify the security roles
+ * associated with those users. Realms can be attached at any Container
+ * level, but will typically only be attached to a Context, or higher level,
+ * Container.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public interface Realm {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return the Container with which this Realm has been associated.
+ */
+ public Container getContainer();
+
+
+ /**
+ * Set the Container with which this Realm has been associated.
+ *
+ * @param container The associated Container
+ */
+ public void setContainer(Container container);
+
+
+ /**
+ * Return descriptive information about this Realm implementation and
+ * the corresponding version number, in the format
+ * <code><description>/<version></code>.
+ */
+ public String getInfo();
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Add a property change listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener);
+
+
+ /**
+ * Return the Principal associated with the specified username and
+ * credentials, if there is one; otherwise return <code>null</code>.
+ *
+ * @param username Username of the Principal to look up
+ * @param credentials Password or other credentials to use in
+ * authenticating this username
+ */
+ public Principal authenticate(String username, String credentials);
+
+
+ /**
+ * Return the Principal associated with the specified username and
+ * credentials, if there is one; otherwise return <code>null</code>.
+ *
+ * @param username Username of the Principal to look up
+ * @param credentials Password or other credentials to use in
+ * authenticating this username
+ */
+ public Principal authenticate(String username, byte[] credentials);
+
+
+ /**
+ * Return the Principal associated with the specified username, which
+ * matches the digest calculated using the given parameters using the
+ * method described in RFC 2069; otherwise return <code>null</code>.
+ *
+ * @param username Username of the Principal to look up
+ * @param digest Digest which has been submitted by the client
+ * @param nonce Unique (or supposedly unique) token which has been used
+ * for this request
+ * @param realm Realm name
+ * @param md5a2 Second MD5 digest used to calculate the digest :
+ * MD5(Method + ":" + uri)
+ */
+ public Principal authenticate(String username, String digest,
+ String nonce, String nc, String cnonce,
+ String qop, String realm,
+ String md5a2);
+
+
+ /**
+ * Return the Principal associated with the specified chain of X509
+ * client certificates. If there is none, return <code>null</code>.
+ *
+ * @param certs Array of client certificates, with the first one in
+ * the array being the certificate of the client itself.
+ */
+ public Principal authenticate(X509Certificate certs[]);
+
+ /**
+ * Return the SecurityConstraints configured to guard the request URI for
+ * this request, or <code>null</code> if there is no such constraint.
+ *
+ * @param request Request we are processing
+ */
+ public SecurityConstraint [] findSecurityConstraints(Request request,
+ Context context);
+ /**
+ * Perform access control based on the specified authorization constraint.
+ * Return <code>true</code> if this constraint is satisfied and processing
+ * should continue, or <code>false</code> otherwise.
+ *
+ * @param request Request we are processing
+ * @param response Response we are creating
+ * @param constraint Security constraint we are enforcing
+ * @param context The Context to which client of this class is attached.
+ *
+ * @exception IOException if an input/output error occurs
+ */
+ public boolean hasResourcePermission(Request request,
+ Response response,
+ SecurityConstraint [] constraint,
+ Context context)
+ throws IOException;
+
+
+ /**
+ * Return <code>true</code> if the specified Principal has the specified
+ * security role, within the context of this Realm; otherwise return
+ * <code>false</code>.
+ *
+ * @param principal Principal for whom the role is to be checked
+ * @param role Security role to be checked
+ */
+ public boolean hasRole(Principal principal, String role);
+
+ /**
+ * Enforce any user data constraint required by the security constraint
+ * guarding this request URI. Return <code>true</code> if this constraint
+ * was not violated and processing should continue, or <code>false</code>
+ * if we have created a response already.
+ *
+ * @param request Request we are processing
+ * @param response Response we are creating
+ * @param constraint Security constraint being checked
+ *
+ * @exception IOException if an input/output error occurs
+ */
+ public boolean hasUserDataPermission(Request request,
+ Response response,
+ SecurityConstraint []constraint)
+ throws IOException;
+
+ /**
+ * Remove a property change listener from this component.
+ *
+ * @param listener The listener to remove
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener);
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Role.java b/container/catalina/src/share/org/apache/catalina/Role.java
new file mode 100644
index 0000000..3a197a8
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Role.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+import java.security.Principal;
+
+
+/**
+ * <p>Abstract representation of a security role, suitable for use in
+ * environments like JAAS that want to deal with <code>Principals</code>.</p>
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ * @since 4.1
+ */
+
+public interface Role extends Principal {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return the description of this role.
+ */
+ public String getDescription();
+
+
+ /**
+ * Set the description of this role.
+ *
+ * @param description The new description
+ */
+ public void setDescription(String description);
+
+
+ /**
+ * Return the role name of this role, which must be unique
+ * within the scope of a {@link UserDatabase}.
+ */
+ public String getRolename();
+
+
+ /**
+ * Set the role name of this role, which must be unique
+ * within the scope of a {@link UserDatabase}.
+ *
+ * @param rolename The new role name
+ */
+ public void setRolename(String rolename);
+
+
+ /**
+ * Return the {@link UserDatabase} within which this Role is defined.
+ */
+ public UserDatabase getUserDatabase();
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Server.java b/container/catalina/src/share/org/apache/catalina/Server.java
new file mode 100644
index 0000000..ae8f7bf
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Server.java
@@ -0,0 +1,152 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+import org.apache.catalina.deploy.NamingResources;
+
+/**
+ * A <code>Server</code> element represents the entire Catalina
+ * servlet container. Its attributes represent the characteristics of
+ * the servlet container as a whole. A <code>Server</code> may contain
+ * one or more <code>Services</code>, and the top level set of naming
+ * resources.
+ * <p>
+ * Normally, an implementation of this interface will also implement
+ * <code>Lifecycle</code>, such that when the <code>start()</code> and
+ * <code>stop()</code> methods are called, all of the defined
+ * <code>Services</code> are also started or stopped.
+ * <p>
+ * In between, the implementation must open a server socket on the port number
+ * specified by the <code>port</code> property. When a connection is accepted,
+ * the first line is read and compared with the specified shutdown command.
+ * If the command matches, shutdown of the server is initiated.
+ * <p>
+ * <strong>NOTE</strong> - The concrete implementation of this class should
+ * register the (singleton) instance with the <code>ServerFactory</code>
+ * class in its constructor(s).
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public interface Server {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return descriptive information about this Server implementation and
+ * the corresponding version number, in the format
+ * <code><description>/<version></code>.
+ */
+ public String getInfo();
+
+
+ /**
+ * Return the global naming resources.
+ */
+ public NamingResources getGlobalNamingResources();
+
+
+ /**
+ * Set the global naming resources.
+ *
+ * @param globalNamingResources The new global naming resources
+ */
+ public void setGlobalNamingResources
+ (NamingResources globalNamingResources);
+
+
+ /**
+ * Return the port number we listen to for shutdown commands.
+ */
+ public int getPort();
+
+
+ /**
+ * Set the port number we listen to for shutdown commands.
+ *
+ * @param port The new port number
+ */
+ public void setPort(int port);
+
+
+ /**
+ * Return the shutdown command string we are waiting for.
+ */
+ public String getShutdown();
+
+
+ /**
+ * Set the shutdown command we are waiting for.
+ *
+ * @param shutdown The new shutdown command
+ */
+ public void setShutdown(String shutdown);
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Add a new Service to the set of defined Services.
+ *
+ * @param service The Service to be added
+ */
+ public void addService(Service service);
+
+
+ /**
+ * Wait until a proper shutdown command is received, then return.
+ */
+ public void await();
+
+
+ /**
+ * Return the specified Service (if it exists); otherwise return
+ * <code>null</code>.
+ *
+ * @param name Name of the Service to be returned
+ */
+ public Service findService(String name);
+
+
+ /**
+ * Return the set of Services defined within this Server.
+ */
+ public Service[] findServices();
+
+
+ /**
+ * Remove the specified Service from the set associated from this
+ * Server.
+ *
+ * @param service The Service to be removed
+ */
+ public void removeService(Service service);
+
+ /**
+ * Invoke a pre-startup initialization. This is used to allow connectors
+ * to bind to restricted ports under Unix operating environments.
+ *
+ * @exception LifecycleException If this server was already initialized.
+ */
+ public void initialize()
+ throws LifecycleException;
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ServerFactory.java b/container/catalina/src/share/org/apache/catalina/ServerFactory.java
new file mode 100644
index 0000000..35745ae
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ServerFactory.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+import org.apache.catalina.core.StandardServer;
+
+
+/**
+ * <p><strong>ServerFactory</strong> allows the registration of the
+ * (singleton) <code>Server</code> instance for this JVM, so that it
+ * can be accessed independently of any existing reference to the
+ * component hierarchy. This is important for administration tools
+ * that are built around the internal component implementation classes.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public class ServerFactory {
+
+
+ // ------------------------------------------------------- Static Variables
+
+
+ /**
+ * The singleton <code>Server</code> instance for this JVM.
+ */
+ private static Server server = null;
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Return the singleton <code>Server</code> instance for this JVM.
+ */
+ public static Server getServer() {
+ if( server==null )
+ server=new StandardServer();
+ return (server);
+
+ }
+
+
+ /**
+ * Set the singleton <code>Server</code> instance for this JVM. This
+ * method must <strong>only</strong> be called from a constructor of
+ * the (singleton) <code>Server</code> instance that is created for
+ * this execution of Catalina.
+ *
+ * @param theServer The new singleton instance
+ */
+ public static void setServer(Server theServer) {
+
+ if (server == null)
+ server = theServer;
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Service.java b/container/catalina/src/share/org/apache/catalina/Service.java
new file mode 100644
index 0000000..99e9a8f
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Service.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+import org.apache.catalina.connector.Connector;
+
+
+/**
+ * A <strong>Service</strong> is a group of one or more
+ * <strong>Connectors</strong> that share a single <strong>Container</strong>
+ * to process their incoming requests. This arrangement allows, for example,
+ * a non-SSL and SSL connector to share the same population of web apps.
+ * <p>
+ * A given JVM can contain any number of Service instances; however, they are
+ * completely independent of each other and share only the basic JVM facilities
+ * and classes on the system class path.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public interface Service {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return the <code>Container</code> that handles requests for all
+ * <code>Connectors</code> associated with this Service.
+ */
+ public Container getContainer();
+
+
+ /**
+ * Set the <code>Container</code> that handles requests for all
+ * <code>Connectors</code> associated with this Service.
+ *
+ * @param container The new Container
+ */
+ public void setContainer(Container container);
+
+
+ /**
+ * Return descriptive information about this Service implementation and
+ * the corresponding version number, in the format
+ * <code><description>/<version></code>.
+ */
+ public String getInfo();
+
+
+ /**
+ * Return the name of this Service.
+ */
+ public String getName();
+
+
+ /**
+ * Set the name of this Service.
+ *
+ * @param name The new service name
+ */
+ public void setName(String name);
+
+
+ /**
+ * Return the <code>Server</code> with which we are associated (if any).
+ */
+ public Server getServer();
+
+
+ /**
+ * Set the <code>Server</code> with which we are associated (if any).
+ *
+ * @param server The server that owns this Service
+ */
+ public void setServer(Server server);
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Add a new Connector to the set of defined Connectors, and associate it
+ * with this Service's Container.
+ *
+ * @param connector The Connector to be added
+ */
+ public void addConnector(Connector connector);
+
+
+ /**
+ * Find and return the set of Connectors associated with this Service.
+ */
+ public Connector[] findConnectors();
+
+
+ /**
+ * Remove the specified Connector from the set associated from this
+ * Service. The removed Connector will also be disassociated from our
+ * Container.
+ *
+ * @param connector The Connector to be removed
+ */
+ public void removeConnector(Connector connector);
+
+ /**
+ * Invoke a pre-startup initialization. This is used to allow connectors
+ * to bind to restricted ports under Unix operating environments.
+ *
+ * @exception LifecycleException If this server was already initialized.
+ */
+ public void initialize()
+ throws LifecycleException;
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Session.java b/container/catalina/src/share/org/apache/catalina/Session.java
new file mode 100644
index 0000000..12d496f
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Session.java
@@ -0,0 +1,279 @@
+/*
+ * Copyright 1999-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+import java.security.Principal;
+import java.util.Iterator;
+
+import javax.servlet.http.HttpSession;
+
+
+/**
+ * A <b>Session</b> is the Catalina-internal facade for an
+ * <code>HttpSession</code> that is used to maintain state information
+ * between requests for a particular user of a web application.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public interface Session {
+
+
+ // ----------------------------------------------------- Manifest Constants
+
+
+ /**
+ * The SessionEvent event type when a session is created.
+ */
+ public static final String SESSION_CREATED_EVENT = "createSession";
+
+
+ /**
+ * The SessionEvent event type when a session is destroyed.
+ */
+ public static final String SESSION_DESTROYED_EVENT = "destroySession";
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return the authentication type used to authenticate our cached
+ * Principal, if any.
+ */
+ public String getAuthType();
+
+
+ /**
+ * Set the authentication type used to authenticate our cached
+ * Principal, if any.
+ *
+ * @param authType The new cached authentication type
+ */
+ public void setAuthType(String authType);
+
+
+ /**
+ * Return the creation time for this session.
+ */
+ public long getCreationTime();
+
+
+ /**
+ * Set the creation time for this session. This method is called by the
+ * Manager when an existing Session instance is reused.
+ *
+ * @param time The new creation time
+ */
+ public void setCreationTime(long time);
+
+
+ /**
+ * Return the session identifier for this session.
+ */
+ public String getId();
+
+
+ /**
+ * Set the session identifier for this session.
+ *
+ * @param id The new session identifier
+ */
+ public void setId(String id);
+
+
+ /**
+ * Return descriptive information about this Session implementation and
+ * the corresponding version number, in the format
+ * <code><description>/<version></code>.
+ */
+ public String getInfo();
+
+
+ /**
+ * Return the last time the client sent a request associated with this
+ * session, as the number of milliseconds since midnight, January 1, 1970
+ * GMT. Actions that your application takes, such as getting or setting
+ * a value associated with the session, do not affect the access time.
+ */
+ public long getLastAccessedTime();
+
+
+ /**
+ * Return the Manager within which this Session is valid.
+ */
+ public Manager getManager();
+
+
+ /**
+ * Set the Manager within which this Session is valid.
+ *
+ * @param manager The new Manager
+ */
+ public void setManager(Manager manager);
+
+
+ /**
+ * Return the maximum time interval, in seconds, between client requests
+ * before the servlet container will invalidate the session. A negative
+ * time indicates that the session should never time out.
+ */
+ public int getMaxInactiveInterval();
+
+
+ /**
+ * Set the maximum time interval, in seconds, between client requests
+ * before the servlet container will invalidate the session. A negative
+ * time indicates that the session should never time out.
+ *
+ * @param interval The new maximum interval
+ */
+ public void setMaxInactiveInterval(int interval);
+
+
+ /**
+ * Set the <code>isNew</code> flag for this session.
+ *
+ * @param isNew The new value for the <code>isNew</code> flag
+ */
+ public void setNew(boolean isNew);
+
+
+ /**
+ * Return the authenticated Principal that is associated with this Session.
+ * This provides an <code>Authenticator</code> with a means to cache a
+ * previously authenticated Principal, and avoid potentially expensive
+ * <code>Realm.authenticate()</code> calls on every request. If there
+ * is no current associated Principal, return <code>null</code>.
+ */
+ public Principal getPrincipal();
+
+
+ /**
+ * Set the authenticated Principal that is associated with this Session.
+ * This provides an <code>Authenticator</code> with a means to cache a
+ * previously authenticated Principal, and avoid potentially expensive
+ * <code>Realm.authenticate()</code> calls on every request.
+ *
+ * @param principal The new Principal, or <code>null</code> if none
+ */
+ public void setPrincipal(Principal principal);
+
+
+ /**
+ * Return the <code>HttpSession</code> for which this object
+ * is the facade.
+ */
+ public HttpSession getSession();
+
+
+ /**
+ * Set the <code>isValid</code> flag for this session.
+ *
+ * @param isValid The new value for the <code>isValid</code> flag
+ */
+ public void setValid(boolean isValid);
+
+
+ /**
+ * Return the <code>isValid</code> flag for this session.
+ */
+ public boolean isValid();
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Update the accessed time information for this session. This method
+ * should be called by the context when a request comes in for a particular
+ * session, even if the application does not reference it.
+ */
+ public void access();
+
+
+ /**
+ * Add a session event listener to this component.
+ */
+ public void addSessionListener(SessionListener listener);
+
+
+ /**
+ * End access to the session.
+ */
+ public void endAccess();
+
+
+ /**
+ * Perform the internal processing required to invalidate this session,
+ * without triggering an exception if the session has already expired.
+ */
+ public void expire();
+
+
+ /**
+ * Return the object bound with the specified name to the internal notes
+ * for this session, or <code>null</code> if no such binding exists.
+ *
+ * @param name Name of the note to be returned
+ */
+ public Object getNote(String name);
+
+
+ /**
+ * Return an Iterator containing the String names of all notes bindings
+ * that exist for this session.
+ */
+ public Iterator getNoteNames();
+
+
+ /**
+ * Release all object references, and initialize instance variables, in
+ * preparation for reuse of this object.
+ */
+ public void recycle();
+
+
+ /**
+ * Remove any object bound to the specified name in the internal notes
+ * for this session.
+ *
+ * @param name Name of the note to be removed
+ */
+ public void removeNote(String name);
+
+
+ /**
+ * Remove a session event listener from this component.
+ */
+ public void removeSessionListener(SessionListener listener);
+
+
+ /**
+ * Bind an object to a specified name in the internal notes associated
+ * with this session, replacing any existing binding for this name.
+ *
+ * @param name Name to which the object should be bound
+ * @param value Object to be bound to the specified name
+ */
+ public void setNote(String name, Object value);
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/SessionEvent.java b/container/catalina/src/share/org/apache/catalina/SessionEvent.java
new file mode 100644
index 0000000..a113801
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/SessionEvent.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 1999-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+import java.util.EventObject;
+
+
+/**
+ * General event for notifying listeners of significant changes on a Session.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public final class SessionEvent
+ extends EventObject {
+
+
+ /**
+ * The event data associated with this event.
+ */
+ private Object data = null;
+
+
+ /**
+ * The Session on which this event occurred.
+ */
+ private Session session = null;
+
+
+ /**
+ * The event type this instance represents.
+ */
+ private String type = null;
+
+
+ /**
+ * Construct a new SessionEvent with the specified parameters.
+ *
+ * @param session Session on which this event occurred
+ * @param type Event type
+ * @param data Event data
+ */
+ public SessionEvent(Session session, String type, Object data) {
+
+ super(session);
+ this.session = session;
+ this.type = type;
+ this.data = data;
+
+ }
+
+
+ /**
+ * Return the event data of this event.
+ */
+ public Object getData() {
+
+ return (this.data);
+
+ }
+
+
+ /**
+ * Return the Session on which this event occurred.
+ */
+ public Session getSession() {
+
+ return (this.session);
+
+ }
+
+
+ /**
+ * Return the event type of this event.
+ */
+ public String getType() {
+
+ return (this.type);
+
+ }
+
+
+ /**
+ * Return a string representation of this event.
+ */
+ public String toString() {
+
+ return ("SessionEvent['" + getSession() + "','" +
+ getType() + "']");
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/SessionListener.java b/container/catalina/src/share/org/apache/catalina/SessionListener.java
new file mode 100644
index 0000000..1313cb3
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/SessionListener.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 1999-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+
+
+/**
+ * Interface defining a listener for significant Session generated events.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public interface SessionListener {
+
+
+ /**
+ * Acknowledge the occurrence of the specified event.
+ *
+ * @param event SessionEvent that has occurred
+ */
+ public void sessionEvent(SessionEvent event);
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Store.java b/container/catalina/src/share/org/apache/catalina/Store.java
new file mode 100644
index 0000000..69a0217
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Store.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+import java.beans.PropertyChangeListener;
+import java.io.IOException;
+
+
+/**
+ * A <b>Store</b> is the abstraction of a Catalina component that provides
+ * persistent storage and loading of Sessions and their associated user data.
+ * Implementations are free to save and load the Sessions to any media they
+ * wish, but it is assumed that saved Sessions are persistent across
+ * server or context restarts.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public interface Store {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return descriptive information about this Store implementation and
+ * the corresponding version number, in the format
+ * <code><description>/<version></code>.
+ */
+ public String getInfo();
+
+
+ /**
+ * Return the Manager instance associated with this Store.
+ */
+ public Manager getManager();
+
+
+ /**
+ * Set the Manager associated with this Store.
+ *
+ * @param manager The Manager which will use this Store.
+ */
+ public void setManager(Manager manager);
+
+
+ /**
+ * Return the number of Sessions present in this Store.
+ *
+ * @exception IOException if an input/output error occurs
+ */
+ public int getSize() throws IOException;
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Add a property change listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener);
+
+
+ /**
+ * Return an array containing the session identifiers of all Sessions
+ * currently saved in this Store. If there are no such Sessions, a
+ * zero-length array is returned.
+ *
+ * @exception IOException if an input/output error occurred
+ */
+ public String[] keys() throws IOException;
+
+
+ /**
+ * Load and return the Session associated with the specified session
+ * identifier from this Store, without removing it. If there is no
+ * such stored Session, return <code>null</code>.
+ *
+ * @param id Session identifier of the session to load
+ *
+ * @exception ClassNotFoundException if a deserialization error occurs
+ * @exception IOException if an input/output error occurs
+ */
+ public Session load(String id)
+ throws ClassNotFoundException, IOException;
+
+
+ /**
+ * Remove the Session with the specified session identifier from
+ * this Store, if present. If no such Session is present, this method
+ * takes no action.
+ *
+ * @param id Session identifier of the Session to be removed
+ *
+ * @exception IOException if an input/output error occurs
+ */
+ public void remove(String id) throws IOException;
+
+
+ /**
+ * Remove all Sessions from this Store.
+ */
+ public void clear() throws IOException;
+
+
+ /**
+ * Remove a property change listener from this component.
+ *
+ * @param listener The listener to remove
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener);
+
+
+ /**
+ * Save the specified Session into this Store. Any previously saved
+ * information for the associated session identifier is replaced.
+ *
+ * @param session Session to be saved
+ *
+ * @exception IOException if an input/output error occurs
+ */
+ public void save(Session session) throws IOException;
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/User.java b/container/catalina/src/share/org/apache/catalina/User.java
new file mode 100644
index 0000000..2a42a79
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/User.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+import java.security.Principal;
+import java.util.Iterator;
+
+
+/**
+ * <p>Abstract representation of a user in a {@link UserDatabase}. Each user
+ * is optionally associated with a set of {@link Group}s through which he or
+ * she inherits additional security roles, and is optionally assigned a set
+ * of specific {@link Role}s.</p>
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ * @since 4.1
+ */
+
+public interface User extends Principal {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return the full name of this user.
+ */
+ public String getFullName();
+
+
+ /**
+ * Set the full name of this user.
+ *
+ * @param fullName The new full name
+ */
+ public void setFullName(String fullName);
+
+
+ /**
+ * Return the set of {@link Group}s to which this user belongs.
+ */
+ public Iterator getGroups();
+
+
+ /**
+ * Return the logon password of this user, optionally prefixed with the
+ * identifier of an encoding scheme surrounded by curly braces, such as
+ * <code>{md5}xxxxx</code>.
+ */
+ public String getPassword();
+
+
+ /**
+ * Set the logon password of this user, optionally prefixed with the
+ * identifier of an encoding scheme surrounded by curly braces, such as
+ * <code>{md5}xxxxx</code>.
+ *
+ * @param password The new logon password
+ */
+ public void setPassword(String password);
+
+
+ /**
+ * Return the set of {@link Role}s assigned specifically to this user.
+ */
+ public Iterator getRoles();
+
+
+ /**
+ * Return the {@link UserDatabase} within which this User is defined.
+ */
+ public UserDatabase getUserDatabase();
+
+
+ /**
+ * Return the logon username of this user, which must be unique
+ * within the scope of a {@link UserDatabase}.
+ */
+ public String getUsername();
+
+
+ /**
+ * Set the logon username of this user, which must be unique within
+ * the scope of a {@link UserDatabase}.
+ *
+ * @param username The new logon username
+ */
+ public void setUsername(String username);
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Add a new {@link Group} to those this user belongs to.
+ *
+ * @param group The new group
+ */
+ public void addGroup(Group group);
+
+
+ /**
+ * Add a {@link Role} to those assigned specifically to this user.
+ *
+ * @param role The new role
+ */
+ public void addRole(Role role);
+
+
+ /**
+ * Is this user in the specified {@link Group}?
+ *
+ * @param group The group to check
+ */
+ public boolean isInGroup(Group group);
+
+
+ /**
+ * Is this user specifically assigned the specified {@link Role}? This
+ * method does <strong>NOT</strong> check for roles inherited based on
+ * {@link Group} membership.
+ *
+ * @param role The role to check
+ */
+ public boolean isInRole(Role role);
+
+
+ /**
+ * Remove a {@link Group} from those this user belongs to.
+ *
+ * @param group The old group
+ */
+ public void removeGroup(Group group);
+
+
+ /**
+ * Remove all {@link Group}s from those this user belongs to.
+ */
+ public void removeGroups();
+
+
+ /**
+ * Remove a {@link Role} from those assigned to this user.
+ *
+ * @param role The old role
+ */
+ public void removeRole(Role role);
+
+
+ /**
+ * Remove all {@link Role}s from those assigned to this user.
+ */
+ public void removeRoles();
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/UserDatabase.java b/container/catalina/src/share/org/apache/catalina/UserDatabase.java
new file mode 100644
index 0000000..88af63b
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/UserDatabase.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+import java.util.Iterator;
+
+
+/**
+ * <p>Abstract representation of a database of {@link User}s and
+ * {@link Group}s that can be maintained by an application,
+ * along with definitions of corresponding {@link Role}s, and
+ * referenced by a {@link Realm} for authentication and access control.</p>
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ * @since 4.1
+ */
+
+public interface UserDatabase {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return the set of {@link Group}s defined in this user database.
+ */
+ public Iterator getGroups();
+
+
+ /**
+ * Return the unique global identifier of this user database.
+ */
+ public String getId();
+
+
+ /**
+ * Return the set of {@link Role}s defined in this user database.
+ */
+ public Iterator getRoles();
+
+
+ /**
+ * Return the set of {@link User}s defined in this user database.
+ */
+ public Iterator getUsers();
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Finalize access to this user database.
+ *
+ * @exception Exception if any exception is thrown during closing
+ */
+ public void close() throws Exception;
+
+
+ /**
+ * Create and return a new {@link Group} defined in this user database.
+ *
+ * @param groupname The group name of the new group (must be unique)
+ * @param description The description of this group
+ */
+ public Group createGroup(String groupname, String description);
+
+
+ /**
+ * Create and return a new {@link Role} defined in this user database.
+ *
+ * @param rolename The role name of the new role (must be unique)
+ * @param description The description of this role
+ */
+ public Role createRole(String rolename, String description);
+
+
+ /**
+ * Create and return a new {@link User} defined in this user database.
+ *
+ * @param username The logon username of the new user (must be unique)
+ * @param password The logon password of the new user
+ * @param fullName The full name of the new user
+ */
+ public User createUser(String username, String password,
+ String fullName);
+
+
+ /**
+ * Return the {@link Group} with the specified group name, if any;
+ * otherwise return <code>null</code>.
+ *
+ * @param groupname Name of the group to return
+ */
+ public Group findGroup(String groupname);
+
+
+ /**
+ * Return the {@link Role} with the specified role name, if any;
+ * otherwise return <code>null</code>.
+ *
+ * @param rolename Name of the role to return
+ */
+ public Role findRole(String rolename);
+
+
+ /**
+ * Return the {@link User} with the specified user name, if any;
+ * otherwise return <code>null</code>.
+ *
+ * @param username Name of the user to return
+ */
+ public User findUser(String username);
+
+
+ /**
+ * Initialize access to this user database.
+ *
+ * @exception Exception if any exception is thrown during opening
+ */
+ public void open() throws Exception;
+
+
+ /**
+ * Remove the specified {@link Group} from this user database.
+ *
+ * @param group The group to be removed
+ */
+ public void removeGroup(Group group);
+
+
+ /**
+ * Remove the specified {@link Role} from this user database.
+ *
+ * @param role The role to be removed
+ */
+ public void removeRole(Role role);
+
+
+ /**
+ * Remove the specified {@link User} from this user database.
+ *
+ * @param user The user to be removed
+ */
+ public void removeUser(User user);
+
+
+ /**
+ * Save any updated information to the persistent storage location for
+ * this user database.
+ *
+ * @exception Exception if any exception is thrown during saving
+ */
+ public void save() throws Exception;
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Valve.java b/container/catalina/src/share/org/apache/catalina/Valve.java
new file mode 100644
index 0000000..9c0d5fe
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Valve.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright 1999-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+
+
+/**
+ * <p>A <b>Valve</b> is a request processing component associated with a
+ * particular Container. A series of Valves are generally associated with
+ * each other into a Pipeline. The detailed contract for a Valve is included
+ * in the description of the <code>invoke()</code> method below.</p>
+ *
+ * <b>HISTORICAL NOTE</b>: The "Valve" name was assigned to this concept
+ * because a valve is what you use in a real world pipeline to control and/or
+ * modify flows through it.
+ *
+ * @author Craig R. McClanahan
+ * @author Gunnar Rjnning
+ * @author Peter Donald
+ * @version $Revision$ $Date$
+ */
+
+public interface Valve {
+
+
+ //-------------------------------------------------------------- Properties
+
+
+ /**
+ * Return descriptive information about this Valve implementation.
+ */
+ public String getInfo();
+
+
+ /**
+ * Return the next Valve in the pipeline containing this Valve, if any.
+ */
+ public Valve getNext();
+
+
+ /**
+ * Set the next Valve in the pipeline containing this Valve.
+ *
+ * @param valve The new next valve, or <code>null</code> if none
+ */
+ public void setNext(Valve valve);
+
+
+ //---------------------------------------------------------- Public Methods
+
+
+ /**
+ * <p>Perform request processing as required by this Valve.</p>
+ *
+ * <p>An individual Valve <b>MAY</b> perform the following actions, in
+ * the specified order:</p>
+ * <ul>
+ * <li>Examine and/or modify the properties of the specified Request and
+ * Response.
+ * <li>Examine the properties of the specified Request, completely generate
+ * the corresponding Response, and return control to the caller.
+ * <li>Examine the properties of the specified Request and Response, wrap
+ * either or both of these objects to supplement their functionality,
+ * and pass them on.
+ * <li>If the corresponding Response was not generated (and control was not
+ * returned, call the next Valve in the pipeline (if there is one) by
+ * executing <code>context.invokeNext()</code>.
+ * <li>Examine, but not modify, the properties of the resulting Response
+ * (which was created by a subsequently invoked Valve or Container).
+ * </ul>
+ *
+ * <p>A Valve <b>MUST NOT</b> do any of the following things:</p>
+ * <ul>
+ * <li>Change request properties that have already been used to direct
+ * the flow of processing control for this request (for instance,
+ * trying to change the virtual host to which a Request should be
+ * sent from a pipeline attached to a Host or Context in the
+ * standard implementation).
+ * <li>Create a completed Response <strong>AND</strong> pass this
+ * Request and Response on to the next Valve in the pipeline.
+ * <li>Consume bytes from the input stream associated with the Request,
+ * unless it is completely generating the response, or wrapping the
+ * request before passing it on.
+ * <li>Modify the HTTP headers included with the Response after the
+ * <code>invokeNext()</code> method has returned.
+ * <li>Perform any actions on the output stream associated with the
+ * specified Response after the <code>invokeNext()</code> method has
+ * returned.
+ * </ul>
+ *
+ * @param request The servlet request to be processed
+ * @param response The servlet response to be created
+ *
+ * @exception IOException if an input/output error occurs, or is thrown
+ * by a subsequently invoked Valve, Filter, or Servlet
+ * @exception ServletException if a servlet error occurs, or is thrown
+ * by a subsequently invoked Valve, Filter, or Servlet
+ */
+ public void invoke(Request request, Response response)
+ throws IOException, ServletException;
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/Wrapper.java b/container/catalina/src/share/org/apache/catalina/Wrapper.java
new file mode 100644
index 0000000..a8f7707
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/Wrapper.java
@@ -0,0 +1,317 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina;
+
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.UnavailableException;
+
+
+/**
+ * A <b>Wrapper</b> is a Container that represents an individual servlet
+ * definition from the deployment descriptor of the web application. It
+ * provides a convenient mechanism to use Interceptors that see every single
+ * request to the servlet represented by this definition.
+ * <p>
+ * Implementations of Wrapper are responsible for managing the servlet life
+ * cycle for their underlying servlet class, including calling init() and
+ * destroy() at appropriate times, as well as respecting the existence of
+ * the SingleThreadModel declaration on the servlet class itself.
+ * <p>
+ * The parent Container attached to a Wrapper will generally be an
+ * implementation of Context, representing the servlet context (and
+ * therefore the web application) within which this servlet executes.
+ * <p>
+ * Child Containers are not allowed on Wrapper implementations, so the
+ * <code>addChild()</code> method should throw an
+ * <code>IllegalArgumentException</code>.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public interface Wrapper extends Container {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return the available date/time for this servlet, in milliseconds since
+ * the epoch. If this date/time is in the future, any request for this
+ * servlet will return an SC_SERVICE_UNAVAILABLE error. If it is zero,
+ * the servlet is currently available. A value equal to Long.MAX_VALUE
+ * is considered to mean that unavailability is permanent.
+ */
+ public long getAvailable();
+
+
+ /**
+ * Set the available date/time for this servlet, in milliseconds since the
+ * epoch. If this date/time is in the future, any request for this servlet
+ * will return an SC_SERVICE_UNAVAILABLE error. A value equal to
+ * Long.MAX_VALUE is considered to mean that unavailability is permanent.
+ *
+ * @param available The new available date/time
+ */
+ public void setAvailable(long available);
+
+
+ /**
+ * Return the context-relative URI of the JSP file for this servlet.
+ */
+ public String getJspFile();
+
+
+ /**
+ * Set the context-relative URI of the JSP file for this servlet.
+ *
+ * @param jspFile JSP file URI
+ */
+ public void setJspFile(String jspFile);
+
+
+ /**
+ * Return the load-on-startup order value (negative value means
+ * load on first call).
+ */
+ public int getLoadOnStartup();
+
+
+ /**
+ * Set the load-on-startup order value (negative value means
+ * load on first call).
+ *
+ * @param value New load-on-startup value
+ */
+ public void setLoadOnStartup(int value);
+
+
+ /**
+ * Return the run-as identity for this servlet.
+ */
+ public String getRunAs();
+
+
+ /**
+ * Set the run-as identity for this servlet.
+ *
+ * @param runAs New run-as identity value
+ */
+ public void setRunAs(String runAs);
+
+
+ /**
+ * Return the fully qualified servlet class name for this servlet.
+ */
+ public String getServletClass();
+
+
+ /**
+ * Set the fully qualified servlet class name for this servlet.
+ *
+ * @param servletClass Servlet class name
+ */
+ public void setServletClass(String servletClass);
+
+
+ /**
+ * Is this servlet currently unavailable?
+ */
+ public boolean isUnavailable();
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Add a new servlet initialization parameter for this servlet.
+ *
+ * @param name Name of this initialization parameter to add
+ * @param value Value of this initialization parameter to add
+ */
+ public void addInitParameter(String name, String value);
+
+
+ /**
+ * Add a new listener interested in InstanceEvents.
+ *
+ * @param listener The new listener
+ */
+ public void addInstanceListener(InstanceListener listener);
+
+
+ /**
+ * Add a mapping associated with the Wrapper.
+ *
+ * @param mapping The new wrapper mapping
+ */
+ public void addMapping(String mapping);
+
+
+ /**
+ * Add a new security role reference record to the set of records for
+ * this servlet.
+ *
+ * @param name Role name used within this servlet
+ * @param link Role name used within the web application
+ */
+ public void addSecurityReference(String name, String link);
+
+
+ /**
+ * Allocate an initialized instance of this Servlet that is ready to have
+ * its <code>service()</code> method called. If the servlet class does
+ * not implement <code>SingleThreadModel</code>, the (only) initialized
+ * instance may be returned immediately. If the servlet class implements
+ * <code>SingleThreadModel</code>, the Wrapper implementation must ensure
+ * that this instance is not allocated again until it is deallocated by a
+ * call to <code>deallocate()</code>.
+ *
+ * @exception ServletException if the servlet init() method threw
+ * an exception
+ * @exception ServletException if a loading error occurs
+ */
+ public Servlet allocate() throws ServletException;
+
+
+ /**
+ * Return this previously allocated servlet to the pool of available
+ * instances. If this servlet class does not implement SingleThreadModel,
+ * no action is actually required.
+ *
+ * @param servlet The servlet to be returned
+ *
+ * @exception ServletException if a deallocation error occurs
+ */
+ public void deallocate(Servlet servlet) throws ServletException;
+
+
+ /**
+ * Return the value for the specified initialization parameter name,
+ * if any; otherwise return <code>null</code>.
+ *
+ * @param name Name of the requested initialization parameter
+ */
+ public String findInitParameter(String name);
+
+
+ /**
+ * Return the names of all defined initialization parameters for this
+ * servlet.
+ */
+ public String[] findInitParameters();
+
+
+ /**
+ * Return the mappings associated with this wrapper.
+ */
+ public String[] findMappings();
+
+
+ /**
+ * Return the security role link for the specified security role
+ * reference name, if any; otherwise return <code>null</code>.
+ *
+ * @param name Security role reference used within this servlet
+ */
+ public String findSecurityReference(String name);
+
+
+ /**
+ * Return the set of security role reference names associated with
+ * this servlet, if any; otherwise return a zero-length array.
+ */
+ public String[] findSecurityReferences();
+
+
+ /**
+ * Increment the error count value used when monitoring.
+ */
+ public void incrementErrorCount();
+
+
+ /**
+ * Load and initialize an instance of this servlet, if there is not already
+ * at least one initialized instance. This can be used, for example, to
+ * load servlets that are marked in the deployment descriptor to be loaded
+ * at server startup time.
+ *
+ * @exception ServletException if the servlet init() method threw
+ * an exception
+ * @exception ServletException if some other loading problem occurs
+ */
+ public void load() throws ServletException;
+
+
+ /**
+ * Remove the specified initialization parameter from this servlet.
+ *
+ * @param name Name of the initialization parameter to remove
+ */
+ public void removeInitParameter(String name);
+
+
+ /**
+ * Remove a listener no longer interested in InstanceEvents.
+ *
+ * @param listener The listener to remove
+ */
+ public void removeInstanceListener(InstanceListener listener);
+
+
+ /**
+ * Remove a mapping associated with the wrapper.
+ *
+ * @param mapping The pattern to remove
+ */
+ public void removeMapping(String mapping);
+
+
+ /**
+ * Remove any security role reference for the specified role name.
+ *
+ * @param name Security role used within this servlet to be removed
+ */
+ public void removeSecurityReference(String name);
+
+
+ /**
+ * Process an UnavailableException, marking this servlet as unavailable
+ * for the specified amount of time.
+ *
+ * @param unavailable The exception that occurred, or <code>null</code>
+ * to mark this servlet as permanently unavailable
+ */
+ public void unavailable(UnavailableException unavailable);
+
+
+ /**
+ * Unload all initialized instances of this servlet, after calling the
+ * <code>destroy()</code> method for each instance. This can be used,
+ * for example, prior to shutting down the entire servlet engine, or
+ * prior to reloading all of the classes from the Loader associated with
+ * our Loader's repository.
+ *
+ * @exception ServletException if an unload error occurs
+ */
+ public void unload() throws ServletException;
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ant/AbstractCatalinaTask.java b/container/catalina/src/share/org/apache/catalina/ant/AbstractCatalinaTask.java
new file mode 100644
index 0000000..8b84bf6
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ant/AbstractCatalinaTask.java
@@ -0,0 +1,262 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ant;
+
+
+import java.io.BufferedOutputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import org.apache.catalina.util.Base64;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+
+
+/**
+ * Abstract base class for Ant tasks that interact with the
+ * <em>Manager</em> web application for dynamically deploying and
+ * undeploying applications. These tasks require Ant 1.4 or later.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ * @since 4.1
+ */
+
+public abstract class AbstractCatalinaTask extends Task {
+
+
+ // ----------------------------------------------------- Instance Variables
+
+
+ /**
+ * manager webapp's encoding.
+ */
+ private static String CHARSET = "utf-8";
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * The login password for the <code>Manager</code> application.
+ */
+ protected String password = null;
+
+ public String getPassword() {
+ return (this.password);
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+
+ /**
+ * The URL of the <code>Manager</code> application to be used.
+ */
+ protected String url = "http://localhost:8080/manager";
+
+ public String getUrl() {
+ return (this.url);
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+
+ /**
+ * The login username for the <code>Manager</code> application.
+ */
+ protected String username = null;
+
+ public String getUsername() {
+ return (this.username);
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Execute the specified command. This logic only performs the common
+ * attribute validation required by all subclasses; it does not perform
+ * any functional logic directly.
+ *
+ * @exception BuildException if a validation error occurs
+ */
+ public void execute() throws BuildException {
+
+ if ((username == null) || (password == null) || (url == null)) {
+ throw new BuildException
+ ("Must specify all of 'username', 'password', and 'url'");
+ }
+
+ }
+
+
+ // ------------------------------------------------------ Protected Methods
+
+
+ /**
+ * Execute the specified command, based on the configured properties.
+ *
+ * @param command Command to be executed
+ *
+ * @exception BuildException if an error occurs
+ */
+ public void execute(String command) throws BuildException {
+
+ execute(command, null, null, -1);
+
+ }
+
+
+ /**
+ * Execute the specified command, based on the configured properties.
+ * The input stream will be closed upon completion of this task, whether
+ * it was executed successfully or not.
+ *
+ * @param command Command to be executed
+ * @param istream InputStream to include in an HTTP PUT, if any
+ * @param contentType Content type to specify for the input, if any
+ * @param contentLength Content length to specify for the input, if any
+ *
+ * @exception BuildException if an error occurs
+ */
+ public void execute(String command, InputStream istream,
+ String contentType, int contentLength)
+ throws BuildException {
+
+ URLConnection conn = null;
+ InputStreamReader reader = null;
+ try {
+
+ // Create a connection for this command
+ conn = (new URL(url + command)).openConnection();
+ HttpURLConnection hconn = (HttpURLConnection) conn;
+
+ // Set up standard connection characteristics
+ hconn.setAllowUserInteraction(false);
+ hconn.setDoInput(true);
+ hconn.setUseCaches(false);
+ if (istream != null) {
+ hconn.setDoOutput(true);
+ hconn.setRequestMethod("PUT");
+ if (contentType != null) {
+ hconn.setRequestProperty("Content-Type", contentType);
+ }
+ if (contentLength >= 0) {
+ hconn.setRequestProperty("Content-Length",
+ "" + contentLength);
+ }
+ } else {
+ hconn.setDoOutput(false);
+ hconn.setRequestMethod("GET");
+ }
+ hconn.setRequestProperty("User-Agent",
+ "Catalina-Ant-Task/1.0");
+
+ // Set up an authorization header with our credentials
+ String input = username + ":" + password;
+ String output = new String(Base64.encode(input.getBytes()));
+ hconn.setRequestProperty("Authorization",
+ "Basic " + output);
+
+ // Establish the connection with the server
+ hconn.connect();
+
+ // Send the request data (if any)
+ if (istream != null) {
+ BufferedOutputStream ostream =
+ new BufferedOutputStream(hconn.getOutputStream(), 1024);
+ byte buffer[] = new byte[1024];
+ while (true) {
+ int n = istream.read(buffer);
+ if (n < 0) {
+ break;
+ }
+ ostream.write(buffer, 0, n);
+ }
+ ostream.flush();
+ ostream.close();
+ istream.close();
+ }
+
+ // Process the response message
+ reader = new InputStreamReader(hconn.getInputStream(), CHARSET);
+ StringBuffer buff = new StringBuffer();
+ String error = null;
+ boolean first = true;
+ while (true) {
+ int ch = reader.read();
+ if (ch < 0) {
+ break;
+ } else if ((ch == '\r') || (ch == '\n')) {
+ String line = buff.toString();
+ buff.setLength(0);
+ log(line, Project.MSG_INFO);
+ if (first) {
+ if (!line.startsWith("OK -")) {
+ error = line;
+ }
+ first = false;
+ }
+ } else {
+ buff.append((char) ch);
+ }
+ }
+ if (buff.length() > 0) {
+ log(buff.toString(), Project.MSG_INFO);
+ }
+ if (error != null) {
+ throw new BuildException(error);
+ }
+
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (Throwable u) {
+ ;
+ }
+ reader = null;
+ }
+ if (istream != null) {
+ try {
+ istream.close();
+ } catch (Throwable u) {
+ ;
+ }
+ istream = null;
+ }
+ }
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ant/DeployTask.java b/container/catalina/src/share/org/apache/catalina/ant/DeployTask.java
new file mode 100644
index 0000000..bbd014c
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ant/DeployTask.java
@@ -0,0 +1,200 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ant;
+
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLEncoder;
+
+import org.apache.tools.ant.BuildException;
+
+
+/**
+ * Ant task that implements the <code>/deploy</code> command, supported by
+ * the Tomcat manager application.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ * @since 4.1
+ */
+public class DeployTask extends AbstractCatalinaTask {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * URL of the context configuration file for this application, if any.
+ */
+ protected String config = null;
+
+ public String getConfig() {
+ return (this.config);
+ }
+
+ public void setConfig(String config) {
+ this.config = config;
+ }
+
+
+ /**
+ * URL of the server local web application archive (WAR) file
+ * to be deployed.
+ */
+ protected String localWar = null;
+
+ public String getLocalWar() {
+ return (this.localWar);
+ }
+
+ public void setLocalWar(String localWar) {
+ this.localWar = localWar;
+ }
+
+
+ /**
+ * The context path of the web application we are managing.
+ */
+ protected String path = null;
+
+ public String getPath() {
+ return (this.path);
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+
+ /**
+ * Tag to associate with this to be deployed webapp.
+ */
+ protected String tag = null;
+
+ public String getTag() {
+ return (this.tag);
+ }
+
+ public void setTag(String tag) {
+ this.tag = tag;
+ }
+
+
+ /**
+ * Update existing webapps.
+ */
+ protected boolean update = false;
+
+ public boolean getUpdate() {
+ return (this.update);
+ }
+
+ public void setUpdate(boolean update) {
+ this.update = update;
+ }
+
+
+ /**
+ * URL of the web application archive (WAR) file to be deployed.
+ */
+ protected String war = null;
+
+ public String getWar() {
+ return (this.war);
+ }
+
+ public void setWar(String war) {
+ this.war = war;
+ }
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Execute the requested operation.
+ *
+ * @exception BuildException if an error occurs
+ */
+ public void execute() throws BuildException {
+
+ super.execute();
+ if (path == null) {
+ throw new BuildException
+ ("Must specify 'path' attribute");
+ }
+ if ((war == null) && (localWar == null) && (config == null) && (tag == null)) {
+ throw new BuildException
+ ("Must specify either 'war', 'localWar', 'config', or 'tag' attribute");
+ }
+
+ // Building an input stream on the WAR to upload, if any
+ BufferedInputStream stream = null;
+ String contentType = null;
+ int contentLength = -1;
+ if (war != null) {
+ if (war.startsWith("file:")) {
+ try {
+ URL url = new URL(war);
+ URLConnection conn = url.openConnection();
+ contentLength = conn.getContentLength();
+ stream = new BufferedInputStream
+ (conn.getInputStream(), 1024);
+ } catch (IOException e) {
+ throw new BuildException(e);
+ }
+ } else {
+ try {
+ stream = new BufferedInputStream
+ (new FileInputStream(war), 1024);
+ } catch (IOException e) {
+ throw new BuildException(e);
+ }
+ }
+ contentType = "application/octet-stream";
+ }
+
+ // Building URL
+ StringBuffer sb = new StringBuffer("/deploy?path=");
+ sb.append(URLEncoder.encode(this.path));
+ if ((war == null) && (config != null)) {
+ sb.append("&config=");
+ sb.append(URLEncoder.encode(config));
+ }
+ if ((war == null) && (localWar != null)) {
+ sb.append("&war=");
+ sb.append(URLEncoder.encode(localWar));
+ }
+ if (update) {
+ sb.append("&update=true");
+ }
+ if (tag != null) {
+ sb.append("&tag=");
+ sb.append(URLEncoder.encode(tag));
+ }
+
+ execute(sb.toString(), stream, contentType, contentLength);
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ant/InstallTask.java b/container/catalina/src/share/org/apache/catalina/ant/InstallTask.java
new file mode 100644
index 0000000..c62a24e
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ant/InstallTask.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ant;
+
+
+import java.net.URLEncoder;
+
+import org.apache.tools.ant.BuildException;
+
+
+/**
+ * Ant task that implements the <code>/install</code> command, supported by the
+ * Tomcat manager application.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ * @since 4.1
+ * @deprecated Replaced by DeployTask
+ */
+public class InstallTask extends AbstractCatalinaTask {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * URL of the context configuration file for this application, if any.
+ */
+ protected String config = null;
+
+ public String getConfig() {
+ return (this.config);
+ }
+
+ public void setConfig(String config) {
+ this.config = config;
+ }
+
+
+ /**
+ * The context path of the web application we are managing.
+ */
+ protected String path = null;
+
+ public String getPath() {
+ return (this.path);
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+
+ /**
+ * URL of the web application archive (WAR) file, or the unpacked directory
+ * containing this application, if any.
+ */
+ protected String war = null;
+
+ public String getWar() {
+ return (this.war);
+ }
+
+ public void setWar(String war) {
+ this.war = war;
+ }
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Execute the requested operation.
+ *
+ * @exception BuildException if an error occurs
+ */
+ public void execute() throws BuildException {
+
+ super.execute();
+ if (path == null) {
+ throw new BuildException
+ ("Must specify 'path' attribute");
+ }
+ if ((config == null) && (war == null)) {
+ throw new BuildException
+ ("Must specify at least one of 'config' and 'war'");
+ }
+ StringBuffer sb = new StringBuffer("/install?path=");
+ sb.append(URLEncoder.encode(this.path));
+ if (config != null) {
+ sb.append("&config=");
+ sb.append(URLEncoder.encode(config));
+ }
+ if (war != null) {
+ sb.append("&war=");
+ sb.append(URLEncoder.encode(war));
+ }
+ execute(sb.toString());
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ant/JMXQueryTask.java b/container/catalina/src/share/org/apache/catalina/ant/JMXQueryTask.java
new file mode 100644
index 0000000..7058f65
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ant/JMXQueryTask.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ant;
+
+
+import org.apache.tools.ant.BuildException;
+
+
+/**
+ * Ant task that implements the JMX Query command
+ * (<code>/jmxproxy/?qry</code>) supported by the Tomcat manager application.
+ *
+ * @author Vivek Chopra
+ * @version $Revision$
+ */
+public class JMXQueryTask extends AbstractCatalinaTask {
+
+ // Properties
+
+ /**
+ * The JMX query string
+ * @see #setQuery(String)
+ */
+ protected String query = null;
+
+ // Public Methods
+
+ /**
+ * Get method for the JMX query string
+ * @return Query string
+ */
+ public String getQuery () {
+ return this.query;
+ }
+
+ /**
+ * Set method for the JMX query string.
+ * <P>Examples of query format:
+ * <UL>
+ * <LI>*:*</LI>
+ * <LI>*:type=RequestProcessor,*</LI>
+ * <LI>*:j2eeType=Servlet,*</LI>
+ * <LI>Catalina:type=Environment,resourcetype=Global,name=simpleValue</LI>
+ * </UL>
+ * </P>
+ * @param query JMX Query string
+ */
+ public void setQuery (String query) {
+ this.query = query;
+ }
+
+ /**
+ * Execute the requested operation.
+ *
+ * @exception BuildException if an error occurs
+ */
+ public void execute() throws BuildException {
+ super.execute();
+ String queryString = (query == null) ? "":("?qry="+query);
+ System.out.println ("INFO:Query string is " + queryString);
+ execute ("/jmxproxy/" + queryString);
+ }
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ant/JMXSetTask.java b/container/catalina/src/share/org/apache/catalina/ant/JMXSetTask.java
new file mode 100644
index 0000000..12edca7
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ant/JMXSetTask.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ant;
+
+
+import org.apache.tools.ant.BuildException;
+
+
+/**
+ * Ant task that implements the JMX Set command (<code>/jmxproxy/?set</code>)
+ * supported by the Tomcat manager application.
+ *
+ * @author Vivek Chopra
+ * @version $Revision$
+ */
+public class JMXSetTask extends AbstractCatalinaTask {
+
+ // Properties
+
+ /**
+ * The full bean name
+ */
+ protected String bean = null;
+
+ /**
+ * The attribute you wish to alter
+ */
+ protected String attribute = null;
+
+ /**
+ * The new value for the attribute
+ */
+ protected String value = null;
+
+ // Public Methods
+
+ /**
+ * Get method for the bean name
+ * @return Bean name
+ */
+ public String getBean () {
+ return this.bean;
+ }
+
+ /**
+ * Set method for the bean name
+ * @param bean Bean name
+ */
+ public void setBean (String bean) {
+ this.bean = bean;
+ }
+
+ /**
+ * Get method for the attribute name
+ * @return Attribute name
+ */
+ public String getAttribute () {
+ return this.attribute;
+ }
+
+ /**
+ * Set method for the attribute name
+ * @param attribute Attribute name
+ */
+ public void setAttribute (String attribute) {
+ this.attribute = attribute;
+ }
+
+ /**
+ * Get method for the attribute value
+ * @return Attribute value
+ */
+ public String getValue () {
+ return this.value;
+ }
+
+ /**
+ * Set method for the attribute value.
+ * @param value Attribute value
+ */
+ public void setValue (String value) {
+ this.value = value;
+ }
+
+ /**
+ * Execute the requested operation.
+ *
+ * @exception BuildException if an error occurs
+ */
+ public void execute() throws BuildException {
+ super.execute();
+ if (bean == null || attribute == null || value == null) {
+ throw new BuildException
+ ("Must specify 'bean', 'attribute' and 'value' attributes");
+ }
+ System.out.println ("INFO: Setting attribute " + attribute +
+ " in bean " + bean +
+ " to " + value);
+ execute("/jmxproxy/?set=" + bean
+ + "&att=" + attribute
+ + "&val=" + value);
+ }
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ant/ListTask.java b/container/catalina/src/share/org/apache/catalina/ant/ListTask.java
new file mode 100644
index 0000000..6f4c1dc
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ant/ListTask.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ant;
+
+
+import org.apache.tools.ant.BuildException;
+
+
+/**
+ * Ant task that implements the <code>/list</code> command, supported by the
+ * Tomcat manager application.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ * @since 4.1
+ */
+public class ListTask extends AbstractCatalinaTask {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Execute the requested operation.
+ *
+ * @exception BuildException if an error occurs
+ */
+ public void execute() throws BuildException {
+
+ super.execute();
+ execute("/list");
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ant/ReloadTask.java b/container/catalina/src/share/org/apache/catalina/ant/ReloadTask.java
new file mode 100644
index 0000000..adb8e3e
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ant/ReloadTask.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ant;
+
+
+import java.net.URLEncoder;
+
+import org.apache.tools.ant.BuildException;
+
+
+/**
+ * Ant task that implements the <code>/reload</code> command, supported by the
+ * Tomcat manager application.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ * @since 4.1
+ */
+public class ReloadTask extends AbstractCatalinaTask {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * The context path of the web application we are managing.
+ */
+ protected String path = null;
+
+ public String getPath() {
+ return (this.path);
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Execute the requested operation.
+ *
+ * @exception BuildException if an error occurs
+ */
+ public void execute() throws BuildException {
+
+ super.execute();
+ if (path == null) {
+ throw new BuildException
+ ("Must specify 'path' attribute");
+ }
+ execute("/reload?path=" + URLEncoder.encode(this.path));
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ant/RemoveTask.java b/container/catalina/src/share/org/apache/catalina/ant/RemoveTask.java
new file mode 100644
index 0000000..3ba0987
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ant/RemoveTask.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ant;
+
+
+import java.net.URLEncoder;
+
+import org.apache.tools.ant.BuildException;
+
+
+/**
+ * Ant task that implements the <code>/remove</code> command, supported by the
+ * Tomcat manager application.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ * @deprecated Replaced by UndeployTask
+ */
+public class RemoveTask extends AbstractCatalinaTask {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * The context path of the web application we are managing.
+ */
+ protected String path = null;
+
+ public String getPath() {
+ return (this.path);
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Execute the requested operation.
+ *
+ * @exception BuildException if an error occurs
+ */
+ public void execute() throws BuildException {
+
+ super.execute();
+ if (path == null) {
+ throw new BuildException
+ ("Must specify 'path' attribute");
+ }
+ execute("/remove?path=" + URLEncoder.encode(this.path));
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ant/ResourcesTask.java b/container/catalina/src/share/org/apache/catalina/ant/ResourcesTask.java
new file mode 100644
index 0000000..11522ef
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ant/ResourcesTask.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ant;
+
+
+import org.apache.tools.ant.BuildException;
+
+
+/**
+ * Ant task that implements the <code>/resources</code> command, supported by
+ * the Tomcat manager application.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ * @since 4.1
+ */
+public class ResourcesTask extends AbstractCatalinaTask {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * The fully qualified class name of the resource type being requested
+ * (if any).
+ */
+ protected String type = null;
+
+ public String getType() {
+ return (this.type);
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Execute the requested operation.
+ *
+ * @exception BuildException if an error occurs
+ */
+ public void execute() throws BuildException {
+
+ super.execute();
+ if (type != null) {
+ execute("/resources?type=" + type);
+ } else {
+ execute("/resources");
+ }
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ant/RolesTask.java b/container/catalina/src/share/org/apache/catalina/ant/RolesTask.java
new file mode 100644
index 0000000..07e340c
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ant/RolesTask.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ant;
+
+
+import org.apache.tools.ant.BuildException;
+
+
+/**
+ * Ant task that implements the <code>/roles</code> command, supported by the
+ * Tomcat manager application.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ * @since 4.1
+ */
+public class RolesTask extends AbstractCatalinaTask {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Execute the requested operation.
+ *
+ * @exception BuildException if an error occurs
+ */
+ public void execute() throws BuildException {
+
+ super.execute();
+ execute("/roles");
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ant/ServerinfoTask.java b/container/catalina/src/share/org/apache/catalina/ant/ServerinfoTask.java
new file mode 100644
index 0000000..6d41c8c
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ant/ServerinfoTask.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ant;
+
+
+import org.apache.tools.ant.BuildException;
+
+
+/**
+ * Ant task that implements the <code>/serverinfo</code> command
+ * supported by the Tomcat manager application.
+ *
+ * @author Vivek Chopra
+ * @version $Revision$ $Date$
+ */
+public class ServerinfoTask extends AbstractCatalinaTask {
+
+ // Public Methods
+
+ /**
+ * Execute the requested operation.
+ *
+ * @exception BuildException if an error occurs
+ */
+ public void execute() throws BuildException {
+
+ super.execute();
+ execute("/serverinfo");
+
+ }
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ant/SessionsTask.java b/container/catalina/src/share/org/apache/catalina/ant/SessionsTask.java
new file mode 100644
index 0000000..f580a11
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ant/SessionsTask.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ant;
+
+
+import java.net.URLEncoder;
+
+import org.apache.tools.ant.BuildException;
+
+
+/**
+ * Ant task that implements the <code>/sessions</code> command
+ * supported by the Tomcat manager application.
+ *
+ * @author Vivek Chopra
+ * @version $Revision$
+ */
+public class SessionsTask extends AbstractCatalinaTask {
+
+ // Properties
+
+ /**
+ * The context path of the web application we are managing.
+ */
+ protected String path = null;
+
+ public String getPath() {
+ return (this.path);
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ // Public Methods
+
+ /**
+ * Execute the requested operation.
+ *
+ * @exception BuildException if an error occurs
+ */
+ public void execute() throws BuildException {
+
+ super.execute();
+ if (path == null) {
+ throw new BuildException
+ ("Must specify 'path' attribute");
+ }
+ execute("/sessions?path=" + URLEncoder.encode(this.path));
+ }
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ant/StartTask.java b/container/catalina/src/share/org/apache/catalina/ant/StartTask.java
new file mode 100644
index 0000000..230605c
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ant/StartTask.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ant;
+
+
+import java.net.URLEncoder;
+
+import org.apache.tools.ant.BuildException;
+
+
+/**
+ * Ant task that implements the <code>/start</code> command, supported by the
+ * Tomcat manager application.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ * @since 4.1
+ */
+public class StartTask extends AbstractCatalinaTask {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * The context path of the web application we are managing.
+ */
+ protected String path = null;
+
+ public String getPath() {
+ return (this.path);
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Execute the requested operation.
+ *
+ * @exception BuildException if an error occurs
+ */
+ public void execute() throws BuildException {
+
+ super.execute();
+ if (path == null) {
+ throw new BuildException
+ ("Must specify 'path' attribute");
+ }
+ execute("/start?path=" + URLEncoder.encode(this.path));
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ant/StopTask.java b/container/catalina/src/share/org/apache/catalina/ant/StopTask.java
new file mode 100644
index 0000000..b2b6870
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ant/StopTask.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ant;
+
+
+import java.net.URLEncoder;
+
+import org.apache.tools.ant.BuildException;
+
+
+/**
+ * Ant task that implements the <code>/stop</code> command, supported by the
+ * Tomcat manager application.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ * @since 4.1
+ */
+public class StopTask extends AbstractCatalinaTask {
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * The context path of the web application we are managing.
+ */
+ protected String path = null;
+
+ public String getPath() {
+ return (this.path);
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Execute the requested operation.
+ *
+ * @exception BuildException if an error occurs
+ */
+ public void execute() throws BuildException {
+
+ super.execute();
+ if (path == null) {
+ throw new BuildException
+ ("Must specify 'path' attribute");
+ }
+ execute("/stop?path=" + URLEncoder.encode(this.path));
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ant/UndeployTask.java b/container/catalina/src/share/org/apache/catalina/ant/UndeployTask.java
new file mode 100644
index 0000000..4ad2c34
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ant/UndeployTask.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ant;
+
+
+import org.apache.tools.ant.BuildException;
+
+
+/**
+ * Ant task that implements the <code>/undeploy</code> command, supported by
+ * the Tomcat manager application.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ * @since 4.1
+ */
+public class UndeployTask extends AbstractCatalinaTask {
+
+
+ // ------------------------------------------------------------- Properties
+ /**
+ * Whether to fail (with a BuildException) if
+ * an error occurs. The default behavior is
+ * to do so.
+ */
+ protected boolean failOnError = true;
+
+ /**
+ * Returns the value of the failOnError
+ * property.
+ */
+ public boolean isFailOnError() {
+ return failOnError;
+ }
+
+ /**
+ * Sets the value of the failOnError property.
+ *
+ * @param newFailOnError New attribute value
+ */
+ public void setFailOnError(boolean newFailOnError) {
+ failOnError = newFailOnError;
+ }
+
+ /**
+ * The context path of the web application we are managing.
+ */
+ protected String path = null;
+
+ public String getPath() {
+ return (this.path);
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Execute the requested operation.
+ *
+ * @exception BuildException if an error occurs
+ */
+ public void execute() throws BuildException {
+
+ super.execute();
+ if (path == null) {
+ throw new BuildException
+ ("Must specify 'path' attribute");
+ }
+
+ try {
+ execute("/undeploy?path=" + this.path);
+ } catch (BuildException e) {
+ if( isFailOnError() ) {
+ throw e;
+ }
+ }
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ant/ValidatorTask.java b/container/catalina/src/share/org/apache/catalina/ant/ValidatorTask.java
new file mode 100644
index 0000000..5c9f895
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ant/ValidatorTask.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.ant;
+
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import org.apache.catalina.startup.Constants;
+import org.apache.catalina.startup.DigesterFactory;
+import org.apache.tomcat.util.digester.Digester;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.xml.sax.InputSource;
+
+
+/**
+ * Task for validating a web application deployment descriptor, using XML
+ * schema validation.
+ *
+ * @author Remy Maucherat
+ * @version $Revision$ $Date$
+ * @since 5.0
+ */
+
+public class ValidatorTask extends Task {
+
+
+ // ----------------------------------------------------- Instance Variables
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * The path to the webapp directory.
+ */
+ protected String path = null;
+
+ public String getPath() {
+ return (this.path);
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Execute the specified command. This logic only performs the common
+ * attribute validation required by all subclasses; it does not perform
+ * any functional logic directly.
+ *
+ * @exception BuildException if a validation error occurs
+ */
+ public void execute() throws BuildException {
+
+ if (path == null) {
+ throw new BuildException("Must specify 'path'");
+ }
+
+ File file = new File(path, Constants.ApplicationWebXml);
+ if ((!file.exists()) || (!file.canRead())) {
+ throw new BuildException("Cannot find web.xml");
+ }
+
+ // Commons-logging likes having the context classloader set
+ ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader
+ (ValidatorTask.class.getClassLoader());
+
+ Digester digester = DigesterFactory.newDigester(true, true, null);
+ try {
+ file = file.getCanonicalFile();
+ InputStream stream =
+ new BufferedInputStream(new FileInputStream(file));
+ InputSource is = new InputSource(file.toURL().toExternalForm());
+ is.setByteStream(stream);
+ digester.parse(is);
+ System.out.println("web.xml validated");
+ } catch (Throwable t) {
+ throw new BuildException("Validation failure", t);
+ } finally {
+ Thread.currentThread().setContextClassLoader(oldCL);
+ }
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/ant/catalina.tasks b/container/catalina/src/share/org/apache/catalina/ant/catalina.tasks
new file mode 100644
index 0000000..2977d1f
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ant/catalina.tasks
@@ -0,0 +1,13 @@
+# Pure catalina tasks
+deploy=org.apache.catalina.ant.DeployTask
+list=org.apache.catalina.ant.ListTask
+reload=org.apache.catalina.ant.ReloadTask
+resources=org.apache.catalina.ant.ResourcesTask
+roles=org.apache.catalina.ant.RolesTask
+start=org.apache.catalina.ant.StartTask
+stop=org.apache.catalina.ant.StopTask
+undeploy=org.apache.catalina.ant.UndeployTask
+validator=org.apache.catalina.ant.ValidatorTask
+
+# Jasper tasks
+jasper2=org.apache.jasper.JspC
diff --git a/container/catalina/src/share/org/apache/catalina/ant/package.html b/container/catalina/src/share/org/apache/catalina/ant/package.html
new file mode 100644
index 0000000..765b49c
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/ant/package.html
@@ -0,0 +1,86 @@
+<body>
+
+<p>This package contains a set of <code>Task</code> implementations for
+<em>Ant (version 1.4 or later)</em> that can be used to interact with the
+Manager application to install, reload, and remove web applications from
+a running instance of Tomcat. For more information, see
+<a href="http://jakarta.apache.org/tomcat/tomcat-4.0-doc/manager-howto.html">
+http://jakarta.apache.org/tomcat/tomcat-4.0-doc/manager-howto.html</a>.</p>
+
+<p>The attributes of each task element correspond
+exactly to the request parameters that are included with an HTTP request
+sent directly to the Manager application. They are summarized as follows:
+</p>
+
+<table>
+ <tr>
+ <th align="center" width="15%">Attribute</th>
+ <th align="center" width="85%">Description</th>
+ </tr>
+ <tr>
+ <td align="center">url</td>
+ <td>
+ The URL of the Manager web application you will use to
+ perform the requested operations. If not specified, defaults to
+ <code>http://localhost:8080/manager</code> (which corresponds
+ to a standard installation of Tomcat 5).
+ </td>
+ </tr>
+ <tr>
+ <td align="center">username</td>
+ <td>
+ The username of a Tomcat user that has been configured with the
+ <code>manager</code> role, as required to execute Manager
+ application commands. This attribute is required.
+ </td>
+ </tr>
+ <tr>
+ <td align="center">password</td>
+ <td>
+ The password of a Tomcat user that has been configured with the
+ <code>manager</code> role, as required to execute Manager
+ application commands. This attribute is required.
+ </td>
+ </tr>
+ <tr>
+ <td align="center">config</td>
+ <td>
+ A URL pointing at the context configuration file (i.e. a file
+ containing only the <code><Context></code> element, and
+ its nested elements, from <code>server.xml</code> for a particular
+ web application). This attribute is supported only on the
+ <code>install</code> target, and is required only if you wish to
+ install an application with non-default configuration characteristics.
+ </td>
+ </tr>
+ <tr>
+ <td align="center">path</td>
+ <td>
+ The context path (including the leading slash) of the web application
+ this command is intended to manage, or a zero-length string for the
+ ROOT web application. This attribute is valid for the
+ <code>install</code>, <code>reload</code>, <code>remove</code>,
+ <code>start</code>, and <code>stop</code> tasks only, and is
+ required in all of those cases.
+ </td>
+ </tr>
+ <tr>
+ <td align="center">war</td>
+ <td>
+ A <code>jar:</code> URL that points at a web application archive (WAR)
+ file, or a <code>file:</code> URL that points at an unpacked directory
+ containing the web application. This attribute is supported only on
+ the <code>install</code> target. You must specify at least one of the
+ <code>config</code> and <code>war</code> attributes; if you specify
+ both, the <code>war</code> attribute overrides the <code>docBase</code>
+ attribute in the context configuration file.
+ </td>
+ </tr>
+</table>
+
+<p><strong>NOTE</strong> - Commands executed through the <em>Manager</em>
+application are <strong>NOT</strong> reflected in updates to the Tomcat
+<code>server.xml</code> configuration file, so they do not persist past the
+next time you restart the entire Tomcat container.</p>
+
+</body>
diff --git a/container/catalina/src/share/org/apache/catalina/authenticator/AuthenticatorBase.java b/container/catalina/src/share/org/apache/catalina/authenticator/AuthenticatorBase.java
new file mode 100644
index 0000000..920bb53
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/authenticator/AuthenticatorBase.java
@@ -0,0 +1,831 @@
+/*
+ * Copyright 1999-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.authenticator;
+
+
+import java.io.IOException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.Principal;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import java.util.Random;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.Cookie;
+
+import org.apache.catalina.Authenticator;
+import org.apache.catalina.Container;
+import org.apache.catalina.Context;
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.Pipeline;
+import org.apache.catalina.Realm;
+import org.apache.catalina.Session;
+import org.apache.catalina.Valve;
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+import org.apache.catalina.deploy.LoginConfig;
+import org.apache.catalina.deploy.SecurityConstraint;
+import org.apache.catalina.util.DateTool;
+import org.apache.catalina.util.LifecycleSupport;
+import org.apache.catalina.util.StringManager;
+import org.apache.catalina.valves.ValveBase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+/**
+ * Basic implementation of the <b>Valve</b> interface that enforces the
+ * <code><security-constraint></code> elements in the web application
+ * deployment descriptor. This functionality is implemented as a Valve
+ * so that it can be ommitted in environments that do not require these
+ * features. Individual implementations of each supported authentication
+ * method can subclass this base class as required.
+ * <p>
+ * <b>USAGE CONSTRAINT</b>: When this class is utilized, the Context to
+ * which it is attached (or a parent Container in a hierarchy) must have an
+ * associated Realm that can be used for authenticating users and enumerating
+ * the roles to which they have been assigned.
+ * <p>
+ * <b>USAGE CONSTRAINT</b>: This Valve is only useful when processing HTTP
+ * requests. Requests of any other type will simply be passed through.
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+
+public abstract class AuthenticatorBase
+ extends ValveBase
+ implements Authenticator, Lifecycle {
+ private static Log log = LogFactory.getLog(AuthenticatorBase.class);
+
+
+ // ----------------------------------------------------- Instance Variables
+
+
+ /**
+ * The default message digest algorithm to use if we cannot use
+ * the requested one.
+ */
+ protected static final String DEFAULT_ALGORITHM = "MD5";
+
+
+ /**
+ * The number of random bytes to include when generating a
+ * session identifier.
+ */
+ protected static final int SESSION_ID_BYTES = 16;
+
+
+ /**
+ * The message digest algorithm to be used when generating session
+ * identifiers. This must be an algorithm supported by the
+ * <code>java.security.MessageDigest</code> class on your platform.
+ */
+ protected String algorithm = DEFAULT_ALGORITHM;
+
+
+ /**
+ * Should we cache authenticated Principals if the request is part of
+ * an HTTP session?
+ */
+ protected boolean cache = true;
+
+
+ /**
+ * The Context to which this Valve is attached.
+ */
+ protected Context context = null;
+
+
+ /**
+ * Return the MessageDigest implementation to be used when
+ * creating session identifiers.
+ */
+ protected MessageDigest digest = null;
+
+
+ /**
+ * A String initialization parameter used to increase the entropy of
+ * the initialization of our random number generator.
+ */
+ protected String entropy = null;
+
+
+ /**
+ * Descriptive information about this implementation.
+ */
+ protected static final String info =
+ "org.apache.catalina.authenticator.AuthenticatorBase/1.0";
+
+ /**
+ * Flag to determine if we disable proxy caching, or leave the issue
+ * up to the webapp developer.
+ */
+ protected boolean disableProxyCaching = true;
+
+ /**
+ * The lifecycle event support for this component.
+ */
+ protected LifecycleSupport lifecycle = new LifecycleSupport(this);
+
+
+ /**
+ * A random number generator to use when generating session identifiers.
+ */
+ protected Random random = null;
+
+
+ /**
+ * The Java class name of the random number generator class to be used
+ * when generating session identifiers.
+ */
+ protected String randomClass = "java.security.SecureRandom";
+
+
+ /**
+ * The string manager for this package.
+ */
+ protected static final StringManager sm =
+ StringManager.getManager(Constants.Package);
+
+
+ /**
+ * The SingleSignOn implementation in our request processing chain,
+ * if there is one.
+ */
+ protected SingleSignOn sso = null;
+
+
+ /**
+ * Has this component been started?
+ */
+ protected boolean started = false;
+
+
+ /**
+ * "Expires" header always set to Date(1), so generate once only
+ */
+ private static final String DATE_ONE =
+ (new SimpleDateFormat(DateTool.HTTP_RESPONSE_DATE_HEADER,
+ Locale.US)).format(new Date(1));
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return the message digest algorithm for this Manager.
+ */
+ public String getAlgorithm() {
+
+ return (this.algorithm);
+
+ }
+
+
+ /**
+ * Set the message digest algorithm for this Manager.
+ *
+ * @param algorithm The new message digest algorithm
+ */
+ public void setAlgorithm(String algorithm) {
+
+ this.algorithm = algorithm;
+
+ }
+
+
+ /**
+ * Return the cache authenticated Principals flag.
+ */
+ public boolean getCache() {
+
+ return (this.cache);
+
+ }
+
+
+ /**
+ * Set the cache authenticated Principals flag.
+ *
+ * @param cache The new cache flag
+ */
+ public void setCache(boolean cache) {
+
+ this.cache = cache;
+
+ }
+
+
+ /**
+ * Return the Container to which this Valve is attached.
+ */
+ public Container getContainer() {
+
+ return (this.context);
+
+ }
+
+
+ /**
+ * Set the Container to which this Valve is attached.
+ *
+ * @param container The container to which we are attached
+ */
+ public void setContainer(Container container) {
+
+ if (!(container instanceof Context))
+ throw new IllegalArgumentException
+ (sm.getString("authenticator.notContext"));
+
+ super.setContainer(container);
+ this.context = (Context) container;
+
+ }
+
+
+ /**
+ * Return the entropy increaser value, or compute a semi-useful value
+ * if this String has not yet been set.
+ */
+ public String getEntropy() {
+
+ // Calculate a semi-useful value if this has not been set
+ if (this.entropy == null)
+ setEntropy(this.toString());
+
+ return (this.entropy);
+
+ }
+
+
+ /**
+ * Set the entropy increaser value.
+ *
+ * @param entropy The new entropy increaser value
+ */
+ public void setEntropy(String entropy) {
+
+ this.entropy = entropy;
+
+ }
+
+
+ /**
+ * Return descriptive information about this Valve implementation.
+ */
+ public String getInfo() {
+
+ return (info);
+
+ }
+
+
+ /**
+ * Return the random number generator class name.
+ */
+ public String getRandomClass() {
+
+ return (this.randomClass);
+
+ }
+
+
+ /**
+ * Set the random number generator class name.
+ *
+ * @param randomClass The new random number generator class name
+ */
+ public void setRandomClass(String randomClass) {
+
+ this.randomClass = randomClass;
+
+ }
+
+ /**
+ * Return the flag that states if we add headers to disable caching by
+ * proxies.
+ */
+ public boolean getDisableProxyCaching() {
+ return disableProxyCaching;
+ }
+
+ /**
+ * Set the value of the flag that states if we add headers to disable
+ * caching by proxies.
+ * @param nocache <code>true</code> if we add headers to disable proxy
+ * caching, <code>false</code> if we leave the headers alone.
+ */
+ public void setDisableProxyCaching(boolean nocache) {
+ disableProxyCaching = nocache;
+ }
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Enforce the security restrictions in the web application deployment
+ * descriptor of our associated Context.
+ *
+ * @param request Request to be processed
+ * @param response Response to be processed
+ *
+ * @exception IOException if an input/output error occurs
+ * @exception ServletException if thrown by a processing element
+ */
+ public void invoke(Request request, Response response)
+ throws IOException, ServletException {
+
+ if (log.isDebugEnabled())
+ log.debug("Security checking request " +
+ request.getMethod() + " " + request.getRequestURI());
+ LoginConfig config = this.context.getLoginConfig();
+
+ // Have we got a cached authenticated Principal to record?
+ if (cache) {
+ Principal principal = request.getUserPrincipal();
+ if (principal == null) {
+ Session session = request.getSessionInternal();
+ if (session != null) {
+ principal = session.getPrincipal();
+ if (principal != null) {
+ if (log.isDebugEnabled())
+ log.debug("We have cached auth type " +
+ session.getAuthType() +
+ " for principal " +
+ session.getPrincipal());
+ request.setAuthType(session.getAuthType());
+ request.setUserPrincipal(principal);
+ }
+ }
+ }
+ }
+
+ // Special handling for form-based logins to deal with the case
+ // where the login form (and therefore the "j_security_check" URI
+ // to which it submits) might be outside the secured area
+ String contextPath = this.context.getPath();
+ String requestURI = request.getDecodedRequestURI();
+ if (requestURI.startsWith(contextPath) &&
+ requestURI.endsWith(Constants.FORM_ACTION)) {
+ if (!authenticate(request, response, config)) {
+ if (log.isDebugEnabled())
+ log.debug(" Failed authenticate() test ??" + requestURI );
+ return;
+ }
+ }
+
+ Realm realm = this.context.getRealm();
+ // Is this request URI subject to a security constraint?
+ SecurityConstraint [] constraints
+ = realm.findSecurityConstraints(request, this.context);
+
+ if ((constraints == null) /* &&
+ (!Constants.FORM_METHOD.equals(config.getAuthMethod())) */ ) {
+ if (log.isDebugEnabled())
+ log.debug(" Not subject to any constraint");
+ getNext().invoke(request, response);
+ return;
+ }
+
+ // Make sure that constrained resources are not cached by web proxies
+ // or browsers as caching can provide a security hole
+ if (disableProxyCaching &&
+ // FIXME: Disabled for Mozilla FORM support over SSL
+ // (improper caching issue)
+ //!request.isSecure() &&
+ !"POST".equalsIgnoreCase(request.getMethod())) {
+ response.setHeader("Pragma", "No-cache");
+ response.setHeader("Cache-Control", "no-cache");
+ response.setHeader("Expires", DATE_ONE);
+ }
+
+ int i;
+ // Enforce any user data constraint for this security constraint
+ if (log.isDebugEnabled()) {
+ log.debug(" Calling hasUserDataPermission()");
+ }
+ if (!realm.hasUserDataPermission(request, response,
+ constraints)) {
+ if (log.isDebugEnabled()) {
+ log.debug(" Failed hasUserDataPermission() test");
+ }
+ /*
+ * ASSERT: Authenticator already set the appropriate
+ * HTTP status code, so we do not have to do anything special
+ */
+ return;
+ }
+
+ for(i=0; i < constraints.length; i++) {
+ // Authenticate based upon the specified login configuration
+ if (constraints[i].getAuthConstraint()) {
+ if (log.isDebugEnabled()) {
+ log.debug(" Calling authenticate()");
+ }
+ if (!authenticate(request, response, config)) {
+ if (log.isDebugEnabled()) {
+ log.debug(" Failed authenticate() test");
+ }
+ /*
+ * ASSERT: Authenticator already set the appropriate
+ * HTTP status code, so we do not have to do anything
+ * special
+ */
+ return;
+ } else {
+ break;
+ }
+ }
+ }
+ if (log.isDebugEnabled()) {
+ log.debug(" Calling accessControl()");
+ }
+ if (!realm.hasResourcePermission(request, response,
+ constraints,
+ this.context)) {
+ if (log.isDebugEnabled()) {
+ log.debug(" Failed accessControl() test");
+ }
+ /*
+ * ASSERT: AccessControl method has already set the
+ * appropriate HTTP status code, so we do not have to do
+ * anything special
+ */
+ return;
+ }
+
+ // Any and all specified constraints have been satisfied
+ if (log.isDebugEnabled()) {
+ log.debug(" Successfully passed all security constraints");
+ }
+ getNext().invoke(request, response);
+
+ }
+
+
+ // ------------------------------------------------------ Protected Methods
+
+
+
+
+ /**
+ * Associate the specified single sign on identifier with the
+ * specified Session.
+ *
+ * @param ssoId Single sign on identifier
+ * @param session Session to be associated
+ */
+ protected void associate(String ssoId, Session session) {
+
+ if (sso == null)
+ return;
+ sso.associate(ssoId, session);
+
+ }
+
+
+ /**
+ * Authenticate the user making this request, based on the specified
+ * login configuration. Return <code>true</code> if any specified
+ * constraint has been satisfied, or <code>false</code> if we have
+ * created a response challenge already.
+ *
+ * @param request Request we are processing
+ * @param response Response we are creating
+ * @param config Login configuration describing how authentication
+ * should be performed
+ *
+ * @exception IOException if an input/output error occurs
+ */
+ protected abstract boolean authenticate(Request request,
+ Response response,
+ LoginConfig config)
+ throws IOException;
+
+
+ /**
+ * Generate and return a new session identifier for the cookie that
+ * identifies an SSO principal.
+ */
+ protected synchronized String generateSessionId() {
+
+ // Generate a byte array containing a session identifier
+ byte bytes[] = new byte[SESSION_ID_BYTES];
+ getRandom().nextBytes(bytes);
+ bytes = getDigest().digest(bytes);
+
+ // Render the result as a String of hexadecimal digits
+ StringBuffer result = new StringBuffer();
+ for (int i = 0; i < bytes.length; i++) {
+ byte b1 = (byte) ((bytes[i] & 0xf0) >> 4);
+ byte b2 = (byte) (bytes[i] & 0x0f);
+ if (b1 < 10)
+ result.append((char) ('0' + b1));
+ else
+ result.append((char) ('A' + (b1 - 10)));
+ if (b2 < 10)
+ result.append((char) ('0' + b2));
+ else
+ result.append((char) ('A' + (b2 - 10)));
+ }
+ return (result.toString());
+
+ }
+
+
+ /**
+ * Return the MessageDigest object to be used for calculating
+ * session identifiers. If none has been created yet, initialize
+ * one the first time this method is called.
+ */
+ protected synchronized MessageDigest getDigest() {
+
+ if (this.digest == null) {
+ try {
+ this.digest = MessageDigest.getInstance(algorithm);
+ } catch (NoSuchAlgorithmException e) {
+ try {
+ this.digest = MessageDigest.getInstance(DEFAULT_ALGORITHM);
+ } catch (NoSuchAlgorithmException f) {
+ this.digest = null;
+ }
+ }
+ }
+
+ return (this.digest);
+
+ }
+
+
+ /**
+ * Return the random number generator instance we should use for
+ * generating session identifiers. If there is no such generator
+ * currently defined, construct and seed a new one.
+ */
+ protected synchronized Random getRandom() {
+
+ if (this.random == null) {
+ try {
+ Class clazz = Class.forName(randomClass);
+ this.random = (Random) clazz.newInstance();
+ long seed = System.currentTimeMillis();
+ char entropy[] = getEntropy().toCharArray();
+ for (int i = 0; i < entropy.length; i++) {
+ long update = ((byte) entropy[i]) << ((i % 8) * 8);
+ seed ^= update;
+ }
+ this.random.setSeed(seed);
+ } catch (Exception e) {
+ this.random = new java.util.Random();
+ }
+ }
+
+ return (this.random);
+
+ }
+
+
+ /**
+ * Attempts reauthentication to the <code>Realm</code> using
+ * the credentials included in argument <code>entry</code>.
+ *
+ * @param ssoId identifier of SingleSignOn session with which the
+ * caller is associated
+ * @param request the request that needs to be authenticated
+ */
+ protected boolean reauthenticateFromSSO(String ssoId, Request request) {
+
+ if (sso == null || ssoId == null)
+ return false;
+
+ boolean reauthenticated = false;
+
+ Container parent = getContainer();
+ if (parent != null) {
+ Realm realm = parent.getRealm();
+ if (realm != null) {
+ reauthenticated = sso.reauthenticate(ssoId, realm, request);
+ }
+ }
+
+ if (reauthenticated) {
+ associate(ssoId, request.getSessionInternal(true));
+
+ if (log.isDebugEnabled()) {
+ log.debug(" Reauthenticated cached principal '" +
+ request.getUserPrincipal().getName() +
+ "' with auth type '" + request.getAuthType() + "'");
+ }
+ }
+
+ return reauthenticated;
+ }
+
+
+ /**
+ * Register an authenticated Principal and authentication type in our
+ * request, in the current session (if there is one), and with our
+ * SingleSignOn valve, if there is one. Set the appropriate cookie
+ * to be returned.
+ *
+ * @param request The servlet request we are processing
+ * @param response The servlet response we are generating
+ * @param principal The authenticated Principal to be registered
+ * @param authType The authentication type to be registered
+ * @param username Username used to authenticate (if any)
+ * @param password Password used to authenticate (if any)
+ */
+ protected void register(Request request, Response response,
+ Principal principal, String authType,
+ String username, String password) {
+
+ if (log.isDebugEnabled())
+ log.debug("Authenticated '" + principal.getName() + "' with type '"
+ + authType + "'");
+
+ // Cache the authentication information in our request
+ request.setAuthType(authType);
+ request.setUserPrincipal(principal);
+
+ Session session = request.getSessionInternal(false);
+ // Cache the authentication information in our session, if any
+ if (cache) {
+ if (session != null) {
+ session.setAuthType(authType);
+ session.setPrincipal(principal);
+ if (username != null)
+ session.setNote(Constants.SESS_USERNAME_NOTE, username);
+ else
+ session.removeNote(Constants.SESS_USERNAME_NOTE);
+ if (password != null)
+ session.setNote(Constants.SESS_PASSWORD_NOTE, password);
+ else
+ session.removeNote(Constants.SESS_PASSWORD_NOTE);
+ }
+ }
+
+ // Construct a cookie to be returned to the client
+ if (sso == null)
+ return;
+
+ // Only create a new SSO entry if the SSO did not already set a note
+ // for an existing entry (as it would do with subsequent requests
+ // for DIGEST and SSL authenticated contexts)
+ String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE);
+ if (ssoId == null) {
+ // Construct a cookie to be returned to the client
+ ssoId = generateSessionId();
+ Cookie cookie = new Cookie(Constants.SINGLE_SIGN_ON_COOKIE, ssoId);
+ cookie.setMaxAge(-1);
+ cookie.setPath("/");
+ response.addCookie(cookie);
+
+ // Register this principal with our SSO valve
+ sso.register(ssoId, principal, authType, username, password);
+ request.setNote(Constants.REQ_SSOID_NOTE, ssoId);
+
+ } else {
+ // Update the SSO session with the latest authentication data
+ sso.update(ssoId, principal, authType, username, password);
+ }
+
+ // Fix for Bug 10040
+ // Always associate a session with a new SSO reqistration.
+ // SSO entries are only removed from the SSO registry map when
+ // associated sessions are destroyed; if a new SSO entry is created
+ // above for this request and the user never revisits the context, the
+ // SSO entry will never be cleared if we don't associate the session
+ if (session == null)
+ session = request.getSessionInternal(true);
+ sso.associate(ssoId, session);
+
+ }
+
+
+ // ------------------------------------------------------ Lifecycle Methods
+
+
+ /**
+ * Add a lifecycle event listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.addLifecycleListener(listener);
+
+ }
+
+
+ /**
+ * Get the lifecycle listeners associated with this lifecycle. If this
+ * Lifecycle has no listeners registered, a zero-length array is returned.
+ */
+ public LifecycleListener[] findLifecycleListeners() {
+
+ return lifecycle.findLifecycleListeners();
+
+ }
+
+
+ /**
+ * Remove a lifecycle event listener from this component.
+ *
+ * @param listener The listener to remove
+ */
+ public void removeLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.removeLifecycleListener(listener);
+
+ }
+
+
+ /**
+ * Prepare for the beginning of active use of the public methods of this
+ * component. This method should be called after <code>configure()</code>,
+ * and before any of the public methods of the component are utilized.
+ *
+ * @exception LifecycleException if this component detects a fatal error
+ * that prevents this component from being used
+ */
+ public void start() throws LifecycleException {
+
+ // Validate and update our current component state
+ if (started)
+ throw new LifecycleException
+ (sm.getString("authenticator.alreadyStarted"));
+ lifecycle.fireLifecycleEvent(START_EVENT, null);
+ started = true;
+
+ // Look up the SingleSignOn implementation in our request processing
+ // path, if there is one
+ Container parent = context.getParent();
+ while ((sso == null) && (parent != null)) {
+ if (!(parent instanceof Pipeline)) {
+ parent = parent.getParent();
+ continue;
+ }
+ Valve valves[] = ((Pipeline) parent).getValves();
+ for (int i = 0; i < valves.length; i++) {
+ if (valves[i] instanceof SingleSignOn) {
+ sso = (SingleSignOn) valves[i];
+ break;
+ }
+ }
+ if (sso == null)
+ parent = parent.getParent();
+ }
+ if (log.isDebugEnabled()) {
+ if (sso != null)
+ log.debug("Found SingleSignOn Valve at " + sso);
+ else
+ log.debug("No SingleSignOn Valve is present");
+ }
+
+ }
+
+
+ /**
+ * Gracefully terminate the active use of the public methods of this
+ * component. This method should be the last one called on a given
+ * instance of this component.
+ *
+ * @exception LifecycleException if this component detects a fatal error
+ * that needs to be reported
+ */
+ public void stop() throws LifecycleException {
+
+ // Validate and update our current component state
+ if (!started)
+ throw new LifecycleException
+ (sm.getString("authenticator.notStarted"));
+ lifecycle.fireLifecycleEvent(STOP_EVENT, null);
+ started = false;
+
+ sso = null;
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/authenticator/BasicAuthenticator.java b/container/catalina/src/share/org/apache/catalina/authenticator/BasicAuthenticator.java
new file mode 100644
index 0000000..58aef6f
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/authenticator/BasicAuthenticator.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.authenticator;
+
+
+import java.io.IOException;
+import java.security.Principal;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+import org.apache.catalina.deploy.LoginConfig;
+import org.apache.catalina.util.Base64;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tomcat.util.buf.ByteChunk;
+import org.apache.tomcat.util.buf.CharChunk;
+import org.apache.tomcat.util.buf.MessageBytes;
+
+
+
+/**
+ * An <b>Authenticator</b> and <b>Valve</b> implementation of HTTP BASIC
+ * Authentication, as outlined in RFC 2617: "HTTP Authentication: Basic
+ * and Digest Access Authentication."
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+
+public class BasicAuthenticator
+ extends AuthenticatorBase {
+ private static Log log = LogFactory.getLog(BasicAuthenticator.class);
+
+
+
+ /**
+ * Authenticate bytes.
+ */
+ public static final byte[] AUTHENTICATE_BYTES = {
+ (byte) 'W',
+ (byte) 'W',
+ (byte) 'W',
+ (byte) '-',
+ (byte) 'A',
+ (byte) 'u',
+ (byte) 't',
+ (byte) 'h',
+ (byte) 'e',
+ (byte) 'n',
+ (byte) 't',
+ (byte) 'i',
+ (byte) 'c',
+ (byte) 'a',
+ (byte) 't',
+ (byte) 'e'
+ };
+
+
+ // ----------------------------------------------------- Instance Variables
+
+
+ /**
+ * Descriptive information about this implementation.
+ */
+ protected static final String info =
+ "org.apache.catalina.authenticator.BasicAuthenticator/1.0";
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return descriptive information about this Valve implementation.
+ */
+ public String getInfo() {
+
+ return (info);
+
+ }
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Authenticate the user making this request, based on the specified
+ * login configuration. Return <code>true</code> if any specified
+ * constraint has been satisfied, or <code>false</code> if we have
+ * created a response challenge already.
+ *
+ * @param request Request we are processing
+ * @param response Response we are creating
+ * @param config Login configuration describing how authentication
+ * should be performed
+ *
+ * @exception IOException if an input/output error occurs
+ */
+ public boolean authenticate(Request request,
+ Response response,
+ LoginConfig config)
+ throws IOException {
+
+ // Have we already authenticated someone?
+ Principal principal = request.getUserPrincipal();
+ String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE);
+ if (principal != null) {
+ if (log.isDebugEnabled())
+ log.debug("Already authenticated '" + principal.getName() + "'");
+ // Associate the session with any existing SSO session
+ if (ssoId != null)
+ associate(ssoId, request.getSessionInternal(true));
+ return (true);
+ }
+
+ // Is there an SSO session against which we can try to reauthenticate?
+ if (ssoId != null) {
+ if (log.isDebugEnabled())
+ log.debug("SSO Id " + ssoId + " set; attempting " +
+ "reauthentication");
+ /* Try to reauthenticate using data cached by SSO. If this fails,
+ either the original SSO logon was of DIGEST or SSL (which
+ we can't reauthenticate ourselves because there is no
+ cached username and password), or the realm denied
+ the user's reauthentication for some reason.
+ In either case we have to prompt the user for a logon */
+ if (reauthenticateFromSSO(ssoId, request))
+ return true;
+ }
+
+ // Validate any credentials already included with this request
+ String username = null;
+ String password = null;
+
+ MessageBytes authorization =
+ request.getCoyoteRequest().getMimeHeaders()
+ .getValue("authorization");
+
+ if (authorization != null) {
+ authorization.toBytes();
+ ByteChunk authorizationBC = authorization.getByteChunk();
+ if (authorizationBC.startsWithIgnoreCase("basic ", 0)) {
+ authorizationBC.setOffset(authorizationBC.getOffset() + 6);
+ // FIXME: Add trimming
+ // authorizationBC.trim();
+
+ CharChunk authorizationCC = authorization.getCharChunk();
+ Base64.decode(authorizationBC, authorizationCC);
+
+ // Get username and password
+ int colon = authorizationCC.indexOf(':');
+ if (colon < 0) {
+ username = authorizationCC.toString();
+ } else {
+ char[] buf = authorizationCC.getBuffer();
+ username = new String(buf, 0, colon);
+ password = new String(buf, colon + 1,
+ buf.length - colon - 1);
+ }
+
+ authorizationBC.setOffset(authorizationBC.getOffset() - 6);
+ }
+ }
+
+ principal = context.getRealm().authenticate(username, password);
+ if (principal != null) {
+ register(request, response, principal, Constants.BASIC_METHOD,
+ username, password);
+ return (true);
+ }
+
+ // Send an "unauthorized" response and an appropriate challenge
+ MessageBytes authenticate =
+ response.getCoyoteResponse().getMimeHeaders()
+ .addValue(AUTHENTICATE_BYTES, 0, AUTHENTICATE_BYTES.length);
+ CharChunk authenticateCC = authenticate.getCharChunk();
+ authenticateCC.append("Basic realm=\"");
+ if (config.getRealmName() == null) {
+ authenticateCC.append(request.getServerName());
+ authenticateCC.append(':');
+ authenticateCC.append(Integer.toString(request.getServerPort()));
+ } else {
+ authenticateCC.append(config.getRealmName());
+ }
+ authenticateCC.append('\"');
+ authenticate.toChars();
+ response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+ //response.flushBuffer();
+ return (false);
+
+ }
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/authenticator/Constants.java b/container/catalina/src/share/org/apache/catalina/authenticator/Constants.java
new file mode 100644
index 0000000..7725997
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/authenticator/Constants.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.authenticator;
+
+
+public class Constants {
+
+ public static final String Package = "org.apache.catalina.authenticator";
+
+ // Authentication methods for login configuration
+ public static final String BASIC_METHOD = "BASIC";
+ public static final String CERT_METHOD = "CLIENT-CERT";
+ public static final String DIGEST_METHOD = "DIGEST";
+ public static final String FORM_METHOD = "FORM";
+
+ // User data constraints for transport guarantee
+ public static final String NONE_TRANSPORT = "NONE";
+ public static final String INTEGRAL_TRANSPORT = "INTEGRAL";
+ public static final String CONFIDENTIAL_TRANSPORT = "CONFIDENTIAL";
+
+ // Form based authentication constants
+ public static final String FORM_ACTION = "/j_security_check";
+ public static final String FORM_PASSWORD = "j_password";
+ public static final String FORM_USERNAME = "j_username";
+
+ // Cookie name for single sign on support
+ public static final String SINGLE_SIGN_ON_COOKIE = "JSESSIONIDSSO";
+
+
+ // --------------------------------------------------------- Request Notes
+
+
+ /**
+ * <p>If a user has been authenticated by the web layer, by means of a
+ * login method other than CLIENT_CERT, the username and password
+ * used to authenticate the user will be attached to the request as
+ * Notes for use by other server components. A server component can
+ * also call several existing methods on Request to determine whether
+ * or not any user has been authenticated:</p>
+ * <ul>
+ * <li><strong>request.getAuthType()</strong>
+ * will return BASIC, CLIENT-CERT, DIGEST, FORM, or <code>null</code>
+ * if there is no authenticated user.</li>
+ * <li><strong>request.getUserPrincipal()</strong>
+ * will return the authenticated <code>Principal</code> returned by the
+ * <code>Realm</code> that authenticated this user.</li>
+ * </ul>
+ * <p>If CLIENT_CERT authentication was performed, the certificate chain
+ * will be available as a request attribute, as defined in the
+ * servlet specification.</p>
+ */
+
+
+ /**
+ * The notes key for the password used to authenticate this user.
+ */
+ public static final String REQ_PASSWORD_NOTE =
+ "org.apache.catalina.request.PASSWORD";
+
+
+ /**
+ * The notes key for the username used to authenticate this user.
+ */
+ public static final String REQ_USERNAME_NOTE =
+ "org.apache.catalina.request.USERNAME";
+
+
+ /**
+ * The notes key to track the single-sign-on identity with which this
+ * request is associated.
+ */
+ public static final String REQ_SSOID_NOTE =
+ "org.apache.catalina.request.SSOID";
+
+
+ // ---------------------------------------------------------- Session Notes
+
+
+ /**
+ * If the <code>cache</code> property of our authenticator is set, and
+ * the current request is part of a session, authentication information
+ * will be cached to avoid the need for repeated calls to
+ * <code>Realm.authenticate()</code>, under the following keys:
+ */
+
+
+ /**
+ * The notes key for the password used to authenticate this user.
+ */
+ public static final String SESS_PASSWORD_NOTE =
+ "org.apache.catalina.session.PASSWORD";
+
+
+ /**
+ * The notes key for the username used to authenticate this user.
+ */
+ public static final String SESS_USERNAME_NOTE =
+ "org.apache.catalina.session.USERNAME";
+
+
+ /**
+ * The following note keys are used during form login processing to
+ * cache required information prior to the completion of authentication.
+ */
+
+
+ /**
+ * The previously authenticated principal (if caching is disabled).
+ */
+ public static final String FORM_PRINCIPAL_NOTE =
+ "org.apache.catalina.authenticator.PRINCIPAL";
+
+
+ /**
+ * The original request information, to which the user will be
+ * redirected if authentication succeeds.
+ */
+ public static final String FORM_REQUEST_NOTE =
+ "org.apache.catalina.authenticator.REQUEST";
+
+
+}
diff --git a/container/catalina/src/share/org/apache/catalina/authenticator/DigestAuthenticator.java b/container/catalina/src/share/org/apache/catalina/authenticator/DigestAuthenticator.java
new file mode 100644
index 0000000..0bcf1c8
--- /dev/null
+++ b/container/catalina/src/share/org/apache/catalina/authenticator/DigestAuthenticator.java
@@ -0,0 +1,459 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.authenticator;
+
+
+import java.io.IOException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.Principal;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.catalina.Realm;
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+import org.apache.catalina.deploy.LoginConfig;
+import org.apache.catalina.util.MD5Encoder;
+
+
+
+/**
+ * An <b>Authenticator</b> and <b>Valve</b> implementation of HTTP DIGEST
+ * Authentication (see RFC 2069).
+ *
+ * @author Craig R. McClanahan
+ * @author Remy Maucherat
+ * @version $Revision$ $Date$
+ */
+
+public class DigestAuthenticator
+ extends AuthenticatorBase {
+ private static Log log = LogFactory.getLog(DigestAuthenticator.class);
+
+
+ // -------------------------------------------------------------- Constants
+
+
+ /**
+ * Indicates that no once tokens are used only once.
+ */
+ protected static final int USE_ONCE = 1;
+
+
+ /**
+ * Indicates that no once tokens are used only once.
+ */
+ protected static final int USE_NEVER_EXPIRES = Integer.MAX_VALUE;
+
+
+ /**
+ * Indicates that no once tokens are used only once.
+ */
+ protected static final int TIMEOUT_INFINITE = Integer.MAX_VALUE;
+
+
+ /**
+ * The MD5 helper object for this class.
+ */
+ protected static final MD5Encoder md5Encoder = new MD5Encoder();
+
+
+ /**
+ * Descriptive information about this implementation.
+ */
+ protected static final String info =
+ "org.apache.catalina.authenticator.DigestAuthenticator/1.0";
+
+
+ // ----------------------------------------------------------- Constructors
+
+
+ public DigestAuthenticator() {
+ super();
+ try {
+ if (md5Helper == null)
+ md5Helper = MessageDigest.getInstance("MD5");
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ throw new IllegalStateException();
+ }
+ }
+
+
+ // ----------------------------------------------------- Instance Variables
+
+
+ /**
+ * MD5 message digest provider.
+ */
+ protected static MessageDigest md5Helper;
+
+
+ /**
+ * No once hashtable.
+ */
+ protected Hashtable nOnceTokens = new Hashtable();
+
+
+ /**
+ * No once expiration (in millisecond). A shorter amount would mean a
+ * better security level (since the token is generated more often), but at
+ * the expense of a bigger server overhead.
+ */
+ protected long nOnceTimeout = TIMEOUT_INFINITE;
+
+
+ /**
+ * No once expiration after a specified number of uses. A lower number
+ * would produce more overhead, since a token would have to be generated
+ * more often, but would be more secure.
+ */
+ protected int nOnceUses = USE_ONCE;
+
+
+ /**
+ * Private key.
+ */
+ protected String key = "Catalina";
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ /**
+ * Return descriptive information about this Valve implementation.
+ */
+ public String getInfo() {
+
+ return (info);
+
+ }
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Authenticate the user making this request, based on the specified
+ * login configuration. Return <code>true</code> if any specified
+ * constraint has been satisfied, or <code>false</code> if we have
+ * created a response challenge already.
+ *
+ * @param request Request we are processing
+ * @param response Response we are creating
+ * @param config Login configuration describing how authentication
+ * should be performed
+ *
+ * @exception IOException if an input/output error occurs
+ */
+ public boolean authenticate(Request request,
+ Response response,
+ LoginConfig config)
+ throws IOException {
+
+ // Have we already authenticated someone?
+ Principal principal = request.getUserPrincipal();
+ //String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE);
+ if (principal != null) {
+ if (log.isDebugEnabled())
+ log.debug("Already authenticated '" + principal.getName() + "'");
+ // Associate the session with any existing SSO session in order
+ // to get coordinated session invalidation at logout
+ String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE);
+ if (ssoId != null)
+ associate(ssoId, request.getSessionInternal(true));
+ return (true);
+ }
+
+ // NOTE: We don't try to reauthenticate using any existing SSO session,
+ // because that will only work if the original authentication was
+ // BASIC or FORM, which are less secure than the DIGEST auth-type
+ // specified for this webapp
+ //
+ // Uncomment below to allow previous FORM or BASIC authentications
+ // to authenticate users for this webapp
+ // TODO make this a configurable attribute (in SingleSignOn??)
+ /*
+ // Is there an SSO session against which we can try to reauthenticate?
+ if (ssoId != null) {
+ if (log.isDebugEnabled())
+ log.debug("SSO Id " + ssoId + " set; attempting " +
+ "reauthentication");
+ // Try to reauthenticate using data cached by SSO. If this fails,
+ // either the original SSO logon was of DIGEST or SSL (which
+ // we can't reauthenticate ourselves because there is no
+ // cached username and password), or the realm denied
+ // the user's reauthentication for some reason.
+ // In either case we have to prompt the user for a logon
+ if (reauthenticateFromSSO(ssoId, request))
+ return true;
+ }
+ */
+
+ // Validate any credentials already included with this request
+ String authorization = request.getHeader("authorization");
+ if (authorization != null) {
+ principal = findPrincipal(request, authorization, context.getRealm());
+ if (principal != null) {
+ String username = parseUsername(authorization);
+ register(request, response, principal,
+ Constants.DIGEST_METHOD,
+ username, null);
+ return (true);
+ }
+ }
+
+ // Send an "unauthorized" response and an appropriate challenge
+
+ // Next, generate a nOnce token (that is a token which is supposed
+ // to be unique).
+ String nOnce = generateNOnce(request);
+
+ setAuthenticateHeader(request, response, config, nOnce);
+ response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+ // hres.flushBuffer();
+ return (false);
+
+ }
+
+
+ // ------------------------------------------------------ Protected Methods
+
+
+ /**
+ * Parse the specified authorization credentials, and return the
+ * associated Principal that these credentials authenticate (if any)
+ * from the specified Realm. If there is no such Principal, return
+ * <code>null</code>.
+ *
+ * @param request HTTP servlet request
+ * @param authorization Authorization credentials from this request
+ * @param realm Realm used to authenticate Principals
+ */
+ protected static Principal findPrincipal(Request request,
+ String authorization,
+ Realm realm) {
+
+ //System.out.println("Authorization token : " + authorization);
+ // Validate the authorization credentials format
+ if (authorization == null)
+ return (null);
+ if (!authorization.startsWith("Digest "))
+ return (null);
+ authorization = authorization.substring(7).trim();
+
+
+ StringTokenizer commaTokenizer =
+ new StringTokenizer(authorization, ",");
+
+ String userName = null;
+ String realmName = null;
+ String nOnce = null;
+ String nc = null;
+ String cnonce = null;
+ String qop = null;
+ String uri = null;
+ String response = null;
+ String method = request.getMethod();
+
+ while (commaTokenizer.hasMoreTokens()) {
+ String currentToken = commaTokenizer.nextToken();
+ int equalSign = currentToken.indexOf('=');
+ if (equalSign < 0)
+ return null;
+ String currentTokenName =
+ currentToken.substring(0, equalSign).trim();
+ String currentTokenValue =
+ currentToken.substring(equalSign + 1).trim();
+ if ("username".equals(currentTokenName))
+ userName = removeQuotes(currentTokenValue);
+ if ("realm".equals(currentTokenName))
+ realmName = removeQuotes(currentTokenValue, true);
+ if ("nonce".equals(currentTokenName))
+ nOnce = removeQuotes(currentTokenValue);
+ if ("nc".equals(currentTokenName))
+ nc = removeQuotes(currentTokenValue);
+ if ("cnonce".equals(currentTokenName))
+ cnonce = removeQuotes(currentTokenValue);
+ if ("qop".equals(currentTokenName))
+ qop = removeQuotes(currentTokenValue);
+ if ("uri".equals(currentTokenName))
+ uri = removeQuotes(currentTokenValue);
+ if ("response".equals(currentTokenName))
+ response = removeQuotes(currentTokenValue);
+ }
+
+ if ( (userName == null) || (realmName == null) || (nOnce == null)
+ || (uri == null) || (response == null) )
+ return null;
+
+ // Second MD5 digest used to calculate the digest :
+ // MD5(Method + ":" + uri)
+ String a2 = method + ":" + uri;
+ //System.out.println("A2:" + a2);
+
+ String md5a2 = md5Encoder.encode(md5Helper.digest(a2.getBytes()));
+
+ return (realm.authenticate(userName, response, nOnce, nc, cnonce, qop,
+ realmName, md5a2));
+
+ }
+
+
+ /**
+ * Parse the username from the specified authorization string. If none
+ * can be identified, return <code>null</code>
+ *
+ * @param authorization Authorization string to be parsed
+ */
+ protected String parseUsername(String authorization) {
+
+ //System.out.println("Authorization token : " + authorization);
+ // Validate the authorization credentials format
+ if (authorization == null)
+ return (null);
+ if (!authorization.startsWith("Digest "))
+ return (null);
+ authorization = authorization.substring(7).trim();
+
+ StringTokenizer commaTokenizer =
+ new StringTokenizer(authorization, ",");
+
+ while (commaTokenizer.hasMoreTokens()) {
+ String currentToken = commaTokenizer.nextToken();
+ int equalSign = currentToken.indexOf('=');
+ if (equalSign < 0)
+ return null;
+ String currentTokenName =
+ currentToken.substring(0, equalSign).trim();
+ String currentTokenValue =
+ currentToken.substring(equalSign + 1).trim();
+ if ("username".equals(currentTokenName))
+ return (removeQuotes(currentTokenValue));
+ }
+
+ return (null);
+
+ }
+
+
+ /**
+ * Removes the quotes on a string. RFC2617 states quotes are optional for
+ * all parameters except realm.
+ */
+ protected static String removeQuotes(String quotedString,
+ boolean quotesRequired) {
+ //support both quoted and non-quoted
+ if (quotedString.length() > 0 && quotedString.charAt(0) != '"' &&
+ !quotesRequired) {
+ return quotedString;
+ } else if (quotedString.length() > 2) {
+ return quotedString.substring(1, quotedString.length() - 1);
+ } else {
+ return new String();
+ }
+ }
+
+ /**
+ * Removes the quotes on a string.
+ */
+ protected static String removeQuotes(String quotedString) {
+ return removeQuotes(quotedString, false);
+ }
+
+ /**
+ * Generate a unique token. The token is generated according to the
+ * following pattern. NOnceToken = Base64 ( MD5 ( client-IP ":"
+ * time-stamp ":" private-key ) ).
+ *
+ * @param request HTTP Servlet request
+ */
+ protected String generateNOnce(Request request) {
+
+ long currentTime = System.currentTimeMillis();
+
+ String nOnceValue = request.getRemoteAddr() + ":" +
+ currentTime + ":" + key;
+
+ byte[] buffer = md5Helper.digest(nOnceValue.getBytes());
+ nOnceValue = md5Encoder.encode(buffer);
+
+ // Updating the value in the no once hashtable
+ nOnceTokens.put(nOnceValue, new Long