Author: alessio.soldano(a)jboss.com
Date: 2010-04-01 13:21:15 -0400 (Thu, 01 Apr 2010)
New Revision: 11925
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/WSDLFilePublisher.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/ResourceResolverDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/SecurityActions.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/JBossWSResourceResolver.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/WebAppResolver.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/AddressRewritingEndpointInfo.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/SoapTransportFactoryExt.java
Removed:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AddressRewritingEndpointInfo.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/BusDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSResourceResolver.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ResourceResolverDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/SecurityActions.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/SoapTransportFactoryExt.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/WSDLFilePublisher.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/WebAppResolver.java
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerCXFConfigurer.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as5.xml
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml
Log:
[JBWS-2971] reorganizing classes for server integration
Deleted:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AddressRewritingEndpointInfo.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AddressRewritingEndpointInfo.java 2010-04-01
16:07:54 UTC (rev 11924)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AddressRewritingEndpointInfo.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -1,214 +0,0 @@
-/*
- * 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.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-
-import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.cxf.tools.common.extensions.soap.SoapAddress;
-import org.jboss.logging.Logger;
-import org.jboss.wsf.spi.management.ServerConfig;
-
-/**
- * A custom EndpointInfo that updates the SoapAddress extension
- * coming from the wsdl definition according to the JBossWS
- * soap address rewrite rules.
- *
- * @see org.apache.cxf.binding.soap.SoapTransportFactory.SoapEndpointInfo
- *
- * @author alessio.soldano(a)jboss.com
- * @since 03-Aug-2009
- *
- */
-public class AddressRewritingEndpointInfo extends EndpointInfo
-{
- private static Logger log = Logger.getLogger(AddressRewritingEndpointInfo.class);
-
- private ServerConfig serverConfig;
- SoapAddress saddress;
-
- AddressRewritingEndpointInfo(ServiceInfo serv, String trans, ServerConfig
serverConfig)
- {
- super(serv, trans);
- this.serverConfig = serverConfig;
- }
-
- /**
- * This is the method responsible for both setting the EndpointInfo address and
- * setting the soap:address in the wsdl.
- * While the former action is straightforward, the latter is performed according
- * to the JBossWS configuration: every time CXF updates the EndpointInfo address
- * (which usually happens twice) this makes sure a proper address is updated in
- * the wsdl.
- *
- * {@inheritDoc}
- */
- public void setAddress(String s)
- {
- String previousAddress = super.getAddress();
- super.setAddress(s);
- boolean setNewAddress = false;
- if (previousAddress == null)
- {
- setNewAddress = true;
- }
- else if (isRewriteAllowed(s) && isRewriteRequired(s, previousAddress))
- {
- String uriScheme = getUriScheme(s);
- //we set https if the transport guarantee is CONFIDENTIAL or the previous
address already used https
- //(if the original wsdl soap:address uses https we can't overwrite it with
http)
- if ("https".equalsIgnoreCase(getUriScheme(previousAddress)))
- {
- uriScheme = "https";
- }
- if (uriScheme == null)
- {
- uriScheme = "http";
- }
- //rewrite the candidate new address
- s = rewriteSoapAddress(s, uriScheme);
- setNewAddress = true;
- }
- if (setNewAddress && saddress != null)
- {
- log.info("Setting new service endpoint address in wsdl: " + s);
- saddress.setLocationURI(s);
- }
- }
-
- public void addExtensor(Object el)
- {
- super.addExtensor(el);
- if (el instanceof SoapAddress)
- {
- saddress = (SoapAddress)el;
- }
- }
-
- protected boolean isRewriteAllowed(String address)
- {
- //exclude non http addresses
- return (address != null &&
address.trim().toLowerCase().startsWith("http"));
- }
-
-
- protected boolean isRewriteRequired(String address, String previousAddress)
- {
- //check config prop forcing address rewrite
- if (serverConfig.isModifySOAPAddress())
- {
- log.debug("Rewrite required because of configuration");
- return true;
- }
- //check if the previous address is not valid
- if (isInvalidAddress(previousAddress))
- {
- log.debug("Rewrite required because of invalid url");
- return true;
- }
- log.debug("Rewrite not required");
- return false;
- }
-
- protected boolean isInvalidAddress(String address)
- {
- if (address == null)
- {
- return true;
- }
- String s = address.trim();
- if (s.length() == 0 || s.contains("REPLACE_WITH_ACTUAL_URL"))
- {
- return true;
- }
- try
- {
- new URL(s);
- }
- catch (Exception e)
- {
- return true;
- }
- return false;
- }
-
- /**
- * Rewrite the provided address according to the current server
- * configuration and always using the specified uriScheme.
- *
- * @param s The source address
- * @param uriScheme The uriScheme to use for rewrite
- * @return The obtained address
- */
- protected String rewriteSoapAddress(String s, String uriScheme)
- {
- try
- {
- URL url = new URL(s);
- String path = url.getPath();
- String host = serverConfig.getWebServiceHost();
- String port = "";
- if ("https".equals(uriScheme))
- {
- int portNo = serverConfig.getWebServiceSecurePort();
- if (portNo != 443)
- {
- port = ":" + portNo;
- }
- }
- else
- {
- int portNo = serverConfig.getWebServicePort();
- if (portNo != 80)
- {
- port = ":" + portNo;
- }
- }
- String urlStr = uriScheme + "://" + host + port + path;
- log.debug("Rewritten new candidate service endpoint address '" + s
+ "' to '" + urlStr + "'");
- return urlStr;
- }
- catch (Exception e)
- {
- log.debug("Invalid url provided, using it without rewriting: " + s);
- return s;
- }
- }
-
- private static String getUriScheme(String address)
- {
- try
- {
- URI addrURI = new URI(address);
- String scheme = addrURI.getScheme();
- return scheme;
- }
- catch (Exception e)
- {
- return null;
- }
- }
-}
\ No newline at end of file
Deleted:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/BusDeploymentAspect.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/BusDeploymentAspect.java 2010-04-01
16:07:54 UTC (rev 11924)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/BusDeploymentAspect.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -1,122 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, 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.net.URL;
-import java.util.Map;
-
-import org.apache.cxf.BusFactory;
-import org.jboss.ws.Constants;
-import org.jboss.wsf.common.integration.AbstractDeploymentAspect;
-import org.jboss.wsf.common.integration.WSConstants;
-import org.jboss.wsf.spi.binding.BindingCustomization;
-import org.jboss.wsf.spi.deployment.ArchiveDeployment;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.ResourceResolver;
-import org.jboss.wsf.stack.cxf.client.configuration.JBossWSCXFConfigurer;
-import org.jboss.wsf.stack.cxf.configuration.BusHolder;
-
-/**
- * A deployment aspect that creates the CXF Bus early and attaches it to the endpoints
(wrapped in a BusHolder)
- *
- * @author alessio.soldano(a)jboss.com
- * @since 25-Mar-2010
- */
-public class BusDeploymentAspect extends AbstractDeploymentAspect
-{
- @SuppressWarnings("unchecked")
- @Override
- public void start(Deployment dep)
- {
- if (Constants.LAZY_LOAD_CXF_BUS)
- return;
-
- log.debug("Lazy load of CXF bus disabled, loading bus during
deployment...");
- BusHolder holder;
- ClassLoader origClassLoader = SecurityActions.getContextClassLoader();
- try
- {
- ArchiveDeployment aDep = (ArchiveDeployment)dep;
- //set the runtime classloader (pointing to the deployment unit) to allow CXF
accessing to the classes
- SecurityActions.setContextClassLoader(dep.getRuntimeClassLoader());
-
- ResourceResolver deploymentResolver = aDep.getResourceResolver();
-
- URL cxfServletURL = null;
- try
- {
- cxfServletURL =
deploymentResolver.resolve("WEB-INF/cxf-servlet.xml");
- }
- catch (IOException e)
- {
- } //ignore, cxf-servlet.xml is optional, we might even decide not to support
this
-
- holder = BusHolder.create(cxfServletURL);
-
- Map<String, String> contextParams = (Map<String,
String>)dep.getProperty(WSConstants.STACK_CONTEXT_PARAMS);
- try
- {
- URL jbossCxfXml =
deploymentResolver.resolve(contextParams.get(BusHolder.PARAM_CXF_BEANS_URL));
- org.apache.cxf.resource.ResourceResolver resolver = new
JBossWSResourceResolver(deploymentResolver);
- JBossWSCXFConfigurer configurer =
holder.createConfigurer(dep.getAttachment(BindingCustomization.class), new
WSDLFilePublisher(aDep));
- holder.configure(jbossCxfXml, new SoapTransportFactoryExt(), resolver,
configurer);
- }
- catch (IOException e)
- {
- throw new RuntimeException(e); //re-throw, jboss-cxf.xml is required
- }
- }
- finally
- {
- //clean threadlocals in BusFactory and restore the original classloader
- BusFactory.setDefaultBus(null);
- BusFactory.setThreadDefaultBus(null);
- SecurityActions.setContextClassLoader(origClassLoader);
- }
-
- for (Endpoint endpoint : dep.getService().getEndpoints())
- {
- endpoint.addAttachment(BusHolder.class, holder);
- }
- dep.addAttachment(BusHolder.class, holder);
- }
-
- @Override
- public void stop(Deployment dep)
- {
- for (Endpoint endpoint : dep.getService().getEndpoints())
- {
- BusHolder holder = endpoint.removeAttachment(BusHolder.class);
- if (holder != null)
- {
- holder.close();
- }
- }
- BusHolder holder = dep.removeAttachment(BusHolder.class);
- if (holder != null)
- {
- holder.close();
- }
- }
-}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2010-04-01
16:07:54 UTC (rev 11924)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -57,6 +57,7 @@
import org.jboss.wsf.stack.cxf.client.configuration.JBossWSCXFConfigurer;
import org.jboss.wsf.stack.cxf.configuration.BusHolder;
import org.jboss.wsf.stack.cxf.management.InstrumentationManagerExtImpl;
+import org.jboss.wsf.stack.cxf.transport.SoapTransportFactoryExt;
import org.springframework.context.ApplicationContext;
/**
Deleted:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java 2010-04-01
16:07:54 UTC (rev 11924)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -1,236 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.net.URL;
-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.common.integration.AbstractDeploymentAspect;
-import org.jboss.wsf.common.integration.WSConstants;
-import org.jboss.wsf.spi.deployment.ArchiveDeployment;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
-import org.jboss.wsf.stack.cxf.configuration.BusHolder;
-import org.jboss.wsf.stack.cxf.metadata.services.DDBeans;
-import org.jboss.wsf.stack.cxf.metadata.services.DDEndpoint;
-
-/**
- * A deployer that locates or generates cxf.xml
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-May-2007
- */
-public class DescriptorDeploymentAspect extends AbstractDeploymentAspect
-{
- // provide logging
- private final Logger log = Logger.getLogger(DescriptorDeploymentAspect.class);
-
- private String invokerEJB3;
- private String invokerJSE;
-
- public void setInvokerEJB3(String invokerEJB3)
- {
- this.invokerEJB3 = invokerEJB3;
- }
-
- public void setInvokerJSE(String invokerJSE)
- {
- this.invokerJSE = invokerJSE;
- }
-
- @Override
- public void start(Deployment dep)
- {
- URL cxfURL = getCXFConfigFromClassLoader(dep);
- if (cxfURL == null)
- {
- cxfURL = getCXFConfigFromDeployment(dep);
- if (cxfURL == null)
- {
- cxfURL = generateCXFConfigFromDeployment(dep);
- }
- putCXFConfigToDeployment(dep, cxfURL);
- }
- }
-
- @Override
- public void stop(Deployment dep)
- {
- DDBeans dd = dep.getAttachment(DDBeans.class);
- if (dd != null)
- {
- dd.destroyFileURL();
- }
- }
-
- /**
- * Looks for <b>cxf.xml</b> in classloader
- * @param dep deployment which initial classloader will be used
- * @return <b>cxf.xml URL</b> or <b>null</b> if not found
- */
- private URL getCXFConfigFromClassLoader(Deployment dep)
- {
- ClassLoader initCL = dep.getInitialClassLoader();
- URL cxfURL = initCL.getResource("cxf.xml");
- if (cxfURL != null)
- {
- log.info("CXF configuration found: " + cxfURL);
- }
- return cxfURL;
- }
-
- /**
- * Looks for <b>jbossws-cxf.xml</b> in:
- * <ul>
- * <li><b>META-INF</b> resource directory for EJB3
deployment</li>
- * <li><b>WEB-INF</b> resource directory for POJO
deployment</li>
- * </ul>
- * @param dep deployment where to look for resources
- * @return <b>jbossws-cxf.xml URL</b> or <b>null</b> if not
found
- */
- private URL getCXFConfigFromDeployment(Deployment dep)
- {
- DeploymentType depType = dep.getType();
-
- String metadir;
- if (depType == DeploymentType.JAXWS_EJB3)
- {
- // expected resource location for EJB3 deployments
- metadir = "META-INF";
- }
- else if (depType == DeploymentType.JAXWS_JSE)
- {
- // expected resource location for POJO deployments
- metadir = "WEB-INF";
- }
- else
- {
- // only POJO and EJB3 deployments are supported
- throw new IllegalStateException("Unsupported deployment type: " +
depType);
- }
-
- URL cxfURL = null;
- try
- {
- // get resource URL
- ArchiveDeployment archDep = (ArchiveDeployment)dep;
- cxfURL = archDep.getResourceResolver().resolve(metadir +
"/jbossws-cxf.xml");
- log.info("JBossWS-CXF configuration found: " + cxfURL);
- }
- catch (IOException ignore)
- {
- // resource not found
- }
-
- return cxfURL;
- }
-
- /**
- * Generated CXF descriptor from deployment
- * @param dep deployment
- * @return CXF descriptor URL
- */
- private URL generateCXFConfigFromDeployment(Deployment dep)
- {
- // Generate the jbossws-cxf.xml descriptor
- DeploymentType depType = dep.getType();
-
- DDBeans dd = new DDBeans();
- for (Endpoint ep : dep.getService().getEndpoints())
- {
- String id = ep.getShortName();
- String address = ep.getAddress();
- String implementor = ep.getTargetBeanName();
-
- boolean mtomEnabled = isMtomEnabled(ep.getTargetBeanClass());
-
- DDEndpoint ddep = new DDEndpoint(id, address, implementor, mtomEnabled);
-
- if (depType == DeploymentType.JAXWS_EJB3)
- {
- ddep.setInvoker(invokerEJB3);
- }
-
- if (depType == DeploymentType.JAXWS_JSE)
- {
- ddep.setInvoker(invokerJSE);
- }
-
-
- log.info("Add " + ddep);
- dd.addEndpoint(ddep);
- }
-
- URL cxfURL = dd.createFileURL();
- log.info("JBossWS-CXF configuration generated: " + cxfURL);
-
- dep.addAttachment(DDBeans.class, dd);
-
- return cxfURL;
- }
-
- /**
- * Puts CXF config file reference to the stack specific context properties.
- *
- * @param dep webservice deployment
- * @param cxfURL CXF DD URL
- * @see org.jboss.wsf.common.integration.WSConstants.STACK_CONTEXT_PARAMS
- */
- @SuppressWarnings("unchecked")
- private void putCXFConfigToDeployment(Deployment dep, URL cxfURL)
- {
- // get property map
- Map<String, String> contextParams = (Map<String,
String>)dep.getProperty(WSConstants.STACK_CONTEXT_PARAMS);
- if (contextParams == null)
- {
- // if there's no associated map with the property create it now
- contextParams = new HashMap<String, String>();
- dep.setProperty(WSConstants.STACK_CONTEXT_PARAMS, contextParams);
- }
- // put cxf config URL to the property map
- contextParams.put(BusHolder.PARAM_CXF_BEANS_URL, cxfURL.toExternalForm());
- }
-
- private static boolean isMtomEnabled(Class<?> beanClass)
- {
- BindingType bindingType = (BindingType)beanClass.getAnnotation(BindingType.class);
- MTOM mtom = (MTOM)beanClass.getAnnotation(MTOM.class);
-
- boolean mtomEnabled = mtom != null;
- if (!mtomEnabled && bindingType != null)
- {
- String binding = bindingType.value();
- mtomEnabled = binding.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) ||
binding.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING);
- }
-
- return mtomEnabled;
- }
-
-}
Deleted:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSResourceResolver.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSResourceResolver.java 2010-04-01
16:07:54 UTC (rev 11924)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSResourceResolver.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -1,85 +0,0 @@
-/*
- * 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;
- }
-
-}
Deleted:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ResourceResolverDeploymentAspect.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ResourceResolverDeploymentAspect.java 2010-04-01
16:07:54 UTC (rev 11924)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ResourceResolverDeploymentAspect.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -1,65 +0,0 @@
-/*
- * 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.common.integration.AbstractDeploymentAspect;
-import org.jboss.wsf.spi.deployment.ArchiveDeployment;
-import org.jboss.wsf.spi.deployment.Deployment;
-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 AbstractDeploymentAspect
-{
- @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);
- }
- }
- }
-}
Deleted:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/SecurityActions.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/SecurityActions.java 2010-04-01
16:07:54 UTC (rev 11924)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/SecurityActions.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -1,82 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, 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.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- *
- * @author alessio.soldano(a)jboss.com
- * @since 26-Mar-2010
- *
- */
-class SecurityActions
-{
- /**
- * Get context classloader.
- *
- * @return the current context classloader
- */
- static ClassLoader getContextClassLoader()
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm == null)
- {
- return Thread.currentThread().getContextClassLoader();
- }
- else
- {
- return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
{
- public ClassLoader run()
- {
- return Thread.currentThread().getContextClassLoader();
- }
- });
- }
- }
-
- /**
- * Set context classloader.
- *
- * @param classLoader the classloader
- */
- static void setContextClassLoader(final ClassLoader classLoader)
- {
- if (System.getSecurityManager() == null)
- {
- Thread.currentThread().setContextClassLoader(classLoader);
- }
- else
- {
- AccessController.doPrivileged(new PrivilegedAction<Object>()
- {
- public Object run()
- {
- Thread.currentThread().setContextClassLoader(classLoader);
- return null;
- }
- });
- }
- }
-
-}
Deleted:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/SoapTransportFactoryExt.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/SoapTransportFactoryExt.java 2010-04-01
16:07:54 UTC (rev 11924)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/SoapTransportFactoryExt.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -1,99 +0,0 @@
-/*
- * 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.net.MalformedURLException;
-import java.net.URL;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.wsdl.Port;
-
-import org.apache.cxf.binding.soap.SoapTransportFactory;
-import org.apache.cxf.binding.soap.model.SoapBindingInfo;
-import org.apache.cxf.service.model.BindingInfo;
-import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.cxf.tools.common.extensions.soap.SoapAddress;
-import org.apache.cxf.tools.util.SOAPBindingUtil;
-import org.jboss.logging.Logger;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.spi.management.ServerConfigFactory;
-
-/**
- * A SoapTransportFactory extending @see
org.apache.cxf.binding.soap.SoapTransportFactory.
- * It overrides the EndpointInfo creation method to allow for the soap:address extension
- * of the wsdl to be overwritten according to the JBossWS configuration.
- *
- * @author alessio.soldano(a)jboss.com
- * @since 31-Jul-2009
- *
- */
-public class SoapTransportFactoryExt extends SoapTransportFactory
-{
- private ServerConfig serverConfig;
-
- public EndpointInfo createEndpointInfo(ServiceInfo serviceInfo, BindingInfo b, Port
port)
- {
- String transportURI = "http://schemas.xmlsoap.org/wsdl/soap/";
- if (b instanceof SoapBindingInfo)
- {
- SoapBindingInfo sbi = (SoapBindingInfo)b;
- transportURI = sbi.getTransportURI();
- }
- ServerConfig config = getServerConfig();
- EndpointInfo info = new AddressRewritingEndpointInfo(serviceInfo, transportURI,
config);
- if (port != null)
- {
- List ees = port.getExtensibilityElements();
- for (Iterator itr = ees.iterator(); itr.hasNext();)
- {
- Object extensor = itr.next();
-
- if (SOAPBindingUtil.isSOAPAddress(extensor))
- {
- final SoapAddress sa = SOAPBindingUtil.getSoapAddress(extensor);
-
- info.addExtensor(sa);
- info.setAddress(sa.getLocationURI());
- }
- else
- {
- info.addExtensor(extensor);
- }
- }
- }
- return info;
- }
-
- private ServerConfig getServerConfig()
- {
- if (serverConfig == null)
- {
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- serverConfig = spiProvider.getSPI(ServerConfigFactory.class).getServerConfig();
- }
- return serverConfig;
- }
-}
Deleted:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/WSDLFilePublisher.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/WSDLFilePublisher.java 2010-04-01
16:07:54 UTC (rev 11924)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/WSDLFilePublisher.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -1,180 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, 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.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.wsdl.Definition;
-import javax.wsdl.WSDLException;
-import javax.wsdl.xml.WSDLWriter;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.cxf.staxutils.StaxUtils;
-import org.apache.cxf.wsdl.WSDLManager;
-import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.core.utils.AbstractWSDLFilePublisher;
-import org.jboss.wsf.spi.deployment.ArchiveDeployment;
-import org.w3c.dom.Document;
-
-/**
- * A WSDL file publisher for CXF based stack
- *
- * @author alessio.soldano(a)jboss.com
- * @since 25-Mar-2010
- *
- */
-public class WSDLFilePublisher extends AbstractWSDLFilePublisher
-{
- private static final Logger log = Logger.getLogger(WSDLFilePublisher.class);
-
- public WSDLFilePublisher(ArchiveDeployment dep)
- {
- super(dep);
- }
-
- /** Publish the deployed wsdl file to the data directory
- */
- public void publishWsdlFiles(QName serviceName, String wsdlLocation, Bus bus,
List<ServiceInfo> serviceInfos) throws IOException
- {
- String deploymentName = dep.getCanonicalName();
- File wsdlFile = getPublishLocation(serviceName.getLocalPart(), deploymentName,
wsdlLocation);
- wsdlFile.getParentFile().mkdirs();
- try
- {
- // Write the wsdl def to file
- ServiceWSDLBuilder builder = new ServiceWSDLBuilder(bus, serviceInfos);
- Definition def = builder.build();
-
- Document doc = getWsdlDocument(bus, def);
- writeDocument(doc, wsdlFile);
-
- URL wsdlPublishURL = wsdlFile.toURI().toURL();
- log.info("WSDL published to: " + wsdlPublishURL);
-
- // Process the wsdl imports
- if (def != null)
- {
- List<String> published = new LinkedList<String>();
- publishWsdlImports(wsdlPublishURL, def, published);
-
- // Publish XMLSchema imports
- publishSchemaImports(wsdlPublishURL, doc.getDocumentElement(), published);
- }
- else
- {
- throw new NotImplementedException("WSDL-2.0 imports");
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- throw new RuntimeException("Cannot publish wsdl to: " + wsdlFile, e);
- }
- }
-
- private static Document getWsdlDocument(Bus bus, Definition def) throws WSDLException
- {
- WSDLWriter wsdlWriter =
bus.getExtension(WSDLManager.class).getWSDLFactory().newWSDLWriter();
-
def.setExtensionRegistry(bus.getExtension(WSDLManager.class).getExtensionRegistry());
- return wsdlWriter.getDocument(def);
- }
-
- private static void writeDocument(Document doc, File file) throws IOException,
XMLStreamException
- {
- String enc = null;
- try
- {
- enc = doc.getXmlEncoding();
- }
- catch (Exception ex)
- {
- //ignore - not dom level 3
- }
- if (enc == null)
- {
- enc = "utf-8";
- }
- FileOutputStream fos = new FileOutputStream(file);
- try
- {
- XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(fos, enc);
- StaxUtils.writeNode(doc, writer, true);
- writer.flush();
- }
- finally
- {
- fos.close();
- }
- }
-
- /**
- * Get the file publish location
- */
- private File getPublishLocation(String serviceName, String archiveName, String
wsdlLocation) throws IOException
- {
- if (wsdlLocation == null && serviceName == null)
- {
- log.warn("Cannot get wsdl publish location for null wsdl location and
serviceName!");
- return null;
- }
-
- //JBWS-2829: windows issue
- if (archiveName.startsWith("http://"))
- {
- archiveName = archiveName.replace("http://", "http-");
- }
-
- File locationFile = new File(serverConfig.getServerDataDir().getCanonicalPath() +
"/wsdl/" + archiveName);
-
- File result;
- if (wsdlLocation != null && wsdlLocation.indexOf(expLocation) >= 0)
- {
- wsdlLocation = wsdlLocation.substring(wsdlLocation.indexOf(expLocation) +
expLocation.length());
- result = new File(locationFile + "/" + wsdlLocation);
- }
- else if (wsdlLocation != null &&
(wsdlLocation.startsWith("vfsfile:") ||
wsdlLocation.startsWith("file:") || wsdlLocation.startsWith("jar:") ||
wsdlLocation.startsWith("vfszip:")))
- {
- wsdlLocation = wsdlLocation.substring(wsdlLocation.lastIndexOf("/") +
1);
- result = new File(locationFile + "/" + wsdlLocation);
- }
- else
- {
- result = new File(locationFile + "/" + serviceName +
".wsdl");
- }
-
- return result;
- }
-}
Deleted:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/WebAppResolver.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/WebAppResolver.java 2010-04-01
16:07:54 UTC (rev 11924)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/WebAppResolver.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.management.EndpointResolver;
-import org.jboss.wsf.spi.deployment.Endpoint;
-
-import javax.management.ObjectName;
-import java.util.Iterator;
-
-/**
- * Resolves Endpoints by Servlet name and web context path.
- *
- * @author Heiko.Braun(a)jboss.com
- * Created: Jul 24, 2007
- */
-public class WebAppResolver implements EndpointResolver
-{
- private String contextPath;
- private String servletName;
-
- public WebAppResolver(String contextPath, String servletName)
- {
- this.contextPath = contextPath;
- this.servletName = servletName;
- }
-
- public Endpoint query(Iterator<Endpoint> endpoints)
- {
- Endpoint endpoint = null;
-
- if (contextPath.startsWith("/"))
- contextPath = contextPath.substring(1);
-
- while(endpoints.hasNext())
- {
- Endpoint auxEndpoint = endpoints.next();
- ObjectName sepId = auxEndpoint.getName();
- String propContext = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_CONTEXT);
- String propEndpoint = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
- if (servletName.equals(propEndpoint) &&
contextPath.equals(propContext))
- {
- endpoint = auxEndpoint;
- break;
- }
- }
-
- return endpoint;
- }
-}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2010-04-01
16:07:54 UTC (rev 11924)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -40,8 +40,8 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.wsf.spi.binding.BindingCustomization;
-import org.jboss.wsf.stack.cxf.WSDLFilePublisher;
import org.jboss.wsf.stack.cxf.client.configuration.JBossWSCXFConfigurer;
+import org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerCXFConfigurer.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerCXFConfigurer.java 2010-04-01
16:07:54 UTC (rev 11924)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerCXFConfigurer.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -26,9 +26,9 @@
import org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory;
import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
import org.jboss.wsf.spi.binding.BindingCustomization;
-import org.jboss.wsf.stack.cxf.WSDLFilePublisher;
import org.jboss.wsf.stack.cxf.client.configuration.JBossWSCXFConfigurer;
import org.jboss.wsf.stack.cxf.deployment.EndpointImpl;
+import org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher;
/**
* A JBossWSCXFConfigured to be used on server side
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2010-04-01
16:07:54 UTC (rev 11924)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -32,7 +32,6 @@
import org.apache.cxf.jaxws.support.JaxWsImplementorInfo;
import org.apache.cxf.service.Service;
import org.jboss.logging.Logger;
-import org.jboss.wsf.stack.cxf.WSDLFilePublisher;
/**
* An extension of @see org.apache.cxf.jaxws.EndpointImpl for dealing with
Copied:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/WSDLFilePublisher.java
(from rev 11915,
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/WSDLFilePublisher.java)
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/WSDLFilePublisher.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/WSDLFilePublisher.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -0,0 +1,180 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.deployment;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.xml.WSDLWriter;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.wsdl.WSDLManager;
+import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.core.utils.AbstractWSDLFilePublisher;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.w3c.dom.Document;
+
+/**
+ * A WSDL file publisher for CXF based stack
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 25-Mar-2010
+ *
+ */
+public class WSDLFilePublisher extends AbstractWSDLFilePublisher
+{
+ private static final Logger log = Logger.getLogger(WSDLFilePublisher.class);
+
+ public WSDLFilePublisher(ArchiveDeployment dep)
+ {
+ super(dep);
+ }
+
+ /** Publish the deployed wsdl file to the data directory
+ */
+ public void publishWsdlFiles(QName serviceName, String wsdlLocation, Bus bus,
List<ServiceInfo> serviceInfos) throws IOException
+ {
+ String deploymentName = dep.getCanonicalName();
+ File wsdlFile = getPublishLocation(serviceName.getLocalPart(), deploymentName,
wsdlLocation);
+ wsdlFile.getParentFile().mkdirs();
+ try
+ {
+ // Write the wsdl def to file
+ ServiceWSDLBuilder builder = new ServiceWSDLBuilder(bus, serviceInfos);
+ Definition def = builder.build();
+
+ Document doc = getWsdlDocument(bus, def);
+ writeDocument(doc, wsdlFile);
+
+ URL wsdlPublishURL = wsdlFile.toURI().toURL();
+ log.info("WSDL published to: " + wsdlPublishURL);
+
+ // Process the wsdl imports
+ if (def != null)
+ {
+ List<String> published = new LinkedList<String>();
+ publishWsdlImports(wsdlPublishURL, def, published);
+
+ // Publish XMLSchema imports
+ publishSchemaImports(wsdlPublishURL, doc.getDocumentElement(), published);
+ }
+ else
+ {
+ throw new NotImplementedException("WSDL-2.0 imports");
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Cannot publish wsdl to: " + wsdlFile, e);
+ }
+ }
+
+ private static Document getWsdlDocument(Bus bus, Definition def) throws WSDLException
+ {
+ WSDLWriter wsdlWriter =
bus.getExtension(WSDLManager.class).getWSDLFactory().newWSDLWriter();
+
def.setExtensionRegistry(bus.getExtension(WSDLManager.class).getExtensionRegistry());
+ return wsdlWriter.getDocument(def);
+ }
+
+ private static void writeDocument(Document doc, File file) throws IOException,
XMLStreamException
+ {
+ String enc = null;
+ try
+ {
+ enc = doc.getXmlEncoding();
+ }
+ catch (Exception ex)
+ {
+ //ignore - not dom level 3
+ }
+ if (enc == null)
+ {
+ enc = "utf-8";
+ }
+ FileOutputStream fos = new FileOutputStream(file);
+ try
+ {
+ XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(fos, enc);
+ StaxUtils.writeNode(doc, writer, true);
+ writer.flush();
+ }
+ finally
+ {
+ fos.close();
+ }
+ }
+
+ /**
+ * Get the file publish location
+ */
+ private File getPublishLocation(String serviceName, String archiveName, String
wsdlLocation) throws IOException
+ {
+ if (wsdlLocation == null && serviceName == null)
+ {
+ log.warn("Cannot get wsdl publish location for null wsdl location and
serviceName!");
+ return null;
+ }
+
+ //JBWS-2829: windows issue
+ if (archiveName.startsWith("http://"))
+ {
+ archiveName = archiveName.replace("http://", "http-");
+ }
+
+ File locationFile = new File(serverConfig.getServerDataDir().getCanonicalPath() +
"/wsdl/" + archiveName);
+
+ File result;
+ if (wsdlLocation != null && wsdlLocation.indexOf(expLocation) >= 0)
+ {
+ wsdlLocation = wsdlLocation.substring(wsdlLocation.indexOf(expLocation) +
expLocation.length());
+ result = new File(locationFile + "/" + wsdlLocation);
+ }
+ else if (wsdlLocation != null &&
(wsdlLocation.startsWith("vfsfile:") ||
wsdlLocation.startsWith("file:") || wsdlLocation.startsWith("jar:") ||
wsdlLocation.startsWith("vfszip:")))
+ {
+ wsdlLocation = wsdlLocation.substring(wsdlLocation.lastIndexOf("/") +
1);
+ result = new File(locationFile + "/" + wsdlLocation);
+ }
+ else
+ {
+ result = new File(locationFile + "/" + serviceName +
".wsdl");
+ }
+
+ return result;
+ }
+}
Property changes on:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/WSDLFilePublisher.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
(from rev 11915,
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/BusDeploymentAspect.java)
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -0,0 +1,125 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.deployment.aspect;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Map;
+
+import org.apache.cxf.BusFactory;
+import org.jboss.ws.Constants;
+import org.jboss.wsf.common.integration.AbstractDeploymentAspect;
+import org.jboss.wsf.common.integration.WSConstants;
+import org.jboss.wsf.spi.binding.BindingCustomization;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.ResourceResolver;
+import org.jboss.wsf.stack.cxf.client.configuration.JBossWSCXFConfigurer;
+import org.jboss.wsf.stack.cxf.configuration.BusHolder;
+import org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher;
+import org.jboss.wsf.stack.cxf.resolver.JBossWSResourceResolver;
+import org.jboss.wsf.stack.cxf.transport.SoapTransportFactoryExt;
+
+/**
+ * A deployment aspect that creates the CXF Bus early and attaches it to the endpoints
(wrapped in a BusHolder)
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 25-Mar-2010
+ */
+public class BusDeploymentAspect extends AbstractDeploymentAspect
+{
+ @SuppressWarnings("unchecked")
+ @Override
+ public void start(Deployment dep)
+ {
+ if (Constants.LAZY_LOAD_CXF_BUS)
+ return;
+
+ log.debug("Lazy load of CXF bus disabled, loading bus during
deployment...");
+ BusHolder holder;
+ ClassLoader origClassLoader = SecurityActions.getContextClassLoader();
+ try
+ {
+ ArchiveDeployment aDep = (ArchiveDeployment)dep;
+ //set the runtime classloader (pointing to the deployment unit) to allow CXF
accessing to the classes
+ SecurityActions.setContextClassLoader(dep.getRuntimeClassLoader());
+
+ ResourceResolver deploymentResolver = aDep.getResourceResolver();
+
+ URL cxfServletURL = null;
+ try
+ {
+ cxfServletURL =
deploymentResolver.resolve("WEB-INF/cxf-servlet.xml");
+ }
+ catch (IOException e)
+ {
+ } //ignore, cxf-servlet.xml is optional, we might even decide not to support
this
+
+ holder = BusHolder.create(cxfServletURL);
+
+ Map<String, String> contextParams = (Map<String,
String>)dep.getProperty(WSConstants.STACK_CONTEXT_PARAMS);
+ try
+ {
+ URL jbossCxfXml =
deploymentResolver.resolve(contextParams.get(BusHolder.PARAM_CXF_BEANS_URL));
+ org.apache.cxf.resource.ResourceResolver resolver = new
JBossWSResourceResolver(deploymentResolver);
+ JBossWSCXFConfigurer configurer =
holder.createConfigurer(dep.getAttachment(BindingCustomization.class), new
WSDLFilePublisher(aDep));
+ holder.configure(jbossCxfXml, new SoapTransportFactoryExt(), resolver,
configurer);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e); //re-throw, jboss-cxf.xml is required
+ }
+ }
+ finally
+ {
+ //clean threadlocals in BusFactory and restore the original classloader
+ BusFactory.setDefaultBus(null);
+ BusFactory.setThreadDefaultBus(null);
+ SecurityActions.setContextClassLoader(origClassLoader);
+ }
+
+ for (Endpoint endpoint : dep.getService().getEndpoints())
+ {
+ endpoint.addAttachment(BusHolder.class, holder);
+ }
+ dep.addAttachment(BusHolder.class, holder);
+ }
+
+ @Override
+ public void stop(Deployment dep)
+ {
+ for (Endpoint endpoint : dep.getService().getEndpoints())
+ {
+ BusHolder holder = endpoint.removeAttachment(BusHolder.class);
+ if (holder != null)
+ {
+ holder.close();
+ }
+ }
+ BusHolder holder = dep.removeAttachment(BusHolder.class);
+ if (holder != null)
+ {
+ holder.close();
+ }
+ }
+}
Property changes on:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java
(from rev 11924,
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java)
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -0,0 +1,236 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.deployment.aspect;
+
+import java.io.IOException;
+import java.net.URL;
+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.common.integration.AbstractDeploymentAspect;
+import org.jboss.wsf.common.integration.WSConstants;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
+import org.jboss.wsf.stack.cxf.configuration.BusHolder;
+import org.jboss.wsf.stack.cxf.metadata.services.DDBeans;
+import org.jboss.wsf.stack.cxf.metadata.services.DDEndpoint;
+
+/**
+ * A deployer that locates or generates cxf.xml
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 10-May-2007
+ */
+public class DescriptorDeploymentAspect extends AbstractDeploymentAspect
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(DescriptorDeploymentAspect.class);
+
+ private String invokerEJB3;
+ private String invokerJSE;
+
+ public void setInvokerEJB3(String invokerEJB3)
+ {
+ this.invokerEJB3 = invokerEJB3;
+ }
+
+ public void setInvokerJSE(String invokerJSE)
+ {
+ this.invokerJSE = invokerJSE;
+ }
+
+ @Override
+ public void start(Deployment dep)
+ {
+ URL cxfURL = getCXFConfigFromClassLoader(dep);
+ if (cxfURL == null)
+ {
+ cxfURL = getCXFConfigFromDeployment(dep);
+ if (cxfURL == null)
+ {
+ cxfURL = generateCXFConfigFromDeployment(dep);
+ }
+ putCXFConfigToDeployment(dep, cxfURL);
+ }
+ }
+
+ @Override
+ public void stop(Deployment dep)
+ {
+ DDBeans dd = dep.getAttachment(DDBeans.class);
+ if (dd != null)
+ {
+ dd.destroyFileURL();
+ }
+ }
+
+ /**
+ * Looks for <b>cxf.xml</b> in classloader
+ * @param dep deployment which initial classloader will be used
+ * @return <b>cxf.xml URL</b> or <b>null</b> if not found
+ */
+ private URL getCXFConfigFromClassLoader(Deployment dep)
+ {
+ ClassLoader initCL = dep.getInitialClassLoader();
+ URL cxfURL = initCL.getResource("cxf.xml");
+ if (cxfURL != null)
+ {
+ log.info("CXF configuration found: " + cxfURL);
+ }
+ return cxfURL;
+ }
+
+ /**
+ * Looks for <b>jbossws-cxf.xml</b> in:
+ * <ul>
+ * <li><b>META-INF</b> resource directory for EJB3
deployment</li>
+ * <li><b>WEB-INF</b> resource directory for POJO
deployment</li>
+ * </ul>
+ * @param dep deployment where to look for resources
+ * @return <b>jbossws-cxf.xml URL</b> or <b>null</b> if not
found
+ */
+ private URL getCXFConfigFromDeployment(Deployment dep)
+ {
+ DeploymentType depType = dep.getType();
+
+ String metadir;
+ if (depType == DeploymentType.JAXWS_EJB3)
+ {
+ // expected resource location for EJB3 deployments
+ metadir = "META-INF";
+ }
+ else if (depType == DeploymentType.JAXWS_JSE)
+ {
+ // expected resource location for POJO deployments
+ metadir = "WEB-INF";
+ }
+ else
+ {
+ // only POJO and EJB3 deployments are supported
+ throw new IllegalStateException("Unsupported deployment type: " +
depType);
+ }
+
+ URL cxfURL = null;
+ try
+ {
+ // get resource URL
+ ArchiveDeployment archDep = (ArchiveDeployment)dep;
+ cxfURL = archDep.getResourceResolver().resolve(metadir +
"/jbossws-cxf.xml");
+ log.info("JBossWS-CXF configuration found: " + cxfURL);
+ }
+ catch (IOException ignore)
+ {
+ // resource not found
+ }
+
+ return cxfURL;
+ }
+
+ /**
+ * Generated CXF descriptor from deployment
+ * @param dep deployment
+ * @return CXF descriptor URL
+ */
+ private URL generateCXFConfigFromDeployment(Deployment dep)
+ {
+ // Generate the jbossws-cxf.xml descriptor
+ DeploymentType depType = dep.getType();
+
+ DDBeans dd = new DDBeans();
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ String id = ep.getShortName();
+ String address = ep.getAddress();
+ String implementor = ep.getTargetBeanName();
+
+ boolean mtomEnabled = isMtomEnabled(ep.getTargetBeanClass());
+
+ DDEndpoint ddep = new DDEndpoint(id, address, implementor, mtomEnabled);
+
+ if (depType == DeploymentType.JAXWS_EJB3)
+ {
+ ddep.setInvoker(invokerEJB3);
+ }
+
+ if (depType == DeploymentType.JAXWS_JSE)
+ {
+ ddep.setInvoker(invokerJSE);
+ }
+
+
+ log.info("Add " + ddep);
+ dd.addEndpoint(ddep);
+ }
+
+ URL cxfURL = dd.createFileURL();
+ log.info("JBossWS-CXF configuration generated: " + cxfURL);
+
+ dep.addAttachment(DDBeans.class, dd);
+
+ return cxfURL;
+ }
+
+ /**
+ * Puts CXF config file reference to the stack specific context properties.
+ *
+ * @param dep webservice deployment
+ * @param cxfURL CXF DD URL
+ * @see org.jboss.wsf.common.integration.WSConstants.STACK_CONTEXT_PARAMS
+ */
+ @SuppressWarnings("unchecked")
+ private void putCXFConfigToDeployment(Deployment dep, URL cxfURL)
+ {
+ // get property map
+ Map<String, String> contextParams = (Map<String,
String>)dep.getProperty(WSConstants.STACK_CONTEXT_PARAMS);
+ if (contextParams == null)
+ {
+ // if there's no associated map with the property create it now
+ contextParams = new HashMap<String, String>();
+ dep.setProperty(WSConstants.STACK_CONTEXT_PARAMS, contextParams);
+ }
+ // put cxf config URL to the property map
+ contextParams.put(BusHolder.PARAM_CXF_BEANS_URL, cxfURL.toExternalForm());
+ }
+
+ private static boolean isMtomEnabled(Class<?> beanClass)
+ {
+ BindingType bindingType = (BindingType)beanClass.getAnnotation(BindingType.class);
+ MTOM mtom = (MTOM)beanClass.getAnnotation(MTOM.class);
+
+ boolean mtomEnabled = mtom != null;
+ if (!mtomEnabled && bindingType != null)
+ {
+ String binding = bindingType.value();
+ mtomEnabled = binding.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) ||
binding.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING);
+ }
+
+ return mtomEnabled;
+ }
+
+}
Property changes on:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/ResourceResolverDeploymentAspect.java
(from rev 11915,
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ResourceResolverDeploymentAspect.java)
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/ResourceResolverDeploymentAspect.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/ResourceResolverDeploymentAspect.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -0,0 +1,66 @@
+/*
+ * 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.deployment.aspect;
+
+import org.jboss.wsf.common.integration.AbstractDeploymentAspect;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Deployment;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.ResourceResolver;
+import org.jboss.wsf.stack.cxf.resolver.JBossWSResourceResolver;
+
+/**
+ * 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 AbstractDeploymentAspect
+{
+ @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);
+ }
+ }
+ }
+}
Property changes on:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/ResourceResolverDeploymentAspect.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/SecurityActions.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/SecurityActions.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/SecurityActions.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.deployment.aspect;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 26-Mar-2010
+ *
+ */
+class SecurityActions
+{
+ /**
+ * Get context classloader.
+ *
+ * @return the current context classloader
+ */
+ static ClassLoader getContextClassLoader()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
{
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+ }
+
+ /**
+ * Set context classloader.
+ *
+ * @param classLoader the classloader
+ */
+ static void setContextClassLoader(final ClassLoader classLoader)
+ {
+ if (System.getSecurityManager() == null)
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ }
+ else
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ return null;
+ }
+ });
+ }
+ }
+
+}
Property changes on:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/SecurityActions.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/JBossWSResourceResolver.java
(from rev 11915,
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSResourceResolver.java)
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/JBossWSResourceResolver.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/JBossWSResourceResolver.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -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.resolver;
+
+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;
+ }
+
+}
Property changes on:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/JBossWSResourceResolver.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/WebAppResolver.java
(from rev 11915,
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/WebAppResolver.java)
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/WebAppResolver.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/WebAppResolver.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.resolver;
+
+import org.jboss.wsf.spi.management.EndpointResolver;
+import org.jboss.wsf.spi.deployment.Endpoint;
+
+import javax.management.ObjectName;
+import java.util.Iterator;
+
+/**
+ * Resolves Endpoints by Servlet name and web context path.
+ *
+ * @author Heiko.Braun(a)jboss.com
+ * Created: Jul 24, 2007
+ */
+public class WebAppResolver implements EndpointResolver
+{
+ private String contextPath;
+ private String servletName;
+
+ public WebAppResolver(String contextPath, String servletName)
+ {
+ this.contextPath = contextPath;
+ this.servletName = servletName;
+ }
+
+ public Endpoint query(Iterator<Endpoint> endpoints)
+ {
+ Endpoint endpoint = null;
+
+ if (contextPath.startsWith("/"))
+ contextPath = contextPath.substring(1);
+
+ while(endpoints.hasNext())
+ {
+ Endpoint auxEndpoint = endpoints.next();
+ ObjectName sepId = auxEndpoint.getName();
+ String propContext = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_CONTEXT);
+ String propEndpoint = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
+ if (servletName.equals(propEndpoint) &&
contextPath.equals(propContext))
+ {
+ endpoint = auxEndpoint;
+ break;
+ }
+ }
+
+ return endpoint;
+ }
+}
Property changes on:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/WebAppResolver.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/AddressRewritingEndpointInfo.java
(from rev 11915,
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AddressRewritingEndpointInfo.java)
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/AddressRewritingEndpointInfo.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/AddressRewritingEndpointInfo.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -0,0 +1,212 @@
+/*
+ * 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.transport;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.tools.common.extensions.soap.SoapAddress;
+import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.management.ServerConfig;
+
+/**
+ * A custom EndpointInfo that updates the SoapAddress extension
+ * coming from the wsdl definition according to the JBossWS
+ * soap address rewrite rules.
+ *
+ * @see org.apache.cxf.binding.soap.SoapTransportFactory.SoapEndpointInfo
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 03-Aug-2009
+ *
+ */
+public class AddressRewritingEndpointInfo extends EndpointInfo
+{
+ private static Logger log = Logger.getLogger(AddressRewritingEndpointInfo.class);
+
+ private ServerConfig serverConfig;
+ SoapAddress saddress;
+
+ AddressRewritingEndpointInfo(ServiceInfo serv, String trans, ServerConfig
serverConfig)
+ {
+ super(serv, trans);
+ this.serverConfig = serverConfig;
+ }
+
+ /**
+ * This is the method responsible for both setting the EndpointInfo address and
+ * setting the soap:address in the wsdl.
+ * While the former action is straightforward, the latter is performed according
+ * to the JBossWS configuration: every time CXF updates the EndpointInfo address
+ * (which usually happens twice) this makes sure a proper address is updated in
+ * the wsdl.
+ *
+ * {@inheritDoc}
+ */
+ public void setAddress(String s)
+ {
+ String previousAddress = super.getAddress();
+ super.setAddress(s);
+ boolean setNewAddress = false;
+ if (previousAddress == null)
+ {
+ setNewAddress = true;
+ }
+ else if (isRewriteAllowed(s) && isRewriteRequired(s, previousAddress))
+ {
+ String uriScheme = getUriScheme(s);
+ //we set https if the transport guarantee is CONFIDENTIAL or the previous
address already used https
+ //(if the original wsdl soap:address uses https we can't overwrite it with
http)
+ if ("https".equalsIgnoreCase(getUriScheme(previousAddress)))
+ {
+ uriScheme = "https";
+ }
+ if (uriScheme == null)
+ {
+ uriScheme = "http";
+ }
+ //rewrite the candidate new address
+ s = rewriteSoapAddress(s, uriScheme);
+ setNewAddress = true;
+ }
+ if (setNewAddress && saddress != null)
+ {
+ log.info("Setting new service endpoint address in wsdl: " + s);
+ saddress.setLocationURI(s);
+ }
+ }
+
+ public void addExtensor(Object el)
+ {
+ super.addExtensor(el);
+ if (el instanceof SoapAddress)
+ {
+ saddress = (SoapAddress)el;
+ }
+ }
+
+ protected boolean isRewriteAllowed(String address)
+ {
+ //exclude non http addresses
+ return (address != null &&
address.trim().toLowerCase().startsWith("http"));
+ }
+
+
+ protected boolean isRewriteRequired(String address, String previousAddress)
+ {
+ //check config prop forcing address rewrite
+ if (serverConfig.isModifySOAPAddress())
+ {
+ log.debug("Rewrite required because of configuration");
+ return true;
+ }
+ //check if the previous address is not valid
+ if (isInvalidAddress(previousAddress))
+ {
+ log.debug("Rewrite required because of invalid url");
+ return true;
+ }
+ log.debug("Rewrite not required");
+ return false;
+ }
+
+ protected boolean isInvalidAddress(String address)
+ {
+ if (address == null)
+ {
+ return true;
+ }
+ String s = address.trim();
+ if (s.length() == 0 || s.contains("REPLACE_WITH_ACTUAL_URL"))
+ {
+ return true;
+ }
+ try
+ {
+ new URL(s);
+ }
+ catch (Exception e)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Rewrite the provided address according to the current server
+ * configuration and always using the specified uriScheme.
+ *
+ * @param s The source address
+ * @param uriScheme The uriScheme to use for rewrite
+ * @return The obtained address
+ */
+ protected String rewriteSoapAddress(String s, String uriScheme)
+ {
+ try
+ {
+ URL url = new URL(s);
+ String path = url.getPath();
+ String host = serverConfig.getWebServiceHost();
+ String port = "";
+ if ("https".equals(uriScheme))
+ {
+ int portNo = serverConfig.getWebServiceSecurePort();
+ if (portNo != 443)
+ {
+ port = ":" + portNo;
+ }
+ }
+ else
+ {
+ int portNo = serverConfig.getWebServicePort();
+ if (portNo != 80)
+ {
+ port = ":" + portNo;
+ }
+ }
+ String urlStr = uriScheme + "://" + host + port + path;
+ log.debug("Rewritten new candidate service endpoint address '" + s
+ "' to '" + urlStr + "'");
+ return urlStr;
+ }
+ catch (Exception e)
+ {
+ log.debug("Invalid url provided, using it without rewriting: " + s);
+ return s;
+ }
+ }
+
+ private static String getUriScheme(String address)
+ {
+ try
+ {
+ URI addrURI = new URI(address);
+ String scheme = addrURI.getScheme();
+ return scheme;
+ }
+ catch (Exception e)
+ {
+ return null;
+ }
+ }
+}
Property changes on:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/AddressRewritingEndpointInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/SoapTransportFactoryExt.java
(from rev 11915,
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/SoapTransportFactoryExt.java)
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/SoapTransportFactoryExt.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/SoapTransportFactoryExt.java 2010-04-01
17:21:15 UTC (rev 11925)
@@ -0,0 +1,97 @@
+/*
+ * 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.transport;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Port;
+
+import org.apache.cxf.binding.soap.SoapTransportFactory;
+import org.apache.cxf.binding.soap.model.SoapBindingInfo;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.tools.common.extensions.soap.SoapAddress;
+import org.apache.cxf.tools.util.SOAPBindingUtil;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.spi.management.ServerConfigFactory;
+
+/**
+ * A SoapTransportFactory extending @see
org.apache.cxf.binding.soap.SoapTransportFactory.
+ * It overrides the EndpointInfo creation method to allow for the soap:address extension
+ * of the wsdl to be overwritten according to the JBossWS configuration.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 31-Jul-2009
+ *
+ */
+public class SoapTransportFactoryExt extends SoapTransportFactory
+{
+ private ServerConfig serverConfig;
+
+ @SuppressWarnings("unchecked")
+ public EndpointInfo createEndpointInfo(ServiceInfo serviceInfo, BindingInfo b, Port
port)
+ {
+ String transportURI = "http://schemas.xmlsoap.org/wsdl/soap/";
+ if (b instanceof SoapBindingInfo)
+ {
+ SoapBindingInfo sbi = (SoapBindingInfo)b;
+ transportURI = sbi.getTransportURI();
+ }
+ ServerConfig config = getServerConfig();
+ EndpointInfo info = new AddressRewritingEndpointInfo(serviceInfo, transportURI,
config);
+ if (port != null)
+ {
+ List ees = port.getExtensibilityElements();
+ for (Iterator itr = ees.iterator(); itr.hasNext();)
+ {
+ Object extensor = itr.next();
+
+ if (SOAPBindingUtil.isSOAPAddress(extensor))
+ {
+ final SoapAddress sa = SOAPBindingUtil.getSoapAddress(extensor);
+
+ info.addExtensor(sa);
+ info.setAddress(sa.getLocationURI());
+ }
+ else
+ {
+ info.addExtensor(extensor);
+ }
+ }
+ }
+ return info;
+ }
+
+ private ServerConfig getServerConfig()
+ {
+ if (serverConfig == null)
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ serverConfig = spiProvider.getSPI(ServerConfigFactory.class).getServerConfig();
+ }
+ return serverConfig;
+ }
+}
Property changes on:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/SoapTransportFactoryExt.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Modified: stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as5.xml
===================================================================
---
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as5.xml 2010-04-01
16:07:54 UTC (rev 11924)
+++
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as5.xml 2010-04-01
17:21:15 UTC (rev 11925)
@@ -38,7 +38,7 @@
<property name="relativeOrder">31</property> <!--
[JBDEPLOY-201] workaround -->
</bean>
- <bean name="WSCXFDescriptorDeploymentAspect"
class="org.jboss.wsf.stack.cxf.DescriptorDeploymentAspect">
+ <bean name="WSCXFDescriptorDeploymentAspect"
class="org.jboss.wsf.stack.cxf.deployment.aspect.DescriptorDeploymentAspect">
<property
name="requires">EndpointAddress,JAXBIntros</property>
<property name="provides">StackDescriptor</property>
<property
name="invokerEJB3">org.jboss.wsf.stack.cxf.InvokerEJB3</property>
@@ -46,7 +46,7 @@
<property name="relativeOrder">21</property> <!--
[JBDEPLOY-201] workaround -->
</bean>
- <bean name="ResourceResolverDeploymentAspect"
class="org.jboss.wsf.stack.cxf.ResourceResolverDeploymentAspect">
+ <bean name="WSCXFResourceResolverDeploymentAspect"
class="org.jboss.wsf.stack.cxf.deployment.aspect.ResourceResolverDeploymentAspect">
<property name="requires">JmsEndpointAddress</property>
<property name="provides">ResourceResolver</property>
<property name="relativeOrder">23</property> <!--
[JBDEPLOY-201] workaround -->
@@ -76,7 +76,7 @@
<property name="relativeOrder">20</property> <!--
[JBDEPLOY-201] workaround -->
</bean>
- <bean name="WSCXFBusDeploymentAspect"
class="org.jboss.wsf.stack.cxf.BusDeploymentAspect">
+ <bean name="WSCXFBusDeploymentAspect"
class="org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect">
<property name="provides">BusHolder</property>
<property
name="requires">ResourceResolver,StackDescriptor</property>
<property name="relativeOrder">24</property> <!--
[JBDEPLOY-201] workaround -->
Modified: stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml
===================================================================
---
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml 2010-04-01
16:07:54 UTC (rev 11924)
+++
stack/cxf/trunk/modules/server/src/main/resources/jbossws-cxf-config-as6.xml 2010-04-01
17:21:15 UTC (rev 11925)
@@ -38,7 +38,7 @@
<property name="forJaxRpc">false</property>
</bean>
- <bean name="WSCXFDescriptorDeploymentAspect"
class="org.jboss.wsf.stack.cxf.DescriptorDeploymentAspect">
+ <bean name="WSCXFDescriptorDeploymentAspect"
class="org.jboss.wsf.stack.cxf.deployment.aspect.DescriptorDeploymentAspect">
<property
name="requires">EndpointAddress,JAXBIntros</property>
<property name="provides">StackDescriptor</property>
<property
name="invokerEJB3">org.jboss.wsf.stack.cxf.InvokerEJB3</property>
@@ -46,7 +46,7 @@
<property name="forJaxRpc">false</property>
</bean>
- <bean name="ResourceResolverDeploymentAspect"
class="org.jboss.wsf.stack.cxf.ResourceResolverDeploymentAspect">
+ <bean name="WSCXFResourceResolverDeploymentAspect"
class="org.jboss.wsf.stack.cxf.deployment.aspect.ResourceResolverDeploymentAspect">
<property name="requires">JmsEndpointAddress</property>
<property name="provides">ResourceResolver</property>
<property name="forJaxRpc">false</property>
@@ -76,7 +76,7 @@
<property name="forJaxRpc">false</property>
</bean>
- <bean name="WSCXFBusDeploymentAspect"
class="org.jboss.wsf.stack.cxf.BusDeploymentAspect">
+ <bean name="WSCXFBusDeploymentAspect"
class="org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect">
<property name="provides">BusHolder</property>
<property
name="requires">ResourceResolver,StackDescriptor</property>
<property name="forJaxRpc">false</property>