cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r958606 - in /cxf/trunk/rt/frontend/jaxws/src/main: java/org/apache/cxf/jaxws/spi/ java/org/apache/cxf/jaxws/spring/ jaxws22/org/apache/cxf/jaxws22/spi/ jaxws22/org/apache/cxf/jaxws22/spring/ resources/META-INF/ spi-2.1/META-INF/ spi-2.2/ME...
Date Mon, 28 Jun 2010 15:33:19 GMT
Author: dkulp
Date: Mon Jun 28 15:33:18 2010
New Revision: 958606

URL: http://svn.apache.org/viewvc?rev=958606&view=rev
Log:
Enhance the detection of jaxws 2.2
simplify the spring namespace handling to keep it in one place

Added:
    cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spring/JAXWS22SpringEndpointImpl.java
  (contents, props changed)
      - copied, changed from r958510, cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spring/EndpointDefinitionParser.java
    cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/spring.handlers
      - copied, changed from r958510, cxf/trunk/rt/frontend/jaxws/src/main/spi-2.1/META-INF/spring.handlers
Removed:
    cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spring/EndpointDefinitionParser.java
    cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spring/NamespaceHandler.java
    cxf/trunk/rt/frontend/jaxws/src/main/spi-2.1/META-INF/spring.handlers
    cxf/trunk/rt/frontend/jaxws/src/main/spi-2.2/META-INF/spring.handlers
Modified:
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
    cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spi/ProviderImpl.java

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java?rev=958606&r1=958605&r2=958606&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java Mon
Jun 28 15:33:18 2010
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.jaxws.spi;
 
+import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.List;
 import java.util.Map;
@@ -42,6 +43,7 @@ import org.w3c.dom.Element;
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.common.WSDLConstants;
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.jaxws.EndpointImpl;
@@ -56,6 +58,29 @@ public class ProviderImpl extends javax.
     public static final String JAXWS_PROVIDER = ProviderImpl.class.getName();
     protected static final Logger LOG = LogUtils.getL7dLogger(ProviderImpl.class);
     private static JAXBContext jaxbContext;
