--- HostConfig.java 2007-05-04 22:43:38.000000000 -0300 +++ HostConfig2.java 2007-11-06 02:51:43.421875000 -0400 @@ -1,3 +1,4 @@ +package org.apache.catalina.startup; /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -15,23 +16,21 @@ * limitations under the License. */ - -package org.apache.catalina.startup; - - import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.jar.JarEntry; import java.util.jar.JarFile; import javax.management.ObjectName; - +import org.apache.catalina.core.StandardContext; +import org.apache.catalina.core.StandardHost; import org.apache.catalina.Container; import org.apache.catalina.Context; import org.apache.catalina.Engine; @@ -39,8 +38,9 @@ import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleEvent; import org.apache.catalina.LifecycleListener; +import org.apache.catalina.startup.Constants; +import org.apache.catalina.startup.ExpandWar; import org.apache.catalina.core.ContainerBase; -import org.apache.catalina.core.StandardHost; import org.apache.catalina.util.StringManager; import org.apache.tomcat.util.digester.Digester; import org.apache.tomcat.util.modeler.Registry; @@ -636,11 +636,15 @@ name = path; } } - File expandedDocBase = new File(name); - File warDocBase = new File(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()) { - expandedDocBase = new File(appBase(), name); - warDocBase = new File(appBase(), name + ".war"); + // 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 +656,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 +971,11 @@ if (docBase != null) { resource = new File(docBaseFile, watchedResources[i]); } else { + log.debug("Ignoring non-existent WatchedResource '" + resource.getAbsolutePath() + "'"); continue; } } + log.debug("Watching WatchedResource '" + resource.getAbsolutePath() + "'"); app.reloadResources.put(resource.getAbsolutePath(), new Long(resource.lastModified())); } @@ -1329,3 +1336,4 @@ } } +