Author: darran.lofthouse(a)jboss.com
Date: 2006-11-05 10:43:59 -0500 (Sun, 05 Nov 2006)
New Revision: 1390
Added:
branches/dlofthouse/JBWS-1133/src/main/java/org/jboss/ws/utils/ServletParamReader.java
branches/dlofthouse/JBWS-1133/src/test/java/org/jboss/test/ws/jaxws/jbws1133/
branches/dlofthouse/JBWS-1133/src/test/java/org/jboss/test/ws/jaxws/jbws1133/JBWS1133TestCase.java
branches/dlofthouse/JBWS-1133/src/test/java/org/jboss/test/ws/jaxws/jbws1133/TestEndpoint.java
branches/dlofthouse/JBWS-1133/src/test/resources/jaxws/jbws1133/
branches/dlofthouse/JBWS-1133/src/test/resources/jaxws/jbws1133/WEB-INF/
branches/dlofthouse/JBWS-1133/src/test/resources/jaxws/jbws1133/WEB-INF/web.xml
Modified:
branches/dlofthouse/JBWS-1133/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderJSE.java
branches/dlofthouse/JBWS-1133/src/main/java/org/jboss/ws/integration/jboss/DeployerInterceptorJSE.java
branches/dlofthouse/JBWS-1133/src/main/java/org/jboss/ws/integration/jboss/WebMetaDataAdaptor.java
branches/dlofthouse/JBWS-1133/src/test/ant/build-jars-jaxws.xml
Log:
JBWS-1133, Test case and temporary workaround for the redeployment problem. Once the
integration with the new deployers is complete this workaround can be removed.
Modified:
branches/dlofthouse/JBWS-1133/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderJSE.java
===================================================================
---
branches/dlofthouse/JBWS-1133/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderJSE.java 2006-11-05
13:46:55 UTC (rev 1389)
+++
branches/dlofthouse/JBWS-1133/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilderJSE.java 2006-11-05
15:43:59 UTC (rev 1390)
@@ -30,6 +30,8 @@
import org.jboss.ws.WSException;
import org.jboss.ws.metadata.UnifiedMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
+import org.jboss.ws.server.StandardEndpointServlet;
+import org.jboss.ws.utils.ServletParamReader;
/**
* A server side meta data builder that is based on JSR-181 annotations
@@ -59,13 +61,29 @@
// For every bean
UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
+ Map<String, String> paramSEIImpl =
ServletParamReader.getServletInitParam(udi.localUrl,
ServiceEndpointPublisher.INIT_PARAM_SERVICE_ENDPOINT_IMPL);
Map<String, String> servletClassMap = webMetaData.getServletClassMap();
for (String servletName : servletClassMap.keySet())
{
String servletClassName = servletClassMap.get(servletName);
+
try
{
Class beanClass = udi.annotationsCl.loadClass(servletClassName);
+
+ if (StandardEndpointServlet.class.isAssignableFrom(beanClass))
+ {
+ String endpointImpl = paramSEIImpl.get(servletName);
+ if (endpointImpl != null)
+ {
+ beanClass = udi.annotationsCl.loadClass(endpointImpl);
+ }
+ else
+ {
+ continue;
+ }
+ }
+
if (beanClass.isAnnotationPresent(WebService.class))
{
setupEndpointFromAnnotations(wsMetaData, udi, beanClass, servletName);
@@ -74,7 +92,7 @@
catch (ClassNotFoundException ex)
{
log.warn("Cannot load service endpoint class: " +
servletClassName);
- }
+ }
}
log.debug("END buildMetaData: " + wsMetaData);
Modified:
branches/dlofthouse/JBWS-1133/src/main/java/org/jboss/ws/integration/jboss/DeployerInterceptorJSE.java
===================================================================
---
branches/dlofthouse/JBWS-1133/src/main/java/org/jboss/ws/integration/jboss/DeployerInterceptorJSE.java 2006-11-05
13:46:55 UTC (rev 1389)
+++
branches/dlofthouse/JBWS-1133/src/main/java/org/jboss/ws/integration/jboss/DeployerInterceptorJSE.java 2006-11-05
15:43:59 UTC (rev 1390)
@@ -40,6 +40,8 @@
import org.jboss.ws.metadata.ServerEndpointMetaData;
import org.jboss.ws.metadata.ServiceMetaData;
import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.server.StandardEndpointServlet;
+import org.jboss.ws.utils.ServletParamReader;
/**
* A deployer service that manages WS4EE compliant Web Services for WAR
@@ -52,25 +54,25 @@
protected UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentInfo di) throws
Exception
{
UnifiedDeploymentInfo udi;
-
+
DeploymentType type =
(DeploymentType)di.context.get("UnifiedDeploymentInfo.Type");
if (type == UnifiedDeploymentInfo.DeploymentType.JSR109_JSE)
{
URL webservicesURL = getWebservicesDescriptor(di);
udi = new JSR109Deployment(UnifiedDeploymentInfo.DeploymentType.JSR109_JSE,
webservicesURL);
DeploymentInfoAdaptor.buildDeploymentInfo(udi, di);
-
+
}
else if (type == UnifiedDeploymentInfo.DeploymentType.JSR181_JSE)
{
udi = new JSR181Deployment(UnifiedDeploymentInfo.DeploymentType.JSR181_JSE);
DeploymentInfoAdaptor.buildDeploymentInfo(udi, di);
}
- else
+ else
{
throw new WSException("Unexpected type: " + type);
}
-
+
return udi;
}
@@ -91,7 +93,7 @@
}
return retn;
}
-
+
private void updateServiceEndpointTargetBeans(UnifiedDeploymentInfo udi,
Map<String, String> sepTargetMap)
{
UnifiedMetaData wsMetaData = getServiceEndpointDeployer().getUnifiedMetaData(udi);
@@ -127,14 +129,32 @@
// Check if the web.xml contains annotated endpoint impl
if (isWebserviceDeployment == false)
{
+ Map<String, String> paramSEIImpl =
ServletParamReader.getServletInitParam(di.localUrl,
ServiceEndpointPublisher.INIT_PARAM_SERVICE_ENDPOINT_IMPL);
Map servletClassMap = webMetaData.getServletClassMap();
- Iterator<String> it = servletClassMap.values().iterator();
+
+ Iterator<String> it = servletClassMap.keySet().iterator();
+
while (it.hasNext() && isWebserviceDeployment == false)
{
- String servletClassName = it.next();
+ String servletName = it.next();
+ String servletClassName = (String)servletClassMap.get(servletName);
try
{
Class servletClass = di.annotationsCl.loadClass(servletClassName);
+
+ if (StandardEndpointServlet.class.isAssignableFrom(servletClass))
+ {
+ String endpointImpl = paramSEIImpl.get(servletName);
+ if (endpointImpl != null)
+ {
+ servletClass = di.annotationsCl.loadClass(endpointImpl);
+ }
+ else
+ {
+ continue;
+ }
+ }
+
if (servletClass.isAnnotationPresent(javax.jws.WebService.class))
{
di.context.put("UnifiedDeploymentInfo.Type",
UnifiedDeploymentInfo.DeploymentType.JSR181_JSE);
Modified:
branches/dlofthouse/JBWS-1133/src/main/java/org/jboss/ws/integration/jboss/WebMetaDataAdaptor.java
===================================================================
---
branches/dlofthouse/JBWS-1133/src/main/java/org/jboss/ws/integration/jboss/WebMetaDataAdaptor.java 2006-11-05
13:46:55 UTC (rev 1389)
+++
branches/dlofthouse/JBWS-1133/src/main/java/org/jboss/ws/integration/jboss/WebMetaDataAdaptor.java 2006-11-05
15:43:59 UTC (rev 1390)
@@ -31,7 +31,6 @@
import org.jboss.metadata.WebMetaData;
import org.jboss.metadata.WebSecurityMetaData;
import org.jboss.metadata.WebSecurityMetaData.WebResourceCollection;
-import org.jboss.ws.metadata.j2ee.UnifiedServiceRefMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedWebSecurityMetaData;
import
org.jboss.ws.metadata.j2ee.UnifiedWebSecurityMetaData.UnifiedWebResourceCollection;
Added:
branches/dlofthouse/JBWS-1133/src/main/java/org/jboss/ws/utils/ServletParamReader.java
===================================================================
---
branches/dlofthouse/JBWS-1133/src/main/java/org/jboss/ws/utils/ServletParamReader.java 2006-11-05
13:46:55 UTC (rev 1389)
+++
branches/dlofthouse/JBWS-1133/src/main/java/org/jboss/ws/utils/ServletParamReader.java 2006-11-05
15:43:59 UTC (rev 1390)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.jboss.ws.WSException;
+import org.w3c.dom.Element;
+
+/**
+ * Temporary utility class to read the init-params for servlets within the
+ * web.xml so the class name of the SEI can be obtained an a previously
+ * modified web.xml.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since Nov 5, 2006
+ */
+public class ServletParamReader
+{
+
+ public static Map<String, String> getServletInitParam(final URL warUlr, final
String requiredParameter)
+ {
+ HashMap<String, String> params = new HashMap<String, String>();
+ File webXml = new File(warUlr.getFile() + "/WEB-INF/web.xml");
+
+ if (webXml.isFile() == false)
+ throw new WSException("Unable to find web.xml: " + webXml);
+
+ try
+ {
+ Element rootElement = DOMUtils.parse(new FileInputStream(webXml));
+
+ Iterator servletElements = DOMUtils.getChildElements(rootElement,
"servlet");
+ while (servletElements.hasNext())
+ {
+ Element currentServlet = (Element)servletElements.next();
+ String servletName =
DOMUtils.getTextContent(DOMUtils.getFirstChildElement(currentServlet,
"servlet-name"));
+ Iterator initParams = DOMUtils.getChildElements(currentServlet,
"init-param");
+ while (initParams.hasNext())
+ {
+ Element currentParam = (Element)initParams.next();
+ String paramName =
DOMUtils.getTextContent(DOMUtils.getFirstChildElement(currentParam,
"param-name"));
+ if (requiredParameter.equals(paramName))
+ {
+ String paramValue =
DOMUtils.getTextContent(DOMUtils.getFirstChildElement(currentParam,
"param-value"));
+ params.put(servletName, paramValue);
+ }
+
+ }
+ }
+
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Unable to read web.xml", e);
+ }
+
+ return params;
+ }
+
+}
Property changes on:
branches/dlofthouse/JBWS-1133/src/main/java/org/jboss/ws/utils/ServletParamReader.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/dlofthouse/JBWS-1133/src/test/ant/build-jars-jaxws.xml
===================================================================
--- branches/dlofthouse/JBWS-1133/src/test/ant/build-jars-jaxws.xml 2006-11-05 13:46:55
UTC (rev 1389)
+++ branches/dlofthouse/JBWS-1133/src/test/ant/build-jars-jaxws.xml 2006-11-05 15:43:59
UTC (rev 1390)
@@ -94,6 +94,18 @@
</classes>
</war>
+ <!-- jaxws-jbws1133 -->
+ <mkdir dir="${build.test.dir}/libs/jaxws-jbws1133.war"/>
+ <mkdir dir="${build.test.dir}/libs/jaxws-jbws1133.war/WEB-INF"/>
+ <mkdir
dir="${build.test.dir}/libs/jaxws-jbws1133.war/WEB-INF/classes"/>
+ <copy
tofile="${build.test.dir}/libs/jaxws-jbws1133.war/WEB-INF/original-web.xml"
+ file="${build.test.dir}/resources/jaxws/jbws1133/WEB-INF/web.xml"/>
+ <copy
todir="${build.test.dir}/libs/jaxws-jbws1133.war/WEB-INF/classes">
+ <fileset dir="${build.test.dir}/classes">
+ <include
name="org/jboss/test/ws/jaxws/jbws1133/TestEndpoint.class"/>
+ </fileset>
+ </copy>
+
<!-- jaxws-jbws1178 -->
<war destfile="${build.test.dir}/libs/jaxws-jbws1178.war"
webxml="${build.test.dir}/resources/jaxws/jbws1178/WEB-INF/web.xml">
<classes dir="${build.test.dir}/classes">
Added:
branches/dlofthouse/JBWS-1133/src/test/java/org/jboss/test/ws/jaxws/jbws1133/JBWS1133TestCase.java
===================================================================
---
branches/dlofthouse/JBWS-1133/src/test/java/org/jboss/test/ws/jaxws/jbws1133/JBWS1133TestCase.java 2006-11-05
13:46:55 UTC (rev 1389)
+++
branches/dlofthouse/JBWS-1133/src/test/java/org/jboss/test/ws/jaxws/jbws1133/JBWS1133TestCase.java 2006-11-05
15:43:59 UTC (rev 1390)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws1133;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.tools.ant.util.FileUtils;
+import org.jboss.test.ws.JBossWSTest;
+
+/**
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 16-October-2006
+ */
+public class JBWS1133TestCase extends JBossWSTest
+{
+
+ private final String TARGET_WSDL = "http://" + getServerHost() +
":8080/jaxws-jbws1133?wsdl";
+
+ public void testRedeployExploded() throws Exception
+ {
+ cleanWebXML();
+
+ try
+ {
+ deploy("jaxws-jbws1133.war");
+
+ checkWSDL();
+
+ undeploy("jaxws-jbws1133.war");
+ deploy("jaxws-jbws1133.war");
+
+ checkWSDL();
+ }
+ finally
+ {
+ undeploy("jaxws-jbws1133.war");
+ }
+ }
+
+ private void cleanWebXML() throws Exception
+ {
+ File webXML = new File("libs/jaxws-jbws1133.war/WEB-INF/web.xml");
+ if (webXML.exists())
+ {
+ webXML.delete();
+ }
+ File originalWebXML = new
File("libs/jaxws-jbws1133.war/WEB-INF/original-web.xml");
+ FileUtils.getFileUtils().copyFile(originalWebXML, webXML);
+ }
+
+ private void checkWSDL() throws Exception
+ {
+ URL wsdlURL = new URL(TARGET_WSDL);
+ InputStream is = wsdlURL.openStream();
+ assertNotNull(is);
+ }
+
+}
\ No newline at end of file
Property changes on:
branches/dlofthouse/JBWS-1133/src/test/java/org/jboss/test/ws/jaxws/jbws1133/JBWS1133TestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/dlofthouse/JBWS-1133/src/test/java/org/jboss/test/ws/jaxws/jbws1133/TestEndpoint.java
===================================================================
---
branches/dlofthouse/JBWS-1133/src/test/java/org/jboss/test/ws/jaxws/jbws1133/TestEndpoint.java 2006-11-05
13:46:55 UTC (rev 1389)
+++
branches/dlofthouse/JBWS-1133/src/test/java/org/jboss/test/ws/jaxws/jbws1133/TestEndpoint.java 2006-11-05
15:43:59 UTC (rev 1390)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws1133;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+/**
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since 16-October-2006
+ */
+@WebService(targetNamespace = "http://org.jboss/test/ws/jbws1133")
+@SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
+public class TestEndpoint
+{
+
+ @WebMethod
+ public String echo(final String message)
+ {
+ return message;
+ }
+
+}
Property changes on:
branches/dlofthouse/JBWS-1133/src/test/java/org/jboss/test/ws/jaxws/jbws1133/TestEndpoint.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/dlofthouse/JBWS-1133/src/test/resources/jaxws/jbws1133/WEB-INF/web.xml
===================================================================
---
branches/dlofthouse/JBWS-1133/src/test/resources/jaxws/jbws1133/WEB-INF/web.xml 2006-11-05
13:46:55 UTC (rev 1389)
+++
branches/dlofthouse/JBWS-1133/src/test/resources/jaxws/jbws1133/WEB-INF/web.xml 2006-11-05
15:43:59 UTC (rev 1390)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+ <servlet>
+ <servlet-name>TestEndpoint</servlet-name>
+
<servlet-class>org.jboss.test.ws.jaxws.jbws1133.TestEndpoint</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TestEndpoint</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+</web-app>
\ No newline at end of file
Property changes on:
branches/dlofthouse/JBWS-1133/src/test/resources/jaxws/jbws1133/WEB-INF/web.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF