remm        2005/05/12 02:29:54

  Modified:    catalina/src/share/org/apache/catalina/startup
                        HostConfig.java LocalStrings.properties
                        SetContextPropertiesRule.java
  Log:
  - 34840: Found a way to tweak behavior when using an external WAR.
  - Ignore docBase if the context is inside the host appBase, as it is 
duplicated by the context file name. Not doing so creates a mess in some cases.
  
  Revision  Changes    Path
  1.60      +20 -7     
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.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- HostConfig.java   14 Mar 2005 11:52:04 -0000      1.59
  +++ HostConfig.java   12 May 2005 09:29:54 -0000      1.60
  @@ -53,7 +53,6 @@
    * @author Remy Maucherat
    * @version $Revision$ $Date$
    */
  -
   public class HostConfig
       implements LifecycleListener {
       
  @@ -575,15 +574,27 @@
               context.setPath(contextPath);
               // Add the associated docBase to the redeployed list if it's a 
WAR
               boolean isWar = false;
  +            boolean isExternal = false;
               if (context.getDocBase() != null) {
                   File docBase = new File(context.getDocBase());
                   if (!docBase.isAbsolute()) {
                       docBase = new File(appBase(), context.getDocBase());
                   }
  -                deployedApp.redeployResources.put(docBase.getAbsolutePath(),
  +                // If external docBase, register .xml as redeploy first
  +                if 
(!docBase.getAbsolutePath().startsWith(appBase().getAbsolutePath())) {
  +                    isExternal = true;
  +                    deployedApp.redeployResources.put
  +                        (contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
  +                    
deployedApp.redeployResources.put(docBase.getAbsolutePath(),
                           new Long(docBase.lastModified()));
  -                if 
(docBase.getAbsolutePath().toLowerCase().endsWith(".war")) {
  -                    isWar = true;
  +                    if 
(docBase.getAbsolutePath().toLowerCase().endsWith(".war")) {
  +                        isWar = true;
  +                    }
  +                } else {
  +                    
log.warn(sm.getString("hostConfig.deployDescriptor.localDocBaseSpecified",
  +                             docBase));
  +                    // Ignore specified docBase
  +                    context.setDocBase(null);
                   }
               }
               host.addChild(context);
  @@ -628,8 +639,10 @@
                       addWatchedResources(deployedApp, null, context);
                   }
                   // Add the context XML to the list of files which should 
trigger a redeployment
  -                deployedApp.redeployResources.put
  -                    (contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
  +                if (!isExternal) {
  +                    deployedApp.redeployResources.put
  +                        (contextXml.getAbsolutePath(), new 
Long(contextXml.lastModified()));
  +                }
               }
           } catch (Throwable t) {
               log.error(sm.getString("hostConfig.deployDescriptor.error",
  
  
  
  1.15      +1 -0      
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- LocalStrings.properties   15 Feb 2005 15:42:58 -0000      1.14
  +++ LocalStrings.properties   12 May 2005 09:29:54 -0000      1.15
  @@ -47,6 +47,7 @@
   hostConfig.deploy=Deploying web application directory {0}
   hostConfig.deployDescriptor=Deploying configuration descriptor {0}
   hostConfig.deployDescriptor.error=Error deploying configuration descriptor 
{0}
  +hostConfig.deployDescriptor.localDocBaseSpecified=A docBase {0} inside the 
host appBase has been specified, and will be ignored
   hostConfig.deployDir=Deploying web application directory {0}
   hostConfig.deployDir.error=Error deploying web application directory {0}
   hostConfig.deployJar=Deploying web application archive {0}
  
  
  
  1.2       +1 -1      
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/SetContextPropertiesRule.java
  
  Index: SetContextPropertiesRule.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/SetContextPropertiesRule.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SetContextPropertiesRule.java     23 Sep 2004 06:58:52 -0000      1.1
  +++ SetContextPropertiesRule.java     12 May 2005 09:29:54 -0000      1.2
  @@ -55,7 +55,7 @@
               if ("".equals(name)) {
                   name = attributes.getQName(i);
               }
  -            if ("path".equals(name)) {
  +            if ("path".equals(name) || "docBase".equals(name)) {
                   continue;
               }
               String value = attributes.getValue(i);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to