You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2014/10/21 20:21:40 UTC

git commit: supporting configuration of single jar as enrichment in context.xml, we'll surely need few adjustment for folders

Repository: tomee
Updated Branches:
  refs/heads/develop 0fa7c940a -> dc93d6ce3


supporting configuration of single jar as enrichment in context.xml, we'll surely need few adjustment for folders


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/dc93d6ce
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/dc93d6ce
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/dc93d6ce

Branch: refs/heads/develop
Commit: dc93d6ce3942dfd051073c0e2f5cb6ab21fdac17
Parents: 0fa7c94
Author: Romain Manni-Bucau <rm...@apache.org>
Authored: Tue Oct 21 20:21:14 2014 +0200
Committer: Romain Manni-Bucau <rm...@apache.org>
Committed: Tue Oct 21 20:21:14 2014 +0200

----------------------------------------------------------------------
 .../tomee/catalina/TomcatWebAppBuilder.java     | 54 +++++++++-----------
 1 file changed, 24 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/dc93d6ce/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
index 9332a42..baa284c 100644
--- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
+++ b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
@@ -2087,40 +2087,34 @@ public class TomcatWebAppBuilder implements WebAppBuilder, ContextListener, Pare
 
             final Collection<String> cp = new LinkedList<>();
 
-            final String name = loader.getClass().getName();
-            // no more in tomcat 8 but keep it while we maintain t7 integration
-            if ("org.apache.catalina.loader.VirtualWebappLoader".equals(name)
-                    || "org.apache.tomee.catalina.ProvisioningWebappLoader".equals(name)) {
-                final Object virtualClasspath = Reflections.get(loader, "virtualClasspath");
-                if (virtualClasspath != null) {
-                    for (final String str : virtualClasspath.toString().split(";")) {
-                        cp.addAll(ProvisioningUtil.realLocation(str));
-                    }
-                }
-            } else {
-                final WebResourceRoot webResources = standardContext.getResources();
-                if (webResources != null) { // to enhance
-                    for (final WebResourceSet[] sets : asList(webResources.getPreResources(), webResources.getPostResources(), webResources.getJarResources())) {
-                        for (final WebResourceSet wr : sets) {
-                            final URL base = wr.getBaseUrl();
-                            if (base != null) {
-                                final File baseFile = URLs.toFile(base);
-                                if (baseFile.isDirectory()) {
-                                    final String[] libs = wr.list("/WEB-INF/lib/");
-                                    if (libs != null) {
-                                        for (final String resource : libs) {
-                                            cp.add(new File(baseFile, resource).getAbsolutePath());
-                                        }
+            final WebResourceRoot webResources = standardContext.getResources();
+            if (webResources != null) { // to enhance
+                for (final WebResourceSet[] sets : asList(webResources.getPreResources(), webResources.getPostResources(), webResources.getJarResources())) {
+                    for (final WebResourceSet wr : sets) {
+                        final URL base = wr.getBaseUrl();
+                        if (base != null) {
+                            final File baseFile = URLs.toFile(base);
+                            if (baseFile.isDirectory()) {
+                                final String[] libs = wr.list("/WEB-INF/lib/");
+                                if (libs != null) {
+                                    for (final String resource : libs) {
+                                        cp.add(new File(baseFile, resource).getAbsolutePath());
                                     }
+                                }
 
-                                    final WebResource classes = wr.getResource("/WEB-INF/classes/");
-                                    if (classes != null) {
-                                        final String path = classes.getCanonicalPath();
-                                        if (path != null) {
-                                            cp.add(path);
-                                        }
+                                final WebResource classes = wr.getResource("/WEB-INF/classes/");
+                                if (classes != null) {
+                                    final String path = classes.getCanonicalPath();
+                                    if (path != null) {
+                                        cp.add(path);
                                     }
                                 }
+                            } else if (baseFile.exists() && baseFile.getName().endsWith(".jar") && wr.getResource("/WEB-INF/classes/").exists()) {
+                                try {
+                                    cp.add(baseFile.getCanonicalPath());
+                                } catch (final IOException e) {
+                                    throw new IllegalStateException(e);
+                                }
                             }
                         }
                     }