Author: thomas.diesler(a)jboss.com
Date: 2007-06-29 13:17:12 -0400 (Fri, 29 Jun 2007)
New Revision: 3771
Modified:
branches/jbossws-2.0/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/AbstractApplicationMetaDataAdapter.java
branches/jbossws-2.0/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/DeploymentInfoAdapter.java
branches/jbossws-2.0/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/WebMetaDataAdapter.java
branches/jbossws-2.0/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/WebMetaDataAdapter.java
Log:
Fix context-root from application.xml
Modified:
branches/jbossws-2.0/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/AbstractApplicationMetaDataAdapter.java
===================================================================
---
branches/jbossws-2.0/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/AbstractApplicationMetaDataAdapter.java 2007-06-29
15:33:18 UTC (rev 3770)
+++
branches/jbossws-2.0/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/AbstractApplicationMetaDataAdapter.java 2007-06-29
17:17:12 UTC (rev 3771)
@@ -27,6 +27,7 @@
import java.util.Iterator;
import java.util.List;
+import org.jboss.deployment.DeploymentInfo;
import org.jboss.metadata.ApplicationMetaData;
import org.jboss.metadata.BeanMetaData;
import org.jboss.wsf.spi.deployment.Deployment;
@@ -43,8 +44,9 @@
*/
public abstract class AbstractApplicationMetaDataAdapter
{
- public UnifiedApplicationMetaData buildUnifiedApplicationMetaData(Deployment dep,
UnifiedDeploymentInfo udi, ApplicationMetaData apmd)
+ public UnifiedApplicationMetaData buildUnifiedApplicationMetaData(Deployment dep,
UnifiedDeploymentInfo udi, DeploymentInfo di)
{
+ ApplicationMetaData apmd = (ApplicationMetaData)di.metaData;
dep.getContext().addAttachment(ApplicationMetaData.class, apmd);
UnifiedApplicationMetaData umd = new UnifiedApplicationMetaData();
Modified:
branches/jbossws-2.0/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/DeploymentInfoAdapter.java
===================================================================
---
branches/jbossws-2.0/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/DeploymentInfoAdapter.java 2007-06-29
15:33:18 UTC (rev 3770)
+++
branches/jbossws-2.0/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/DeploymentInfoAdapter.java 2007-06-29
17:17:12 UTC (rev 3771)
@@ -114,12 +114,12 @@
{
if (di.metaData instanceof WebMetaData)
{
- udi.metaData = webMetaDataAdapter.buildUnifiedWebMetaData(dep, udi,
(WebMetaData)di.metaData);
+ udi.metaData = webMetaDataAdapter.buildUnifiedWebMetaData(dep, udi, di);
udi.webappURL = udi.url;
}
else if (di.metaData instanceof ApplicationMetaData)
{
- udi.metaData =
applicationMetaDataAdapterEJB21.buildUnifiedApplicationMetaData(dep, udi,
(ApplicationMetaData)di.metaData);
+ udi.metaData =
applicationMetaDataAdapterEJB21.buildUnifiedApplicationMetaData(dep, udi, di);
}
else if (udi.type == DeploymentType.JAXRPC_EJB3 || udi.type ==
DeploymentType.JAXWS_EJB3)
{
Modified:
branches/jbossws-2.0/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/WebMetaDataAdapter.java
===================================================================
---
branches/jbossws-2.0/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/WebMetaDataAdapter.java 2007-06-29
15:33:18 UTC (rev 3770)
+++
branches/jbossws-2.0/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/WebMetaDataAdapter.java 2007-06-29
17:17:12 UTC (rev 3771)
@@ -30,6 +30,9 @@
import java.util.Map;
import java.util.Map.Entry;
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.deployment.J2eeApplicationMetaData;
+import org.jboss.deployment.J2eeModuleMetaData;
import org.jboss.metadata.WebMetaData;
import org.jboss.metadata.WebSecurityMetaData;
import org.jboss.metadata.WebSecurityMetaData.WebResourceCollection;
@@ -48,19 +51,37 @@
*/
public class WebMetaDataAdapter
{
- public UnifiedWebMetaData buildUnifiedWebMetaData(Deployment dep,
UnifiedDeploymentInfo udi, WebMetaData webMetaData)
+ public UnifiedWebMetaData buildUnifiedWebMetaData(Deployment dep,
UnifiedDeploymentInfo udi, DeploymentInfo di)
{
- dep.getContext().addAttachment(WebMetaData.class, webMetaData);
-
+ String contextRoot = null;
+
+ WebMetaData wmd = (WebMetaData)di.metaData;
+ dep.getContext().addAttachment(WebMetaData.class, wmd);
+
+ if (di.parent != null)
+ {
+ J2eeApplicationMetaData appmd = (J2eeApplicationMetaData)di.parent.metaData;
+ Iterator it = appmd.getModules();
+ while (it.hasNext())
+ {
+ J2eeModuleMetaData module = (J2eeModuleMetaData)it.next();
+ if (module.getFileName().equals(udi.simpleName))
+ contextRoot = module.getWebContext();
+ }
+ }
+
+ if (contextRoot == null)
+ contextRoot = wmd.getContextRoot();
+
UnifiedWebMetaData umd = new UnifiedWebMetaData();
- umd.setContextRoot(webMetaData.getContextRoot());
- umd.setServletMappings(webMetaData.getServletMappings());
- umd.setServletClassNames(getServletClassMap(webMetaData));
- umd.setConfigName(webMetaData.getConfigName());
- umd.setConfigFile(webMetaData.getConfigFile());
- umd.setSecurityDomain(webMetaData.getSecurityDomain());
- umd.setPublishLocationAdapter(getPublishLocationAdpater(webMetaData));
- umd.setSecurityMetaData(getSecurityMetaData(webMetaData.getSecurityContraints()));
+ umd.setContextRoot(contextRoot);
+ umd.setServletMappings(wmd.getServletMappings());
+ umd.setServletClassNames(getServletClassMap(wmd));
+ umd.setConfigName(wmd.getConfigName());
+ umd.setConfigFile(wmd.getConfigFile());
+ umd.setSecurityDomain(wmd.getSecurityDomain());
+ umd.setPublishLocationAdapter(getPublishLocationAdpater(wmd));
+ umd.setSecurityMetaData(getSecurityMetaData(wmd.getSecurityContraints()));
dep.getContext().addAttachment(UnifiedWebMetaData.class, umd);
return umd;
Modified:
branches/jbossws-2.0/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/WebMetaDataAdapter.java
===================================================================
---
branches/jbossws-2.0/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/WebMetaDataAdapter.java 2007-06-29
15:33:18 UTC (rev 3770)
+++
branches/jbossws-2.0/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/WebMetaDataAdapter.java 2007-06-29
17:17:12 UTC (rev 3771)
@@ -30,6 +30,8 @@
import java.util.Map;
import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployment.J2eeApplicationMetaData;
+import org.jboss.deployment.J2eeModuleMetaData;
import org.jboss.metadata.WebMetaData;
import org.jboss.metadata.WebSecurityMetaData;
import org.jboss.metadata.WebSecurityMetaData.WebResourceCollection;
@@ -52,11 +54,27 @@
{
public UnifiedWebMetaData buildUnifiedWebMetaData(Deployment dep,
UnifiedDeploymentInfo udi, DeploymentUnit unit)
{
+ String contextRoot = null;
+
WebMetaData wmd = unit.getAttachment(WebMetaData.class);
dep.getContext().addAttachment(WebMetaData.class, wmd);
+ if (unit.getParent() != null)
+ {
+ J2eeApplicationMetaData appmd =
unit.getParent().getAttachment(J2eeApplicationMetaData.class);
+ if (appmd != null)
+ {
+ J2eeModuleMetaData module = appmd.getModule(udi.simpleName);
+ if (module != null)
+ contextRoot = module.getWebContext();
+ }
+ }
+
+ if (contextRoot == null)
+ contextRoot = wmd.getContextRoot();
+
UnifiedWebMetaData umd = new UnifiedWebMetaData();
- umd.setContextRoot(wmd.getContextRoot());
+ umd.setContextRoot(contextRoot);
umd.setServletMappings(getServletMappings(wmd));
umd.setServletClassNames(getServletClassMap(wmd));
umd.setConfigName(wmd.getConfigName());
Show replies by date