Author: rmannibucau
Date: Thu Oct 17 15:27:45 2013
New Revision: 1533118

URL: http://svn.apache.org/r1533118
Log:
TOMEE-1059 applying Loïc Rodier patch to support custom tomcat context through 
Arquillian + ears. Thanks Loïc

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

Modified: 
tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
URL: 
http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java?rev=1533118&r1=1533117&r2=1533118&view=diff
==============================================================================
--- 
tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
 (original)
+++ 
tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
 Thu Oct 17 15:27:45 2013
@@ -444,6 +444,10 @@ public class TomcatWebAppBuilder impleme
                 }
             }
 
+            if (getContextInfo(webApp.host, webApp.contextRoot) != null) {
+                continue;
+            }
+
             StandardContext standardContext;
             if (contextXml != null) {
                 synchronized (CONTEXT_DIGESTER) {
@@ -458,11 +462,17 @@ public class TomcatWebAppBuilder impleme
                     }
                 }
             } else {
-                standardContext = new StandardContext();
-            }
-
-            if (getContextInfo(webApp.host, webApp.contextRoot) != null) {
-                continue;
+                final Host host = hosts.get(defaultHost);
+                if (StandardHost.class.isInstance(host)) {
+                    try {
+                        standardContext = 
StandardContext.class.cast(ParentClassLoaderFinder.Helper.get().loadClass(StandardHost.class.cast(host).getContextClass()).newInstance());
+                    } catch (final Throwable th) {
+                        logger.warning("Can't use context class specified, 
using default StandardContext", th);
+                        standardContext = new StandardContext();
+                    }
+                } else {
+                    standardContext = new StandardContext();
+                }
             }
 
             if (standardContext.getPath() != null) {


Reply via email to