[jboss-cvs] JBossAS SVN: r58329 - trunk/server/src/main/org/jboss/web/deployers
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Nov 13 23:07:01 EST 2006
Author: scott.stark at jboss.org
Date: 2006-11-13 23:07:00 -0500 (Mon, 13 Nov 2006)
New Revision: 58329
Modified:
trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java
Log:
Add support for an alt-dd specification of an alternate web.xml descriptor.
Modified: trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java 2006-11-14 04:06:14 UTC (rev 58328)
+++ trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java 2006-11-14 04:07:00 UTC (rev 58329)
@@ -295,6 +295,7 @@
* the root url.
*/
String warName = unit.getName();
+ URL expWarUrl = unit.getDeploymentContext().getRoot().toURL();
if (warName.endsWith("/") == false
// Hack for jar urls being exposed
|| warName.endsWith("!/") == true)
@@ -317,7 +318,7 @@
prefix = prefix.substring(0, dotWar);
// FIXME: JBAS-3812 - TomcatDeployment should use modified WebMetaData
- URL expWarUrl = unit.getAttachment("jbossws.expanded.war.url", URL.class);
+ expWarUrl = unit.getAttachment("jbossws.expanded.war.url", URL.class);
if (expWarUrl == null)
{
File expWarFile = File.createTempFile(prefix, "-exp.war", config.getServerTempDeployDir());
@@ -362,6 +363,30 @@
unit.addAttachment("org.jboss.web.expandedWarURL", expWarUrl, URL.class);
}
+ // Resolve any ear relative alt-dd path to an expWarUrl/WEB-INF/alt-dd.xml file
+ String altDDPath = metaData.getAltDDPath();
+ if( altDDPath != null )
+ {
+ // First see if this is already a war local dd
+ VirtualFile altDD = unit.getMetaDataFile(altDDPath);
+ if( altDD == null )
+ {
+ // Should be an relative to the top deployment
+ DeploymentUnit topUnit = unit.getDeploymentContext().getTopLevel().getDeploymentUnit();
+ if( topUnit == unit )
+ throw new DeploymentException("Unable to resolve "+altDDPath+" as WEB-INF path");
+ altDD = topUnit.getFile(altDDPath);
+ if( altDD == null )
+ throw new DeploymentException("Unable to resolve "+altDDPath+" as a deployment path");
+ File webInf = new File(expWarUrl.toURI());
+ File altDDFile = new File(webInf, "WEB-INF/"+altDD.getName());
+ log.debug("Copying the altDD to: "+altDDFile);
+ Files.copy(altDD.toURL(), altDDFile);
+ metaData.setAltDDPath(altDDFile.getAbsolutePath());
+ }
+ }
+
+ //
metaData.setJava2ClassLoadingCompliance(this.java2ClassLoadingCompliance);
// Build the context root if its not been set or is specified at the ear
@@ -476,18 +501,6 @@
{
// Build a war root context from the war name if one was not specified
String webContext = ctxPath;
- // Check for an ear level specification
- if( webContext == null )
- {
- J2eeApplicationMetaData earMetaData = AttachmentLocator.search(unit, J2eeApplicationMetaData.class);
- if( earMetaData != null )
- {
- String path = unit.getRelativePath();
- J2eeModuleMetaData webModule = earMetaData.getModule(path);
- if( webModule != null )
- webContext = webModule.getWebContext();
- }
- }
// Build the context from the deployment name
if( webContext == null )
More information about the jboss-cvs-commits
mailing list