[jboss-cvs] JBossAS SVN: r77755 - trunk/server/src/main/org/jboss/web/deployers.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Sep 1 11:15:55 EDT 2008
Author: adrian at jboss.org
Date: 2008-09-01 11:15:54 -0400 (Mon, 01 Sep 2008)
New Revision: 77755
Modified:
trunk/server/src/main/org/jboss/web/deployers/WARStructure.java
Log:
[JBAS-5912] - Add META-INF of WEB-INF/lib/*.jars to metadata locations of the war
Modified: trunk/server/src/main/org/jboss/web/deployers/WARStructure.java
===================================================================
--- trunk/server/src/main/org/jboss/web/deployers/WARStructure.java 2008-09-01 14:25:24 UTC (rev 77754)
+++ trunk/server/src/main/org/jboss/web/deployers/WARStructure.java 2008-09-01 15:15:54 UTC (rev 77755)
@@ -22,6 +22,7 @@
package org.jboss.web.deployers;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
import org.jboss.deployers.spi.DeploymentException;
@@ -118,44 +119,66 @@
log.trace("... ok - name ends in .war.");
}
- // Create a context for this war file with WEB-INF as the location for metadata
- // Some wars also might have metadata in WEB-INF/classes/META-INF, e.g. persistence.xml
- context = createContext(structureContext, new String[]{"WEB-INF", "WEB-INF/classes/META-INF"});
+ List<String> metaDataLocations = new ArrayList<String>();
+ metaDataLocations.add("WEB-INF");
- // Add the war manifest classpath entries
- addClassPath(structureContext, file, false, true, context);
+ // Check for WEB-INF/classes
+ VirtualFile classes = null;
try
{
- // The classpath is WEB-INF/classes
- VirtualFile classes = file.getChild("WEB-INF/classes");
- // Add the war manifest classpath entries
+ // The classpath contains WEB-INF/classes
+ classes = file.getChild("WEB-INF/classes");
+
+ // Check for a META-INF for metadata
if (classes != null)
- addClassPath(structureContext, classes, true, false, context);
- else if (trace)
- log.trace("No WEB-INF/classes for: " + file.getPathName());
+ metaDataLocations.add("WEB-INF/classes/META-INF");
}
catch(IOException e)
{
log.warn("Exception while looking for classes, " + file.getPathName() + ", " + e);
}
- // and the top level jars in WEB-INF/lib
+
+ // Check for jars in WEB-INF/lib
+ List<VirtualFile> archives = null;
try
{
VirtualFile webinfLib = file.getChild("WEB-INF/lib");
if (webinfLib != null)
{
- List<VirtualFile> archives = webinfLib.getChildren(webInfLibFilter);
+ archives = webinfLib.getChildren(webInfLibFilter);
+ // Add the jars' META-INF for metadata
for (VirtualFile jar : archives)
- addClassPath(structureContext, jar, true, true, context);
+ metaDataLocations.add("WEB-INF/lib/" + jar.getName() + "/META-INF");
}
- else if (trace)
- log.trace("No WEB-INF/lib for: " + file.getPathName());
}
catch (IOException e)
{
log.warn("Exception looking for WEB-INF/lib, " + file.getPathName() + ", " + e);
}
+
+ // Create a context for this war file and all its metadata locations
+ context = createContext(structureContext, metaDataLocations.toArray(new String[metaDataLocations.size()]));
+ // Add the war manifest classpath entries
+ addClassPath(structureContext, file, false, true, context);
+
+ // Add WEB-INF/classes if present
+ if (classes != null)
+ addClassPath(structureContext, classes, true, false, context);
+ else if (trace)
+ log.trace("No WEB-INF/classes for: " + file.getPathName());
+
+ // and the top level jars in WEB-INF/lib
+ if (archives != null)
+ {
+ for (VirtualFile jar : archives)
+ addClassPath(structureContext, jar, true, true, context);
+ }
+ else if (trace)
+ {
+ log.trace("No WEB-INF/lib for: " + file.getPathName());
+ }
+
// There are no subdeployments for wars
return true;
}
More information about the jboss-cvs-commits
mailing list