remm 2004/07/27 03:04:39 Modified: catalina/src/share/org/apache/catalina/startup HostConfig.java ContextConfig.java Log: - Add support for override flag in ContextConfig: none of the default context files will be parsed. This flag will only be used if the context has a config file with override="true" in conf/engine/host, because the one in /META-INF/context.xml will be parsed later on. - Improve support for resource watching. - Add the default context files to the monitor list for all contexts. Revision Changes Path 1.39 +19 -5 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java Index: HostConfig.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- HostConfig.java 27 Jul 2004 07:17:21 -0000 1.38 +++ HostConfig.java 27 Jul 2004 10:04:39 -0000 1.39 @@ -600,6 +600,8 @@ deployedApp.redeployResources.put(docBase.getAbsolutePath(), new Long(docBase.lastModified())); addWatchedResources(deployedApp, docBase.getAbsolutePath(), context); + } else { + addWatchedResources(deployedApp, null, context); } } catch (Throwable t) { log.error(sm.getString("hostConfig.deployDescriptor.error", @@ -767,6 +769,8 @@ deployedApp.redeployResources.put(docBase.getAbsolutePath(), new Long(docBase.lastModified())); addWatchedResources(deployedApp, docBase.getAbsolutePath(), context); + } else { + addWatchedResources(deployedApp, null, context); } } catch (Throwable t) { log.error(sm.getString("hostConfig.deployJar.error", file), t); @@ -871,13 +875,23 @@ protected void addWatchedResources(DeployedApplication app, String docBase, Context context) { // FIXME: Feature idea. Add support for patterns (ex: WEB-INF/*, WEB-INF/*.xml), where // we would only check if at least one resource is newer than app.timestamp - File docBaseFile = new File(docBase); - if (!docBaseFile.isAbsolute()) { - docBaseFile = new File(appBase(), docBase); + File docBaseFile = null; + if (docBase != null) { + docBaseFile = new File(docBase); + if (!docBaseFile.isAbsolute()) { + docBaseFile = new File(appBase(), docBase); + } } String[] watchedResources = context.findWatchedResources(); for (int i = 0; i < watchedResources.length; i++) { - File resource = new File(docBaseFile, watchedResources[i]); + File resource = new File(watchedResources[i]); + if (!resource.isAbsolute()) { + if (docBase != null) { + resource = new File(docBaseFile, watchedResources[i]); + } else { + continue; + } + } app.reloadResources.put(resource.getAbsolutePath(), new Long(resource.lastModified())); } 1.51 +11 -8 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.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- ContextConfig.java 26 Jul 2004 15:54:38 -0000 1.50 +++ ContextConfig.java 27 Jul 2004 10:04:39 -0000 1.51 @@ -589,8 +589,10 @@ protected void contextConfig() { // FIXME: Externalize default context.xml path the same way as web.xml - processContextConfig(new File(getBaseDir(), "conf/context.xml")); - processContextConfig(new File(getConfigBase(), "context.xml.default")); + if (!context.getOverride()) { + processContextConfig(new File(getBaseDir(), "conf/context.xml")); + processContextConfig(new File(getConfigBase(), "context.xml.default")); + } if (context.getConfigFile() != null) processContextConfig(new File(context.getConfigFile())); @@ -601,8 +603,14 @@ * Process a context.xml. */ protected void processContextConfig(File file) { + if (log.isDebugEnabled()) log.debug("Processing context [" + context.getName() + "] configuration file " + file); + + // Add as watched resource so that cascade reload occurs if a default + // config file is modified/added/removed + context.addWatchedResource(file.getAbsolutePath()); + InputSource source = null; InputStream stream = null; try { @@ -856,8 +864,6 @@ Container container = context.getParent(); if( !context.getOverride() ) { if( container instanceof Host ) { - ((Host)container).importDefaultContext(context); - // Reset the value only if the attribute wasn't // set on the context. xmlValidation = context.getXmlValidation(); @@ -872,9 +878,6 @@ } container = container.getParent(); - } - if( container instanceof Engine ) { - ((Engine)container).importDefaultContext(context); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]