[jboss-cvs] JBossAS SVN: r68684 - branches/Branch_4_2/webservices/src/main/org/jboss/wsf/container/jboss42.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jan 8 13:53:25 EST 2008
Author: alessio.soldano at jboss.com
Date: 2008-01-08 13:53:25 -0500 (Tue, 08 Jan 2008)
New Revision: 68684
Modified:
branches/Branch_4_2/webservices/src/main/org/jboss/wsf/container/jboss42/ContainerMetaDataAdapter.java
Log:
[JBWS-1797] / [JBWS-1858] Reading jbossws configuration from web.xml
Modified: branches/Branch_4_2/webservices/src/main/org/jboss/wsf/container/jboss42/ContainerMetaDataAdapter.java
===================================================================
--- branches/Branch_4_2/webservices/src/main/org/jboss/wsf/container/jboss42/ContainerMetaDataAdapter.java 2008-01-08 18:01:42 UTC (rev 68683)
+++ branches/Branch_4_2/webservices/src/main/org/jboss/wsf/container/jboss42/ContainerMetaDataAdapter.java 2008-01-08 18:53:25 UTC (rev 68684)
@@ -23,19 +23,23 @@
// $Id: ContainerMetaDataAdapter.java 4022 2007-07-27 13:54:43Z heiko.braun at jboss.com $
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
import org.jboss.deployment.DeploymentInfo;
import org.jboss.logging.Logger;
import org.jboss.metadata.ApplicationMetaData;
import org.jboss.metadata.WebMetaData;
+import org.jboss.wsf.common.DOMUtils;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
+import org.w3c.dom.Element;
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
/**
* Build container independent deployment info.
*
@@ -74,10 +78,38 @@
if (di.metaData instanceof WebMetaData)
{
JSEArchiveMetaData webMetaData = webMetaDataAdapter.buildUnifiedWebMetaData(dep, di);
+ URL webAppURL = getDeploymentURL(di);
if (webMetaData != null)
+ {
dep.addAttachment(JSEArchiveMetaData.class, webMetaData);
-
- dep.setProperty("org.jboss.ws.webapp.url", getDeploymentURL(di));
+ if (webMetaData.getConfigName() == null && webMetaData.getConfigFile() == null)
+ {
+ //[JBWS-1797] hack for reading eventual custom configuration from web.xml
+ File file = new File(webAppURL.getFile() + "/WEB-INF/web.xml");
+ try
+ {
+ Element webApp = DOMUtils.parse(new FileInputStream(file));
+ for (Element contextParam : DOMUtils.getChildElementsAsList(webApp, "context-param"))
+ {
+ String paramName = ((Element)DOMUtils.getChildElements(contextParam, "param-name").next()).getTextContent();
+ String paramValue = ((Element)DOMUtils.getChildElements(contextParam, "param-value").next()).getTextContent();
+ if ("jbossws-config-name".equals(paramName))
+ {
+ webMetaData.setConfigName(paramValue);
+ }
+ if ("jbossws-config-file".equals(paramName))
+ {
+ webMetaData.setConfigFile(paramValue);
+ }
+ }
+ }
+ catch (IOException e)
+ {
+ log.warn("Error while getting jbossws configuration from web.xml, ignoring eventual custom configuration.");
+ }
+ }
+ }
+ dep.setProperty("org.jboss.ws.webapp.url", webAppURL);
}
else if (dep.getType() == DeploymentType.JAXRPC_EJB3 || dep.getType() == DeploymentType.JAXWS_EJB3)
{
More information about the jboss-cvs-commits
mailing list