Author: pero Date: Mon Jan 21 00:27:41 2008 New Revision: 613792 URL: http://svn.apache.org/viewvc?rev=613792&view=rev Log: WatchedResource doesn't work if app is outside host appbase webapps
Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/HostConfig.java tomcat/container/tc5.5.x/webapps/docs/changelog.xml Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/HostConfig.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/HostConfig.java?rev=613792&r1=613791&r2=613792&view=diff ============================================================================== --- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/HostConfig.java (original) +++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/HostConfig.java Mon Jan 21 00:27:41 2008 @@ -636,11 +636,16 @@ name = path; } } - File expandedDocBase = new File(name); - File warDocBase = new File(name + ".war"); - if (!expandedDocBase.isAbsolute()) { - expandedDocBase = new File(appBase(), name); - warDocBase = new File(appBase(), name + ".war"); + + // default to appBase dir + name + File expandedDocBase = new File(appBase(), name); + if (context.getDocBase() != null) { + // first assume docBase is absolute + expandedDocBase = new File(context.getDocBase()); + if (!expandedDocBase.isAbsolute()) { + // if docBase specified and relative, it must be relative to appBase + expandedDocBase = new File(appBase(), context.getDocBase()); + } } // Add the eventual unpacked WAR and all the resources which will be // watched inside it @@ -652,6 +657,7 @@ addWatchedResources(deployedApp, expandedDocBase.getAbsolutePath(), context); } else { // Find an existing matching war and expanded folder + File warDocBase = new File(expandedDocBase.getAbsolutePath() + ".war"); if (warDocBase.exists()) { deployedApp.redeployResources.put(warDocBase.getAbsolutePath(), new Long(warDocBase.lastModified())); @@ -966,9 +972,14 @@ if (docBase != null) { resource = new File(docBaseFile, watchedResources[i]); } else { + if(log.isDebugEnabled()) + log.debug("Ignoring non-existent WatchedResource '" + + resource.getAbsolutePath() + "'"); continue; } } + if(log.isDebugEnabled()) + log.debug("Watching WatchedResource '" + resource.getAbsolutePath() + "'"); app.reloadResources.put(resource.getAbsolutePath(), new Long(resource.lastModified())); } Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?rev=613792&r1=613791&r2=613792&view=diff ============================================================================== --- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original) +++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Mon Jan 21 00:27:41 2008 @@ -96,6 +96,9 @@ </subsection> <subsection name="Catalina"> <changelog> + <fix><bug>38131</bug>: WatchedResource doesn't work if app is outside host appbase webapps. + Patch provided by Gernot Pfingstl (pero) + </fix> <fix> Set correct sessionCounter at StandardManager after reload sessions. (pero) </fix> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]