Author: alessio.soldano(a)jboss.com
Date: 2010-05-07 07:23:25 -0400 (Fri, 07 May 2010)
New Revision: 12188
Added:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSResourceResolver.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ResourceResolverDeploymentAspect.java
Modified:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/resources/jbossws-cxf-config.xml
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/resources/jbossws-cxf.sar/META-INF/spring.schemas
stack/cxf/branches/jbossws-cxf-3.1.2/pom.xml
Log:
[JBPAPP-4124] Move to Apache CXF 2.2.5 (merge revisions 11132,11173)
Modified:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
===================================================================
---
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2010-05-07
11:20:29 UTC (rev 12187)
+++
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2010-05-07
11:23:25 UTC (rev 12188)
@@ -33,8 +33,18 @@
import javax.servlet.http.HttpServletResponse;
import javax.xml.ws.WebServiceException;
+import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
-import org.apache.cxf.transport.DestinationFactory;
+import org.apache.cxf.binding.soap.SoapTransportFactory;
+import org.apache.cxf.configuration.Configurer;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.endpoint.ServerRegistry;
+import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
+import org.apache.cxf.jaxws.support.JaxWsImplementorInfo;
+import org.apache.cxf.management.InstrumentationManager;
+import org.apache.cxf.management.counters.CounterRepository;
+import org.apache.cxf.resource.ResourceManager;
+import org.apache.cxf.resource.ResourceResolver;
import org.apache.cxf.transport.DestinationFactoryManager;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.apache.cxf.transport.servlet.ServletController;
@@ -74,16 +84,6 @@
public void init(ServletConfig servletConfig) throws ServletException
{
super.init(servletConfig);
-
- // Init the Endpoint
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- epRegistry =
spiProvider.getSPI(EndpointRegistryFactory.class).getEndpointRegistry();
-
- ServletContext context = servletConfig.getServletContext();
- String contextPath = context.getContextPath();
- endpoint = initServiceEndpoint(contextPath);
-
- context.setAttribute(ServletController.class.getName(), getController());
}
@Override
@@ -101,15 +101,41 @@
ServletContext svCtx = getServletContext();
ApplicationContext appCtx =
(ApplicationContext)svCtx.getAttribute("org.springframework.web.context.WebApplicationContext.ROOT");
+ Bus bus = getBus();
+
//Install our SoapTransportFactory to allow for proper soap address rewrite
- DestinationFactoryManager dfm =
getBus().getExtension(DestinationFactoryManager.class);
- DestinationFactory factory = new SoapTransportFactoryExt();
+ DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
+ SoapTransportFactory factory = new SoapTransportFactoryExt();
+ factory.setBus(bus);
dfm.registerDestinationFactory(Constants.NS_SOAP11, factory);
dfm.registerDestinationFactory(Constants.NS_SOAP12, factory);
+
+ //Init the Endpoint
+ initEndpoint(servletConfig);
+ //Load additional configurations
loadAdditionalConfigExt(appCtx, servletConfig);
}
+ private void initEndpoint(ServletConfig servletConfig)
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ epRegistry =
spiProvider.getSPI(EndpointRegistryFactory.class).getEndpointRegistry();
+
+ ServletContext context = servletConfig.getServletContext();
+ String contextPath = context.getContextPath();
+ endpoint = initServiceEndpoint(contextPath);
+
+ //Install the JBossWS resource resolver
+ ResourceResolver resourceResolver =
endpoint.getAttachment(ResourceResolver.class);
+ if (resourceResolver != null)
+ {
+ bus.getExtension(ResourceManager.class).addResourceResolver(resourceResolver);
+ }
+
+ context.setAttribute(ServletController.class.getName(), getController());
+ }
+
private void loadAdditionalConfigExt(ApplicationContext ctx, ServletConfig
servletConfig) throws ServletException
{
String location =
servletConfig.getServletContext().getInitParameter(PARAM_CXF_BEANS_URL);
Modified:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java
===================================================================
---
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java 2010-05-07
11:20:29 UTC (rev 12187)
+++
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java 2010-05-07
11:23:25 UTC (rev 12188)
@@ -26,6 +26,10 @@
import java.util.HashMap;
import java.util.Map;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.soap.MTOM;
+import javax.xml.ws.soap.SOAPBinding;
+
import org.jboss.logging.Logger;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Deployment;
@@ -35,10 +39,6 @@
import org.jboss.wsf.stack.cxf.metadata.services.DDBeans;
import org.jboss.wsf.stack.cxf.metadata.services.DDEndpoint;
-import javax.xml.ws.BindingType;
-import javax.xml.ws.soap.SOAPBinding;
-import javax.xml.ws.soap.MTOM;
-
/**
* A deployer that locates or generates cxf.xml
*
@@ -139,7 +139,7 @@
{
// get resource URL
ArchiveDeployment archDep = (ArchiveDeployment)dep;
- cxfURL = archDep.getMetaDataFileURL(metadir + "/jbossws-cxf.xml");
+ cxfURL = archDep.getResourceResolver().resolve(metadir +
"/jbossws-cxf.xml");
log.info("JBossWS-CXF configuration found: " + cxfURL);
}
catch (IOException ignore)
@@ -199,6 +199,7 @@
* @param dep deployment where to put
* @param cxfURL to be put
*/
+ @SuppressWarnings("unchecked")
private void putCXFConfigToDeployment(Deployment dep, URL cxfURL)
{
// get property map
Copied:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSResourceResolver.java
(from rev 11132,
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSResourceResolver.java)
===================================================================
---
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSResourceResolver.java
(rev 0)
+++
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSResourceResolver.java 2010-05-07
11:23:25 UTC (rev 12188)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.cxf;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.cxf.resource.ResourceResolver;
+import org.jboss.logging.Logger;
+
+/**
+ * A CXF resource resolver that uses the JBossWS spi resource resolver,
+ * which in turn uses unified virtual files to access resources attached
+ * to the deployment (via JBoss VFS).
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 17-Nov-2009
+ *
+ */
+public class JBossWSResourceResolver implements ResourceResolver
+{
+ private static Logger log = Logger.getLogger(JBossWSResourceResolver.class);
+ private org.jboss.wsf.spi.deployment.ResourceResolver resolver;
+
+ public JBossWSResourceResolver(org.jboss.wsf.spi.deployment.ResourceResolver
resolver)
+ {
+ this.resolver = resolver;
+ }
+
+ public InputStream getAsStream(String resourcePath)
+ {
+ URL url = resolve(resourcePath, URL.class);
+ if (url != null)
+ {
+ try
+ {
+ return url.openStream();
+ }
+ catch (IOException ioe)
+ {
+ log.warn("Cannot open stream for resource: " + resourcePath);
+ }
+ }
+ return null;
+ }
+
+ public <T> T resolve(String resourcePath, Class<T> resourceType)
+ {
+ URL url = null;
+ try
+ {
+ url = resolver.resolve(resourcePath);
+ }
+ catch (IOException ioe)
+ {
+ log.warn("Cannot resolve resource: " + resourcePath);
+ }
+ if (url != null && resourceType.isInstance(url))
+ {
+ return resourceType.cast(url);
+ }
+ return null;
+ }
+
+}
Copied:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ResourceResolverDeploymentAspect.java
(from rev 11132,
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ResourceResolverDeploymentAspect.java)
===================================================================
---
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ResourceResolverDeploymentAspect.java
(rev 0)
+++
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ResourceResolverDeploymentAspect.java 2010-05-07
11:23:25 UTC (rev 12188)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.cxf;
+
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.DeploymentAspect;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.ResourceResolver;
+
+/**
+ * A deployment aspect for attaching a custom JBoss resources resolver to the endpoint;
+ * CXF requires a ResourceResolver for getting wsdl, xsd, etc. correctly when
they're
+ * not reachable using the context classloader (for instance if they're out of
+ * WEB-INF/classes in a war deployed on AS 5 or greater - see. JBAS-5151)
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 19-Nov-2009
+ */
+public class ResourceResolverDeploymentAspect extends DeploymentAspect
+{
+ @Override
+ public void start(Deployment dep)
+ {
+ if (dep instanceof ArchiveDeployment)
+ {
+ ResourceResolver resolver = ((ArchiveDeployment)dep).getResourceResolver();
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ ep.addAttachment(org.apache.cxf.resource.ResourceResolver.class, new
JBossWSResourceResolver(resolver));
+ }
+ }
+ }
+
+ @Override
+ public void stop(Deployment dep)
+ {
+ if (dep instanceof ArchiveDeployment)
+ {
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ ep.removeAttachment(org.apache.cxf.resource.ResourceResolver.class);
+ }
+ }
+ }
+}
Modified:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/resources/jbossws-cxf-config.xml
===================================================================
---
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/resources/jbossws-cxf-config.xml 2010-05-07
11:20:29 UTC (rev 12187)
+++
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/resources/jbossws-cxf-config.xml 2010-05-07
11:23:25 UTC (rev 12188)
@@ -64,6 +64,11 @@
<property
name="invokerEJB3">org.jboss.wsf.stack.cxf.InvokerEJB3</property>
<property
name="invokerJSE">org.jboss.wsf.stack.cxf.InvokerJSE</property>
</bean>
+
+ <bean name="ResourceResolverDeploymentAspect"
class="org.jboss.wsf.stack.cxf.ResourceResolverDeploymentAspect">
+ <property name="requires">StackDescriptor</property>
+ <property name="provides">ResourceResolver</property>
+ </bean>
<bean name="WSCXFEndpointHandlerDeploymentAspect"
class="org.jboss.wsf.framework.deployment.EndpointHandlerDeploymentAspect">
<property name="requires">ContainerEndpointHandler</property>
@@ -103,6 +108,7 @@
<property name="sortAspectsOnCreate">true</property>
<property name="aspects">
<set class="java.util.HashSet"
elementClass="org.jboss.wsf.spi.deployment.DeploymentAspect">
+ <inject bean="ResourceResolverDeploymentAspect"/>
<inject bean="WSCXFEndpointHandlerDeploymentAspect"/>
<inject bean="WSCXFEndpointRecordProcessorDeploymentAspect"/>
</set>
@@ -119,6 +125,7 @@
<inject bean="WSCXFEndpointHandlerDeploymentAspect"/>
<inject bean="WSCXFEndpointRecordProcessorDeploymentAspect"/>
<inject bean="WSCXFDescriptorDeploymentAspect"/>
+ <inject bean="ResourceResolverDeploymentAspect"/>
</set>
</property>
<depends>WSDeploymentAspectInstallerEJB</depends>
Modified:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/resources/jbossws-cxf.sar/META-INF/spring.schemas
===================================================================
---
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/resources/jbossws-cxf.sar/META-INF/spring.schemas 2010-05-07
11:20:29 UTC (rev 12187)
+++
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/resources/jbossws-cxf.sar/META-INF/spring.schemas 2010-05-07
11:23:25 UTC (rev 12188)
@@ -45,6 +45,7 @@
http\://schemas.xmlsoap.org/ws/2004/08/addressing=schemas/wsdl/addressing.xsd
http\://cxf.apache.org/schemas/configuration/security.xsd=schemas/configuration/security.xsd
+http\://cxf.apache.org/schemas/configuration/parameterized-types.xsd=schemas/configuration/parameterized-types.xsd
#
Modified: stack/cxf/branches/jbossws-cxf-3.1.2/pom.xml
===================================================================
--- stack/cxf/branches/jbossws-cxf-3.1.2/pom.xml 2010-05-07 11:20:29 UTC (rev 12187)
+++ stack/cxf/branches/jbossws-cxf-3.1.2/pom.xml 2010-05-07 11:23:25 UTC (rev 12188)
@@ -52,8 +52,7 @@
<jbossws.jboss510.version>3.1.0-SNAPSHOT</jbossws.jboss510.version>
-->
<!-- END -->
- <cxf.version>2.2.4</cxf.version>
- <cxf.anttasks.version>2.1.5</cxf.anttasks.version>
+ <cxf.version>2.2.5</cxf.version>
<cxf.spring.version>2.5.6.SEC01</cxf.spring.version>
<cxf.stax.version>1.0.1</cxf.stax.version>
<cxf.asm.version>3.1</cxf.asm.version>
@@ -73,7 +72,7 @@
<saaj.api.version>1.3</saaj.api.version>
<velocity.version>1.5</velocity.version>
<xmlsec.version>1.4.3</xmlsec.version>
- <wstx.version>3.2.8</wstx.version>
+ <wstx.version>3.2.9</wstx.version>
</properties>
@@ -171,11 +170,6 @@
<!-- CXF dependencies -->
<dependency>
<groupId>org.apache.cxf</groupId>
- <artifactId>cxf-anttasks</artifactId>
- <version>${cxf.anttasks.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>${cxf.version}</version>
</dependency>