tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1531198 - /tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/Contexts.java
Date Fri, 11 Oct 2013 05:26:48 GMT
Author: rmannibucau
Date: Fri Oct 11 05:26:48 2013
New Revision: 1531198

URL: http://svn.apache.org/r1531198
Log:
TOMEE-1055 completing docBase find algorithm

Modified:
    tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/Contexts.java

Modified: tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/Contexts.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/Contexts.java?rev=1531198&r1=1531197&r2=1531198&view=diff
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/Contexts.java
(original)
+++ tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/Contexts.java
Fri Oct 11 05:26:48 2013
@@ -23,6 +23,7 @@ import org.apache.catalina.Host;
 import org.apache.catalina.core.StandardContext;
 import org.apache.catalina.core.StandardEngine;
 import org.apache.catalina.core.StandardHost;
+import org.apache.catalina.util.ContextName;
 
 import java.io.File;
 
@@ -42,7 +43,7 @@ public class Contexts {
     public static File warPath(final Context standardContext) {
         final File file = realWarPath(standardContext);
         if (file == null) {
-            return file;
+            return null;
         }
 
         final String name = file.getName();
@@ -69,20 +70,29 @@ public class Contexts {
             container = container.getParent();
         }
 
-        File file = new File(standardContext.getDocBase());
-        if (!file.isAbsolute()) {
-            if (container == null) {
-                docBase = new File(engineBase(standardContext), standardContext.getDocBase());
-            } else {
-                final String appBase = ((Host) container).getAppBase();
-                file = new File(appBase);
-                if (!file.isAbsolute()) {
-                    file = new File(engineBase(standardContext), appBase);
+        if (standardContext.getDocBase() != null) {
+            File file = new File(standardContext.getDocBase());
+            if (!file.isAbsolute()) {
+                if (container == null) {
+                    docBase = new File(engineBase(standardContext), standardContext.getDocBase());
+                } else {
+                    final String appBase = ((Host) container).getAppBase();
+                    file = new File(appBase);
+                    if (!file.isAbsolute()) {
+                        file = new File(engineBase(standardContext), appBase);
+                    }
+                    docBase = new File(file, standardContext.getDocBase());
                 }
-                docBase = new File(file, standardContext.getDocBase());
+            } else {
+                docBase = file;
             }
         } else {
-            docBase = file;
+            final String path = standardContext.getPath();
+            if (path == null) {
+                throw new IllegalStateException("Can't find docBase");
+            } else {
+                docBase = new File(new ContextName(path, standardContext.getWebappVersion()).getBaseName());
+            }
         }
 
         if (!docBase.exists()) { // for old compatibility, will be removed soon



Mime
View raw message