tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject svn commit: r394930 - in /tomcat/container/tc5.5.x: catalina/src/share/org/apache/catalina/core/ catalina/src/share/org/apache/catalina/startup/ modules/storeconfig/src/share/org/apache/catalina/storeconfig/ webapps/docs/
Date Tue, 18 Apr 2006 12:59:12 GMT
Author: pero
Date: Tue Apr 18 05:59:06 2006
New Revision: 394930

URL: http://svn.apache.org/viewcvs?rev=394930&view=rev
Log:
Make sure that StoreConfig save external referenced war files at context.xml correct.

Modified:
    tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardContext.java
    tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml
    tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/ContextConfig.java
    tomcat/container/tc5.5.x/modules/storeconfig/src/share/org/apache/catalina/storeconfig/StoreAppender.java
    tomcat/container/tc5.5.x/modules/storeconfig/src/share/org/apache/catalina/storeconfig/StoreContextAppender.java
    tomcat/container/tc5.5.x/modules/storeconfig/src/share/org/apache/catalina/storeconfig/server-registry.xml
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml

Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardContext.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardContext.java?rev=394930&r1=394929&r2=394930&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardContext.java
(original)
+++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardContext.java
Tue Apr 18 05:59:06 2006
@@ -332,6 +332,11 @@
 
 
     /**
+     * The original document root for this web application.
+     */
+    private String originalDocBase = null;
+
+    /**
      * The exception pages for this web application, keyed by fully qualified
      * class name of the Java exception.
      */
@@ -1241,6 +1246,28 @@
 
     }
 
+    /**
+     * Return the original document root for this Context.  This can be an absolute
+     * pathname, a relative pathname, or a URL.
+     * Is only set as deployment has change docRoot!
+     */
+    public String getOriginalDocBase() {
+
+        return (this.originalDocBase);
+
+    }
+
+    /**
+     * Set the original document root for this Context.  This can be an absolute
+     * pathname, a relative pathname, or a URL.
+     *
+     * @param docBase The orginal document root
+     */
+    public void setOriginalDocBase(String docBase) {
+
+        this.originalDocBase = docBase;
+    }
+    
     // experimental
     public boolean isLazy() {
         return lazy;

Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml?rev=394930&r1=394929&r2=394930&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml
(original)
+++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml
Tue Apr 18 05:59:06 2006
@@ -129,6 +129,10 @@
                description="Name of the object"
                type="java.lang.String"/>
       
+    <attribute name="originalDocBase"
+               description="The original document root for this web application"
+               type="java.lang.String"/>
+
     <attribute name="override"
                description="The DefaultContext override flag for this web application"
                type="boolean"/>

Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/ContextConfig.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/ContextConfig.java?rev=394930&r1=394929&r2=394930&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/ContextConfig.java
(original)
+++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/ContextConfig.java
Tue Apr 18 05:59:06 2006
@@ -858,7 +858,8 @@
             docBase = file.getCanonicalPath();
         }
         file = new File(docBase);
-
+        String origDocBase = docBase ;
+ 
         if (docBase.toLowerCase().endsWith(".war") && !file.isDirectory() &&
unpackWARs) {
             URL war = new URL("jar:" + (new File(docBase)).toURL() + "!/");
             String contextPath = context.getPath();
@@ -868,6 +869,9 @@
             docBase = ExpandWar.expand(host, war, contextPath);
             file = new File(docBase);
             docBase = file.getCanonicalPath();
+            if (context instanceof StandardContext) {
+                ((StandardContext) context).setOriginalDocBase(origDocBase);
+            }
         } else {
             File docDir = new File(docBase);
             if (!docDir.exists()) {
@@ -881,6 +885,9 @@
                     } else {
                         docBase = warFile.getCanonicalPath();
                     }
+                }
+                if (context instanceof StandardContext) {
+                    ((StandardContext)context).setOriginalDocBase(origDocBase);
                 }
             }
         }

Modified: tomcat/container/tc5.5.x/modules/storeconfig/src/share/org/apache/catalina/storeconfig/StoreAppender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/storeconfig/src/share/org/apache/catalina/storeconfig/StoreAppender.java?rev=394930&r1=394929&r2=394930&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/storeconfig/src/share/org/apache/catalina/storeconfig/StoreAppender.java
(original)
+++ tomcat/container/tc5.5.x/modules/storeconfig/src/share/org/apache/catalina/storeconfig/StoreAppender.java
Tue Apr 18 05:59:06 2006
@@ -254,8 +254,7 @@
                 // The property has its default value
                 continue;
             }