+    private static final boolean JAXWS_22;
+    static {
+        boolean b = false;
+        try {
+            //JAX-WS 2.2 would have the HttpContext class in the classloader
+            Class<?> cls = ClassLoaderUtils.loadClass("javax.xml.ws.spi.http.HttpContext",

+                                                      ProviderImpl.class);
+            //In addition to that, the Endpoint class we pick up on the classloader
+            //should have a publish method that uses it.  Otherwise, we MAY be
+            //be getting the HttpContext from the 2.2 jaxws-api jar, but the Endpoint
+            //class from the 2.1 JRE
+            Method m = Endpoint.class.getMethod("publish", cls);
+            b = m != null;
+        } catch (Throwable ex) {
+            b = false;
+        }
+        JAXWS_22 = b;
+    }
+    
+    
+    public static boolean isJaxWs22() {
+        return JAXWS_22;
+    }
     
     @Override
     public ServiceDelegate createServiceDelegate(URL url, QName qname, Class cls) {

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java?rev=958606&r1=958605&r2=958606&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
Mon Jun 28 15:33:18 2010
@@ -37,6 +37,7 @@ import org.apache.cxf.configuration.spri
 import org.apache.cxf.configuration.spring.BusWiringType;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.jaxws.spi.ProviderImpl;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.FatalBeanException;
 import org.springframework.beans.factory.BeanDefinitionStoreException;
@@ -48,12 +49,27 @@ import org.springframework.context.Appli
 
 
 public class EndpointDefinitionParser extends AbstractBeanDefinitionParser {
-
+    private static final Class<?> EP_CLASS;
+    static {
+        Class<?> cls = SpringEndpointImpl.class;
+        try {
+            if (ProviderImpl.isJaxWs22()) {
+                cls = ClassLoaderUtils
+                    .loadClass("org.apache.cxf.jaxws22.spring.JAXWS22SpringEndpointImpl",

+                           EndpointDefinitionParser.class);
+            }
+        } catch (Throwable t) {
+            cls = SpringEndpointImpl.class;
+        }
+        EP_CLASS = cls;
+    }
+    
+    
     private static final String IMPLEMENTOR = "implementor";
 
     public EndpointDefinitionParser() {
         super();
-        setBeanClass(SpringEndpointImpl.class);
+        setBeanClass(EP_CLASS);
     }
 
     @Override

Modified: cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spi/ProviderImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spi/ProviderImpl.java?rev=958606&r1=958605&r2=958606&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spi/ProviderImpl.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spi/ProviderImpl.java
Mon Jun 28 15:33:18 2010
@@ -28,7 +28,6 @@ import javax.xml.ws.spi.Invoker;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
-import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.jaxws.EndpointUtils;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
@@ -42,14 +41,11 @@ public class ProviderImpl extends org.ap
                                               String bindingId,
                                               Object implementor,
                                               WebServiceFeature ... features) {
-        try {
-            ClassLoaderUtils.loadClass("javax.xml.ws.spi.http.HttpContext", ProviderImpl.class);
-        } catch (Throwable ex) {
-            //couldn't find the 2.2 stuff, assume 2.1 behavior
-            return super.createEndpointImpl(bus, bindingId, implementor, features);
+        if (isJaxWs22()) {
+            return new EndpointImpl(bus, implementor, bindingId, features);
         }
-        
-        return new EndpointImpl(bus, implementor, bindingId, features);
+        //couldn't find the 2.2 stuff, assume 2.1 behavior
+        return super.createEndpointImpl(bus, bindingId, implementor, features);
     }
 
     //new in 2.2, but introduces a new class not found in 2.1
@@ -61,15 +57,17 @@ public class ProviderImpl extends org.ap
             if (features != null) {
                 factory.getJaxWsServiceFactory().setWsFeatures(Arrays.asList(features));
             }
-            factory.setInvoker(new JAXWS22Invoker(invoker));
-            try {
-                invoker.inject(new WebServiceContextImpl());
-            } catch (Exception e) {
-                throw new WebServiceException(new Message("ENDPOINT_CREATION_FAILED_MSG",
LOG).toString(), e);
+            if (invoker != null) {
+                factory.setInvoker(new JAXWS22Invoker(invoker));
+                try {
+                    invoker.inject(new WebServiceContextImpl());
+                } catch (Exception e) {
+                    throw new WebServiceException(new Message("ENDPOINT_CREATION_FAILED_MSG",
+                                                              LOG).toString(), e);
+                }
             }
             EndpointImpl ep = new EndpointImpl(bus, null, factory);
             ep.setImplementorClass(implementorClass);
-            
             return ep;
         } else {
             throw new WebServiceException(new Message("INVALID_IMPLEMENTOR_EXC", LOG).toString());

Copied: cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spring/JAXWS22SpringEndpointImpl.java
(from r958510, cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spring/EndpointDefinitionParser.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spring/JAXWS22SpringEndpointImpl.java?p2=cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spring/JAXWS22SpringEndpointImpl.java&p1=cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spring/EndpointDefinitionParser.java&r1=958510&r2=958606&rev=958606&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spring/EndpointDefinitionParser.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spring/JAXWS22SpringEndpointImpl.java
Mon Jun 28 15:33:18 2010
@@ -26,30 +26,23 @@ import org.springframework.beans.BeansEx
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
 
-public class EndpointDefinitionParser extends org.apache.cxf.jaxws.spring.EndpointDefinitionParser
{
-    public EndpointDefinitionParser() {
-        setBeanClass(JAXWS22SpringEndpointImpl.class);
+@NoJSR250Annotations
+public class JAXWS22SpringEndpointImpl extends org.apache.cxf.jaxws22.EndpointImpl
+    implements ApplicationContextAware {
+
+    public JAXWS22SpringEndpointImpl(Object implementor) {
+        super((Bus)null, implementor);
+    }
+    public JAXWS22SpringEndpointImpl(Bus bus, Object implementor) {
+        super(bus, implementor);
     }
     
-    @NoJSR250Annotations
-    public static class JAXWS22SpringEndpointImpl extends org.apache.cxf.jaxws22.EndpointImpl
-        implements ApplicationContextAware {
     
-        public JAXWS22SpringEndpointImpl(Object implementor) {
-            super((Bus)null, implementor);
-        }
-        public JAXWS22SpringEndpointImpl(Bus bus, Object implementor) {
-            super(bus, implementor);
-        }
-        
-        
-        public void setApplicationContext(ApplicationContext ctx) throws BeansException {
-            if (getBus() == null) {
-                Bus bus = BusFactory.getThreadDefaultBus();
-                BusWiringBeanFactoryPostProcessor.updateBusReferencesInContext(bus, ctx);
-                setBus(bus);
-            }
+    public void setApplicationContext(ApplicationContext ctx) throws BeansException {
+        if (getBus() == null) {
+            Bus bus = BusFactory.getThreadDefaultBus();
+            BusWiringBeanFactoryPostProcessor.updateBusReferencesInContext(bus, ctx);
+            setBus(bus);
         }
     }
-
-}
+}
\ No newline at end of file

Propchange: cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spring/JAXWS22SpringEndpointImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spring/JAXWS22SpringEndpointImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/spring.handlers (from r958510,
cxf/trunk/rt/frontend/jaxws/src/main/spi-2.1/META-INF/spring.handlers)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/spring.handlers?p2=cxf/trunk/rt/frontend/jaxws/src/main/resources/META-INF/spring.handlers&p1=cxf/trunk/rt/frontend/jaxws/src/main/spi-2.1/META-INF/spring.handlers&r1=958510&r2=958606&rev=958606&view=diff
==============================================================================
    (empty)



Mime
View raw message