remm 2004/09/01 15:55:48 Modified: catalina/src/share/org/apache/catalina/core StandardContext.java mbeans-descriptors.xml catalina/src/share/org/apache/catalina/startup ContextConfig.java Constants.java Log: - Allow configuring the default context.xml. - Remove old descriptors. Revision Changes Path 1.145 +25 -6 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.144 retrieving revision 1.145 diff -u -r1.144 -r1.145 --- StandardContext.java 31 Aug 2004 15:07:23 -0000 1.144 +++ StandardContext.java 1 Sep 2004 22:55:48 -0000 1.145 @@ -280,8 +280,13 @@ /** - * Override the default web xml location. ContextConfig is not configurable - * so the setter is not used. + * Override the default context xml location. + */ + private String defaultContextXml; + + + /** + * Override the default web xml location. */ private String defaultWebXml; @@ -1044,15 +1049,29 @@ } + public String getDefaultContextXml() { + return defaultContextXml; + } + + /** + * Set the location of the default context xml that will be used. + * If not absolute, it'll be made relative to the engine's base dir + * ( which defaults to catalina.base system property ). + * + * @param defaultWebXml The default web xml + */ + public void setDefaultContextXml(String defaultContextXml) { + this.defaultContextXml = defaultContextXml; + } + public String getDefaultWebXml() { return defaultWebXml; } - /** Set the location of the default web xml that will be used. + /** + * Set the location of the default web xml that will be used. * If not absolute, it'll be made relative to the engine's base dir * ( which defaults to catalina.base system property ). - * - * XXX If a file is not found - we can attempt a getResource() * * @param defaultWebXml The default web xml */ 1.33 +4 -103 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml Index: mbeans-descriptors.xml =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- mbeans-descriptors.xml 29 Jul 2004 06:22:52 -0000 1.32 +++ mbeans-descriptors.xml 1 Sep 2004 22:55:48 -0000 1.33 @@ -1,109 +1,6 @@ <?xml version="1.0"?> <mbeans-descriptors> - <mbean name="DefaultContext" - description="Used to store the default configuration a Host will use when creating a Context" - domain="Catalina" - group="Default-Context" - type="org.apache.catalina.core.StandardDefaultContext"> - - <attribute name="allowLinking" - description="Allow symlinking to outside the webapp root directory, if the webapp is an exploded directory" - is="true" - type="boolean"/> - - <attribute name="cacheMaxSize" - description="Maximum cache size in KB" - type="int"/> - - <attribute name="cacheTTL" - description="Time interval in ms between cache refeshes" - type="int"/> - - <attribute name="cachingAllowed" - description="Should we cache static resources for this webapp" - is="true" - type="boolean"/> - - <attribute name="caseSensitive" - description="Should case sensitivity checks be performed" - is="true" - type="boolean"/> - - <attribute name="cookies" - description="Should we attempt to use cookies for session id communication?" - type="boolean"/> - - <attribute name="crossContext" - description="Should we allow the ServletContext.getContext() method to access the context of other web applications in this server?" - type="boolean"/> - - <attribute name="managerChecksFrequency" - description="The frequency of the manager checks (expiration and passivation)" - type="int"/> - - <attribute name="reloadable" - description="The reloadable flag for this web application" - type="boolean"/> - - <attribute name="swallowOutput" - description="Flag to set to cause the system.out and system.err to be redirected to the logger when executing a servlet" - type="boolean"/> - - <attribute name="useNaming" - description="Create JNDI naming context?" - is="true" - type="boolean"/> - - <attribute name="resourceNames" - description="Object names for the resources" - is="true" - type="[Ljava.lang.String;"/> - - <operation name="addEnvironment" - description="Add an environment entry for this web application" - impact="ACTION" - returnType="void"> - <parameter name="envName" - description="New environment entry name" - type="java.lang.String"/> - <parameter name="type" - description="Type of entry" - type="java.lang.String" /> - </operation> - - <operation name="addResource" - description="Add a resource reference for this web application" - impact="ACTION" - returnType="void"> - <parameter name="resourceName" - description="New resource reference name" - type="java.lang.String"/> - <parameter name="type" - description="Type of resource" - type="java.lang.String" /> - </operation> - - <operation name="removeEnvironment" - description="Remove any environment entry with the specified name" - impact="ACTION" - returnType="void"> - <parameter name="envName" - description="Name of the environment entry to remove" - type="java.lang.String"/> - </operation> - - <operation name="removeResource" - description="Remove any resource reference with the specified name" - impact="ACTION" - returnType="void"> - <parameter name="resourceName" - description="Name of the resource reference to remove" - type="java.lang.String"/> - </operation> - - </mbean> - <mbean name="NamingContextListener" description="Helper class used to initialize and populate the JNDI context associated with each context and server" domain="Catalina" @@ -171,6 +68,10 @@ description="Should we allow the ServletContext.getContext() method to access the context of other web applications in this server?" type="boolean"/> + <attribute name="defaultContextXml" + description="Location of the default context.xml resource or file" + type="java.lang.String"/> + <attribute name="defaultWebXml" description="Location of the default web.xml resource or file" type="java.lang.String"/> 1.52 +39 -5 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextConfig.java Index: ContextConfig.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v retrieving revision 1.51 retrieving revision 1.52 diff -u -r1.51 -r1.52 --- ContextConfig.java 27 Jul 2004 10:04:39 -0000 1.51 +++ ContextConfig.java 1 Sep 2004 22:55:48 -0000 1.52 @@ -87,6 +87,12 @@ /** + * The default web application's context file location. + */ + protected String defaultContextXml = null; + + + /** * The default web application's deployment descriptor location. */ protected String defaultWebXml = null; @@ -179,6 +185,28 @@ } + /** + * Return the location of the default context file + */ + public String getDefaultContextXml() { + if( defaultContextXml == null ) defaultContextXml=Constants.DefaultContextXml; + return (this.defaultContextXml); + + } + + + /** + * Set the location of the default context file + * + * @param path Absolute/relative path to the default context.xml + */ + public void setDefaultContextXml(String path) { + + this.defaultContextXml = path; + + } + + // --------------------------------------------------------- Public Methods @@ -517,7 +545,7 @@ stream = null; source = null; - file = new File(getConfigBase(), "web.xml.default"); + file = new File(getConfigBase(), Constants.HostWebXml); try { if (file.exists()) { @@ -588,10 +616,16 @@ */ protected void contextConfig() { - // FIXME: Externalize default context.xml path the same way as web.xml + // Open the default web.xml file, if it exists + if( defaultContextXml==null && context instanceof StandardContext ) { + defaultContextXml = ((StandardContext)context).getDefaultContextXml(); + } + // set the default if we don't have any overrides + if( defaultContextXml==null ) getDefaultContextXml(); + if (!context.getOverride()) { - processContextConfig(new File(getBaseDir(), "conf/context.xml")); - processContextConfig(new File(getConfigBase(), "context.xml.default")); + processContextConfig(new File(getBaseDir(), defaultContextXml)); + processContextConfig(new File(getConfigBase(), Constants.HostContextXml)); } if (context.getConfigFile() != null) processContextConfig(new File(context.getConfigFile())); 1.8 +4 -5 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Constants.java Index: Constants.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/Constants.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Constants.java 27 Feb 2004 14:58:48 -0000 1.7 +++ Constants.java 1 Sep 2004 22:55:48 -0000 1.8 @@ -31,7 +31,10 @@ public static final String Package = "org.apache.catalina.startup"; public static final String ApplicationWebXml = "/WEB-INF/web.xml"; + public static final String DefaultContextXml = "conf/context.xml"; public static final String DefaultWebXml = "conf/web.xml"; + public static final String HostContextXml = "context.xml.default"; + public static final String HostWebXml = "web.xml.default"; public static final String TldDtdPublicId_11 = "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"; @@ -87,9 +90,5 @@ "j2ee_web_services_client_1_1.xsd"; public static final String J2eeWebServiceClientSchemaResourcePath_11 = "/javax/servlet/resources/j2ee_web_services_client_1_1.xsd"; - - - - }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]