-            if (isPrintValue(bean, bean2, descriptors[i].getName(), desc))
-                printValue(writer, indent, descriptors[i].getName(), value);
+            printAttribute(writer, indent, bean, desc, descriptors[i].getName(), bean2, value);
         }
 
         if (bean instanceof ResourceBase) {
@@ -273,6 +272,20 @@
 
             }
         }
+    }
+
+    /**
+     * @param writer
+     * @param indent
+     * @param bean
+     * @param desc
+     * @param attributeName
+     * @param bean2
+     * @param value
+     */
+    protected void printAttribute(PrintWriter writer, int indent, Object bean, StoreDescription
desc, String attributeName, Object bean2, Object value) {
+        if (isPrintValue(bean, bean2, attributeName, desc))
+            printValue(writer, indent, attributeName, value);
     }
 
     /**

Modified: tomcat/container/tc5.5.x/modules/storeconfig/src/share/org/apache/catalina/storeconfig/StoreContextAppender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/storeconfig/src/share/org/apache/catalina/storeconfig/StoreContextAppender.java?rev=394930&r1=394929&r2=394930&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/storeconfig/src/share/org/apache/catalina/storeconfig/StoreContextAppender.java
(original)
+++ tomcat/container/tc5.5.x/modules/storeconfig/src/share/org/apache/catalina/storeconfig/StoreContextAppender.java
Tue Apr 18 05:59:06 2006
@@ -17,6 +17,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.io.PrintWriter;
 
 import org.apache.catalina.Container;
 import org.apache.catalina.core.StandardContext;
@@ -34,6 +35,28 @@
 
     private static Log log = LogFactory.getLog(StoreContextAppender.class);
 
+    /**
+     * @param writer
+     * @param indent
+     * @param bean
+     * @param desc
+     * @param attributeName
+     * @param bean2
+     * @param value
+     */
+    protected void printAttribute(PrintWriter writer, int indent, Object bean, StoreDescription
desc, String attributeName, Object bean2, Object value) {
+        if (isPrintValue(bean, bean2, attributeName, desc)) {
+            if(attributeName.equals("docBase")) {
+                if(bean instanceof StandardContext) {
+                    String docBase = ((StandardContext)bean).getOriginalDocBase() ;
+                    if(docBase != null)
+                        value = docBase ;
+                }
+            }
+            printValue(writer, indent, attributeName, value);
+        }
+    }
+
     /*
      * Print Context Values. <ul><li> Spezial handling to default workDir.
      * </li><li> Don't save path at external context.xml </li><li>
Don't
@@ -86,9 +109,12 @@
     protected File getDocBase(StandardContext context, File appBase) {
 
         File docBase;
-        File file = new File(context.getDocBase());
+        String contextDocBase = context.getOriginalDocBase() ;
+        if(contextDocBase == null)
+            contextDocBase = context.getDocBase() ;
+        File file = new File(contextDocBase);
         if (!file.isAbsolute())
-            file = new File(appBase, context.getDocBase());
+            file = new File(appBase, contextDocBase);
         try {
             docBase = file.getCanonicalFile();
         } catch (IOException e) {

Modified: tomcat/container/tc5.5.x/modules/storeconfig/src/share/org/apache/catalina/storeconfig/server-registry.xml
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/storeconfig/src/share/org/apache/catalina/storeconfig/server-registry.xml?rev=394930&r1=394929&r2=394930&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/storeconfig/src/share/org/apache/catalina/storeconfig/server-registry.xml
(original)
+++ tomcat/container/tc5.5.x/modules/storeconfig/src/share/org/apache/catalina/storeconfig/server-registry.xml
Tue Apr 18 05:59:06 2006
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<Registry name="Tomcat" version="5.5.5" encoding="UTF-8" >
+<Registry name="Tomcat" version="5.5.18" encoding="UTF-8" >
      <Description
 	    tag="Server"
 		standard="true"
@@ -55,6 +55,7 @@
 	    <TransientAttribute>engineName</TransientAttribute>
 	    <TransientAttribute>name</TransientAttribute>
 	    <TransientAttribute>publicId</TransientAttribute>
+	    <TransientAttribute>originalDocBase</TransientAttribute>	    
 	    <TransientAttribute>replaceWelcomeFiles</TransientAttribute>
 	    <TransientAttribute>saveConfig</TransientAttribute>
 	    <TransientAttribute>sessionTimeout</TransientAttribute>

Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?rev=394930&r1=394929&r2=394930&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Tue Apr 18 05:59:06 2006
@@ -24,6 +24,13 @@
       </update>
     </changelog>
   </subsection>
+  <subsection name="Webapps">
+    <changelog>
+      <fix>
+        <bug>37781</bug>: Make sure that StoreConfig save external referenced
war files at context.xml correct. (pero)
+      </fix>
+    </changelog>
+  </subsection> 
 </section>
 
 <section name="Tomcat 5.5.17 (yoavs)">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message