Author: thomas.diesler(a)jboss.com
Date: 2007-05-21 13:30:28 -0400 (Mon, 21 May 2007)
New Revision: 3165
Added:
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireConfigurableServletExt.java
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireServletControllerExt.java
Removed:
branches/tdiesler/trunk/integration/xfire/output-eclipse/
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireConfigurableServletJBWS.java
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireServletControllerJBWS.java
Modified:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXRPCDeployerHookEJB21.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXRPCDeployerHookJSE.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXWSDeployerHookEJB3.java
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXWSDeployerHookJSE.java
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookEJB21.java
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookJSE.java
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookEJB3.java
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookJSE.java
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicDeployment.java
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Deployment.java
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/ModifyWebMetaDataDeployer.java
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/WebAppDesciptorModifierImpl.java
branches/tdiesler/trunk/integration/xfire/src/main/resources/jbossws-jboss50.sar/META-INF/jbossws-beans.xml
branches/tdiesler/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/eardeployment/EarTestCase.java
Log:
xfire
Modified:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXRPCDeployerHookEJB21.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXRPCDeployerHookEJB21.java 2007-05-21
15:15:49 UTC (rev 3164)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXRPCDeployerHookEJB21.java 2007-05-21
17:30:28 UTC (rev 3165)
@@ -26,6 +26,7 @@
import org.jboss.deployment.DeploymentInfo;
import org.jboss.metadata.ApplicationMetaData;
import org.jboss.metadata.BeanMetaData;
+import org.jboss.ws.integration.URLLoaderAdapter;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.Service;
@@ -53,8 +54,9 @@
public Deployment createDeployment(DeploymentInfo unit)
{
Deployment dep = createDeployment();
+ dep.setRootFile(new URLLoaderAdapter(unit.url));
+ dep.setClassLoader(unit.annotationsCl);
dep.setType(getDeploymentType());
- dep.setClassLoader(unit.ucl);
Service service = dep.getService();
Modified:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXRPCDeployerHookJSE.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXRPCDeployerHookJSE.java 2007-05-21
15:15:49 UTC (rev 3164)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXRPCDeployerHookJSE.java 2007-05-21
17:30:28 UTC (rev 3165)
@@ -29,6 +29,7 @@
import org.jboss.deployment.DeploymentInfo;
import org.jboss.metadata.WebMetaData;
+import org.jboss.ws.integration.URLLoaderAdapter;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.Service;
@@ -59,8 +60,9 @@
public Deployment createDeployment(DeploymentInfo unit)
{
Deployment dep = createDeployment();
+ dep.setRootFile(new URLLoaderAdapter(unit.url));
+ dep.setClassLoader(unit.annotationsCl);
dep.setType(getDeploymentType());
- dep.setClassLoader(unit.annotationsCl);
Service service = dep.getService();
Modified:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXWSDeployerHookEJB3.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXWSDeployerHookEJB3.java 2007-05-21
15:15:49 UTC (rev 3164)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXWSDeployerHookEJB3.java 2007-05-21
17:30:28 UTC (rev 3165)
@@ -30,6 +30,7 @@
import org.jboss.ejb3.EJBContainer;
import org.jboss.ejb3.Ejb3ModuleMBean;
import org.jboss.ejb3.stateless.StatelessContainer;
+import org.jboss.ws.integration.URLLoaderAdapter;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.Service;
@@ -54,8 +55,9 @@
public Deployment createDeployment(DeploymentInfo unit)
{
Deployment dep = createDeployment();
+ dep.setRootFile(new URLLoaderAdapter(unit.url));
+ dep.setClassLoader(unit.annotationsCl);
dep.setType(getDeploymentType());
- dep.setClassLoader(unit.ucl);
Service service = dep.getService();
Modified:
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXWSDeployerHookJSE.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXWSDeployerHookJSE.java 2007-05-21
15:15:49 UTC (rev 3164)
+++
branches/tdiesler/trunk/integration/jboss42/src/main/java/org/jboss/wsf/container/jboss42/JAXWSDeployerHookJSE.java 2007-05-21
17:30:28 UTC (rev 3165)
@@ -34,6 +34,7 @@
import org.jboss.deployment.DeploymentInfo;
import org.jboss.metadata.WebMetaData;
+import org.jboss.ws.integration.URLLoaderAdapter;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.Service;
@@ -58,8 +59,9 @@
public Deployment createDeployment(DeploymentInfo unit)
{
Deployment dep = createDeployment();
+ dep.setRootFile(new URLLoaderAdapter(unit.url));
+ dep.setClassLoader(unit.annotationsCl);
dep.setType(getDeploymentType());
- dep.setClassLoader(unit.annotationsCl);
Service service = dep.getService();
Modified:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookEJB21.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookEJB21.java 2007-05-21
15:15:49 UTC (rev 3164)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookEJB21.java 2007-05-21
17:30:28 UTC (rev 3165)
@@ -53,8 +53,9 @@
public Deployment createDeployment(DeploymentUnit unit)
{
Deployment dep = createDeployment();
+ dep.setRootFile(new VirtualFileAdaptor(unit.getDeploymentContext().getRoot()));
+ dep.setClassLoader(unit.getClassLoader());
dep.setType(getDeploymentType());
- dep.setClassLoader(unit.getClassLoader());
Service service = dep.getService();
Modified:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookJSE.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookJSE.java 2007-05-21
15:15:49 UTC (rev 3164)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXRPCDeployerHookJSE.java 2007-05-21
17:30:28 UTC (rev 3165)
@@ -56,8 +56,9 @@
public Deployment createDeployment(DeploymentUnit unit)
{
Deployment dep = createDeployment();
+ dep.setRootFile(new VirtualFileAdaptor(unit.getDeploymentContext().getRoot()));
+ dep.setClassLoader(unit.getClassLoader());
dep.setType(getDeploymentType());
- dep.setClassLoader(unit.getClassLoader());
Service service = dep.getService();
Modified:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookEJB3.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookEJB3.java 2007-05-21
15:15:49 UTC (rev 3164)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookEJB3.java 2007-05-21
17:30:28 UTC (rev 3165)
@@ -56,8 +56,9 @@
public Deployment createDeployment(DeploymentUnit unit)
{
Deployment dep = createDeployment();
+ dep.setRootFile(new VirtualFileAdaptor(unit.getDeploymentContext().getRoot()));
+ dep.setClassLoader(unit.getClassLoader());
dep.setType(getDeploymentType());
- dep.setClassLoader(unit.getClassLoader());
Service service = dep.getService();
Modified:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookJSE.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookJSE.java 2007-05-21
15:15:49 UTC (rev 3164)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/wsf/container/jboss50/JAXWSDeployerHookJSE.java 2007-05-21
17:30:28 UTC (rev 3165)
@@ -56,8 +56,9 @@
public Deployment createDeployment(DeploymentUnit unit)
{
Deployment dep = createDeployment();
+ dep.setRootFile(new VirtualFileAdaptor(unit.getDeploymentContext().getRoot()));
+ dep.setClassLoader(unit.getClassLoader());
dep.setType(getDeploymentType());
- dep.setClassLoader(unit.getClassLoader());
Service service = dep.getService();
Modified:
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicDeployment.java
===================================================================
---
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicDeployment.java 2007-05-21
15:15:49 UTC (rev 3164)
+++
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicDeployment.java 2007-05-21
17:30:28 UTC (rev 3165)
@@ -21,6 +21,8 @@
*/
package org.jboss.wsf.spi.deployment;
+import org.jboss.ws.integration.UnifiedVirtualFile;
+
//$Id$
@@ -36,6 +38,8 @@
{
// The context for this deployment dep
private DeploymentContext context;
+ // The root file for this deployment
+ private UnifiedVirtualFile rootFile;
// A deployment has one service
private Service service;
// The type of this deployment
@@ -62,6 +66,16 @@
this.context = context;
}
+ public UnifiedVirtualFile getRootFile()
+ {
+ return rootFile;
+ }
+
+ public void setRootFile(UnifiedVirtualFile rootFile)
+ {
+ this.rootFile = rootFile;
+ }
+
public void setClassLoader(ClassLoader classLoader)
{
this.classLoader = classLoader;
Modified:
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Deployment.java
===================================================================
---
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Deployment.java 2007-05-21
15:15:49 UTC (rev 3164)
+++
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Deployment.java 2007-05-21
17:30:28 UTC (rev 3165)
@@ -21,7 +21,9 @@
*/
package org.jboss.wsf.spi.deployment;
+import org.jboss.ws.integration.UnifiedVirtualFile;
+
// $Id$
@@ -45,6 +47,12 @@
UNDEFINED, CREATED, STARTED, STOPED, DESTROYED
};
+ /** Get the root file for this deployment */
+ UnifiedVirtualFile getRootFile();
+
+ /** Set the root file for this deployment */
+ void setRootFile(UnifiedVirtualFile root);
+
/** Get the class loader for this deployment */
ClassLoader getClassLoader();
Modified:
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/ModifyWebMetaDataDeployer.java
===================================================================
---
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/ModifyWebMetaDataDeployer.java 2007-05-21
15:15:49 UTC (rev 3164)
+++
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/ModifyWebMetaDataDeployer.java 2007-05-21
17:30:28 UTC (rev 3165)
@@ -64,7 +64,7 @@
// Add the path to sun-jaxws.xml
ParamValue ctxParam = new ParamValue();
ctxParam.setType(ParamType.CONTEXT_PARAM);
- ctxParam.setName(XFireConfigurableServletJBWS.PARAM_XFIRE_SERVICES_URL);
+ ctxParam.setName(XFireConfigurableServletExt.PARAM_XFIRE_SERVICES_URL);
ctxParam.setValue(ddbeans.createFileURL().toExternalForm());
webMetaData.addContextParam(ctxParam);
Modified:
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/WebAppDesciptorModifierImpl.java
===================================================================
---
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/WebAppDesciptorModifierImpl.java 2007-05-21
15:15:49 UTC (rev 3164)
+++
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/WebAppDesciptorModifierImpl.java 2007-05-21
17:30:28 UTC (rev 3165)
@@ -64,7 +64,7 @@
throw new IllegalStateException("Cannot obtain sun-jaxws meta data");
Element contextParam = root.addElement("context-param");
-
contextParam.addElement("param-name").addText(XFireConfigurableServletJBWS.PARAM_XFIRE_SERVICES_URL);
+
contextParam.addElement("param-name").addText(XFireConfigurableServletExt.PARAM_XFIRE_SERVICES_URL);
contextParam.addElement("param-value").addText(ddbeans.createFileURL().toExternalForm());
for (Iterator it = root.elementIterator("servlet"); it.hasNext();)
Copied:
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireConfigurableServletExt.java
(from rev 3164,
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireConfigurableServletJBWS.java)
===================================================================
---
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireConfigurableServletExt.java
(rev 0)
+++
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireConfigurableServletExt.java 2007-05-21
17:30:28 UTC (rev 3165)
@@ -0,0 +1,145 @@
+/*
+ * 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.wsf.stack.xfire;
+
+//$Id$
+
+import java.io.IOException;
+import java.net.URL;
+
+import javax.management.ObjectName;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.ws.WebServiceException;
+
+import org.codehaus.xfire.XFire;
+import org.codehaus.xfire.transport.http.XFireConfigurableServlet;
+import org.codehaus.xfire.transport.http.XFireServletController;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.EndpointAssociation;
+import org.jboss.wsf.spi.invocation.RequestHandler;
+import org.jboss.wsf.spi.management.EndpointRegistry;
+import org.jboss.wsf.spi.management.EndpointRegistryFactory;
+import org.jboss.wsf.spi.utils.ObjectNameFactory;
+
+/**
+ * An extension to the XFire servlet
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 21-Apr-2007
+ */
+public class XFireConfigurableServletExt extends XFireConfigurableServlet
+{
+ public static final String PARAM_XFIRE_SERVICES_URL =
"jbossws.xfire.services.url";
+
+ private final static String CONFIG_FILE =
"/WEB-INF/classes/META-INF/xfire/services.xml";
+
+ protected Endpoint endpoint;
+ protected EndpointRegistry epRegistry;
+
+ public void init(ServletConfig servletConfig) throws ServletException
+ {
+ super.init(servletConfig);
+
+ // Init the Endpoint
+ epRegistry = EndpointRegistryFactory.getEndpointRegistry();
+ String contextPath = servletConfig.getServletContext().getContextPath();
+ initServiceEndpoint(contextPath);
+ endpoint.addAttachment(XFireServletController.class, controller);
+ }
+
+ public XFire createXFire() throws ServletException
+ {
+ XFire xfire;
+ try
+ {
+ // #1 Load services.xml from default location
+ ServletContext context = getServletContext();
+ URL servicesURL = context.getResource(CONFIG_FILE);
+
+ // #1 Load services.xml from init parameter
+ if (servicesURL == null)
+ {
+ String paramValue = context.getInitParameter(PARAM_XFIRE_SERVICES_URL);
+ if (paramValue != null)
+ servicesURL = new URL(paramValue);
+ }
+
+ xfire = loadConfig(servicesURL.getFile());
+ }
+ catch (Exception e)
+ {
+ throw new ServletException(e);
+ }
+
+ return xfire;
+ }
+
+ public XFireServletController createController() throws ServletException
+ {
+ return new XFireServletControllerExt(xfire, getServletContext());
+ }
+
+ public void service(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
+ {
+ try
+ {
+ EndpointAssociation.setEndpoint(endpoint);
+ RequestHandler requestHandler = (RequestHandler)endpoint.getRequestHandler();
+ requestHandler.handleHttpRequest(endpoint, req, res, getServletContext());
+ }
+ finally
+ {
+ EndpointAssociation.removeEndpoint();
+ }
+ }
+
+ /** Initialize the service endpoint
+ */
+ protected void initServiceEndpoint(String contextPath)
+ {
+ if (contextPath.startsWith("/"))
+ contextPath = contextPath.substring(1);
+
+ String servletName = getServletName();
+ for (ObjectName sepId : epRegistry.getEndpoints())
+ {
+ String propContext = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_CONTEXT);
+ String propEndpoint = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
+ if (servletName.equals(propEndpoint) &&
contextPath.equals(propContext))
+ {
+ endpoint = epRegistry.getEndpoint(sepId);
+ break;
+ }
+ }
+
+ if (endpoint == null)
+ {
+ ObjectName oname = ObjectNameFactory.create(Endpoint.SEPID_DOMAIN +
":" + Endpoint.SEPID_PROPERTY_CONTEXT + "=" + contextPath +
","
+ + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName);
+ throw new WebServiceException("Cannot obtain endpoint for: " +
oname);
+ }
+ }
+}
Deleted:
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireConfigurableServletJBWS.java
===================================================================
---
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireConfigurableServletJBWS.java 2007-05-21
15:15:49 UTC (rev 3164)
+++
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireConfigurableServletJBWS.java 2007-05-21
17:30:28 UTC (rev 3165)
@@ -1,145 +0,0 @@
-/*
- * 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.wsf.stack.xfire;
-
-//$Id$
-
-import java.io.IOException;
-import java.net.URL;
-
-import javax.management.ObjectName;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.ws.WebServiceException;
-
-import org.codehaus.xfire.XFire;
-import org.codehaus.xfire.transport.http.XFireConfigurableServlet;
-import org.codehaus.xfire.transport.http.XFireServletController;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.EndpointAssociation;
-import org.jboss.wsf.spi.invocation.RequestHandler;
-import org.jboss.wsf.spi.management.EndpointRegistry;
-import org.jboss.wsf.spi.management.EndpointRegistryFactory;
-import org.jboss.wsf.spi.utils.ObjectNameFactory;
-
-/**
- * An extension to the XFire servlet
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 21-Apr-2007
- */
-public class XFireConfigurableServletJBWS extends XFireConfigurableServlet
-{
- public static final String PARAM_XFIRE_SERVICES_URL =
"jbossws.xfire.services.url";
-
- private final static String CONFIG_FILE =
"/WEB-INF/classes/META-INF/xfire/services.xml";
-
- protected Endpoint endpoint;
- protected EndpointRegistry epRegistry;
-
- public void init(ServletConfig servletConfig) throws ServletException
- {
- super.init(servletConfig);
-
- // Init the Endpoint
- epRegistry = EndpointRegistryFactory.getEndpointRegistry();
- String contextPath = servletConfig.getServletContext().getContextPath();
- initServiceEndpoint(contextPath);
- endpoint.addAttachment(XFireServletController.class, controller);
- }
-
- public XFire createXFire() throws ServletException
- {
- XFire xfire;
- try
- {
- // #1 Load services.xml from default location
- ServletContext context = getServletContext();
- URL servicesURL = context.getResource(CONFIG_FILE);
-
- // #1 Load services.xml from init parameter
- if (servicesURL == null)
- {
- String paramValue = context.getInitParameter(PARAM_XFIRE_SERVICES_URL);
- if (paramValue != null)
- servicesURL = new URL(paramValue);
- }
-
- xfire = loadConfig(servicesURL.getFile());
- }
- catch (Exception e)
- {
- throw new ServletException(e);
- }
-
- return xfire;
- }
-
- public XFireServletController createController() throws ServletException
- {
- return new XFireServletControllerJBWS(xfire, getServletContext());
- }
-
- public void service(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
- {
- try
- {
- EndpointAssociation.setEndpoint(endpoint);
- RequestHandler requestHandler = (RequestHandler)endpoint.getRequestHandler();
- requestHandler.handleHttpRequest(endpoint, req, res, getServletContext());
- }
- finally
- {
- EndpointAssociation.removeEndpoint();
- }
- }
-
- /** Initialize the service endpoint
- */
- protected void initServiceEndpoint(String contextPath)
- {
- if (contextPath.startsWith("/"))
- contextPath = contextPath.substring(1);
-
- String servletName = getServletName();
- for (ObjectName sepId : epRegistry.getEndpoints())
- {
- String propContext = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_CONTEXT);
- String propEndpoint = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
- if (servletName.equals(propEndpoint) &&
contextPath.equals(propContext))
- {
- endpoint = epRegistry.getEndpoint(sepId);
- break;
- }
- }
-
- if (endpoint == null)
- {
- ObjectName oname = ObjectNameFactory.create(Endpoint.SEPID_DOMAIN +
":" + Endpoint.SEPID_PROPERTY_CONTEXT + "=" + contextPath +
","
- + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName);
- throw new WebServiceException("Cannot obtain endpoint for: " +
oname);
- }
- }
-}
Copied:
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireServletControllerExt.java
(from rev 3164,
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireServletControllerJBWS.java)
===================================================================
---
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireServletControllerExt.java
(rev 0)
+++
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireServletControllerExt.java 2007-05-21
17:30:28 UTC (rev 3165)
@@ -0,0 +1,127 @@
+/*
+ * 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.wsf.stack.xfire;
+
+//$Id$
+
+import java.io.IOException;
+import java.net.URL;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.codehaus.xfire.XFire;
+import org.codehaus.xfire.service.Service;
+import org.codehaus.xfire.transport.http.XFireServletController;
+import org.jboss.logging.Logger;
+import org.jboss.ws.integration.UnifiedVirtualFile;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.EndpointAssociation;
+
+/**
+ * An extension to the XFire servlet controller
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 21-Apr-2007
+ */
+public class XFireServletControllerExt extends XFireServletController
+{
+ private static Logger log = Logger.getLogger(XFireServletControllerExt.class);
+
+ public XFireServletControllerExt(XFire xfire, ServletContext servletContext)
+ {
+ super(xfire, servletContext);
+ }
+
+ protected String getService(HttpServletRequest request)
+ {
+ Endpoint ep = EndpointAssociation.getEndpoint();
+ String serviceName = ep.getShortName();
+ return serviceName;
+ }
+
+ protected void generateWSDL(HttpServletResponse response, String service) throws
ServletException, IOException
+ {
+ Service userService = getXFire().getServiceRegistry().getService(service);
+ Object value = userService.getProperty(Service.DISABLE_WSDL_GENERATION);
+ boolean isWSDLDisabled = "true".equalsIgnoreCase((value != null ?
value.toString() : null));
+ if (isWSDLDisabled)
+ {
+ log.warn("WSDL generation disabled for service :" + service);
+ response.sendError(404, "No wsdl is avaiable for this service");
+ return;
+ }
+
+ response.setStatus(200);
+ response.setContentType("text/xml");
+
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Endpoint ep = EndpointAssociation.getEndpoint();
+ UnifiedVirtualFile rootFile = ep.getService().getDeployment().getRootFile();
+ Thread.currentThread().setContextClassLoader(new
VirtualFileClassLoader(rootFile, ctxLoader));
+ getXFire().generateWSDL(service, response.getOutputStream());
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ }
+
+ /*
+ * For some reason
WebAppClassLoader.getResource("WEB-INF/wsdl/TestEndpoint.wsdl")
+ * fails when the war is deployed as part of an ear deployment.
+ *
+ * This ClassLoader falls back to the VFS to find the resource URL.
+ */
+ static class VirtualFileClassLoader extends ClassLoader
+ {
+ private UnifiedVirtualFile vFile;
+
+ public VirtualFileClassLoader(UnifiedVirtualFile file, ClassLoader parent)
+ {
+ super(parent);
+ vFile = file;
+ }
+
+ @Override
+ public URL getResource(String name)
+ {
+ URL url = super.getResource(name);
+ if (url == null)
+ {
+ try
+ {
+ url = vFile.findChild(name).toURL();
+ }
+ catch (IOException e)
+ {
+ // ignore
+ }
+ }
+ return url;
+ }
+ }
+}
Deleted:
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireServletControllerJBWS.java
===================================================================
---
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireServletControllerJBWS.java 2007-05-21
15:15:49 UTC (rev 3164)
+++
branches/tdiesler/trunk/integration/xfire/src/main/java/org/jboss/wsf/stack/xfire/XFireServletControllerJBWS.java 2007-05-21
17:30:28 UTC (rev 3165)
@@ -1,53 +0,0 @@
-/*
- * 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.wsf.stack.xfire;
-
-//$Id$
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-
-import org.codehaus.xfire.XFire;
-import org.codehaus.xfire.transport.http.XFireServletController;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.EndpointAssociation;
-
-/**
- * An extension to the XFire servlet controller
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 21-Apr-2007
- */
-public class XFireServletControllerJBWS extends XFireServletController
-{
- public XFireServletControllerJBWS(XFire xfire, ServletContext servletContext)
- {
- super(xfire, servletContext);
- }
-
- protected String getService(HttpServletRequest request)
- {
- Endpoint ep = EndpointAssociation.getEndpoint();
- String serviceName = ep.getShortName();
- return serviceName;
- }
-}
Modified:
branches/tdiesler/trunk/integration/xfire/src/main/resources/jbossws-jboss50.sar/META-INF/jbossws-beans.xml
===================================================================
---
branches/tdiesler/trunk/integration/xfire/src/main/resources/jbossws-jboss50.sar/META-INF/jbossws-beans.xml 2007-05-21
15:15:49 UTC (rev 3164)
+++
branches/tdiesler/trunk/integration/xfire/src/main/resources/jbossws-jboss50.sar/META-INF/jbossws-beans.xml 2007-05-21
17:30:28 UTC (rev 3165)
@@ -159,7 +159,7 @@
<bean name="WSSecurityRolesHandlerEJB21"
class="org.jboss.wsf.container.jboss50.SecurityRolesHandlerEJB21"/>
<bean name="WSSecurityRolesHandlerEJB3"
class="org.jboss.wsf.container.jboss50.SecurityRolesHandlerEJB3"/>
<bean name="WSWebAppDesciptorModifier"
class="org.jboss.wsf.stack.xfire.WebAppDesciptorModifierImpl">
- <property
name="servletClass">org.jboss.wsf.stack.xfire.XFireConfigurableServletJBWS</property>
+ <property
name="servletClass">org.jboss.wsf.stack.xfire.XFireConfigurableServletExt</property>
</bean>
<bean name="WSWebXMLRewriter"
class="org.jboss.wsf.spi.deployment.WebXMLRewriter">
<property name="desciptorModifier"><inject
bean="WSWebAppDesciptorModifier"/></property>
Modified:
branches/tdiesler/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/eardeployment/EarTestCase.java
===================================================================
---
branches/tdiesler/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/eardeployment/EarTestCase.java 2007-05-21
15:15:49 UTC (rev 3164)
+++
branches/tdiesler/trunk/testsuite/src/java/org/jboss/test/ws/jaxws/eardeployment/EarTestCase.java 2007-05-21
17:30:28 UTC (rev 3165)
@@ -63,10 +63,9 @@
assertEquals(helloWorld, retObj);
}
- public void _testJSEEndpoint() throws Exception
+ public void testJSEEndpoint() throws Exception
{
- //String endpointAddress = "http://" + getServerHost() +
":8080/earjse/JSEBean";
- String soapAddress = "http://" + getServerHost() +
":8080/jaxws-eardeployment/JSEBean";
+ String soapAddress = "http://" + getServerHost() +
":8080/earjse/JSEBean";
QName serviceName = new QName("http://eardeployment.jaxws/",
"TestEndpointService");
Service service = Service.create(new URL(soapAddress + "?wsdl"),
serviceName);
TestEndpoint port = service.getPort(TestEndpoint.class);