cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r533505 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ rt/transports/http/src/main/java/org/apache/cxf/transport/s...
Date Sun, 29 Apr 2007 13:50:50 GMT
Author: dkulp
Date: Sun Apr 29 06:50:48 2007
New Revision: 533505

URL: http://svn.apache.org/viewvc?view=rev&rev=533505
Log:
Fix issue with using the wrong bus in servlets


Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/BusFactory.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/BusFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/BusFactory.java?view=diff&rev=533505&r1=533504&r2=533505
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/BusFactory.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/BusFactory.java Sun Apr 29 06:50:48
2007
@@ -76,6 +76,7 @@
      */
     public static synchronized void setDefaultBus(Bus bus) {
         defaultBus = bus;
+        setThreadDefaultBus(bus);
     }
     
     

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java?view=diff&rev=533505&r1=533504&r2=533505
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
Sun Apr 29 06:50:48 2007
@@ -196,12 +196,7 @@
         if (null != server) {
             server.stop();
         }
-    }
-
-    public ServerImpl getServer() {
-        return (ServerImpl) server;
-    }
-    
+    }    
 
     /**
      * inject resources into servant.  The resources are injected
@@ -243,74 +238,87 @@
     
     protected void doPublish(String addr) {
         checkPublishPermission();
-        checkProperties();
-
-        // Initialize the endpointName so we can do configureObject
-        if (endpointName == null) {
-            JaxWsImplementorInfo implInfo = new JaxWsImplementorInfo(implementor.getClass());
-            endpointName = implInfo.getEndpointName();
-        }
-        
-        configureObject(this);
-        
-        // Set up the server factory
-        serverFactory.setAddress(addr);
-        serverFactory.setStart(false);
-        serverFactory.setEndpointName(endpointName);
-        serverFactory.setServiceBean(implementor);
-        serverFactory.setBus(bus);
-        serverFactory.setFeatures(features);
-        
-        // Be careful not to override any serverfactory settings as a user might
-        // have supplied their own.
-        if (getWsdlLocation() != null) {
-            serverFactory.setWsdlURL(getWsdlLocation());
-        }
-        
-        if (bindingUri != null) {
-            serverFactory.setBindingId(bindingUri);
-        }
-        
-        if (serviceName != null) {
-            serverFactory.getServiceFactory().setServiceName(serviceName);
-        }
-        
-        configureObject(serverFactory);
         
-        server = serverFactory.create();
-        
-        init();
-        
-        org.apache.cxf.endpoint.Endpoint endpoint = getEndpoint();
-        if (getInInterceptors() != null) {
-            endpoint.getInInterceptors().addAll(getInInterceptors());
-        }
-        if (getOutInterceptors() != null) {
-            endpoint.getOutInterceptors().addAll(getOutInterceptors());
-        }
-        if (getInFaultInterceptors() != null) {
-            endpoint.getInFaultInterceptors().addAll(getInFaultInterceptors());
-        }
-        if (getOutFaultInterceptors() != null) {
-            endpoint.getOutFaultInterceptors().addAll(getOutFaultInterceptors());
-        }
-        
-        if (properties != null) {
-            endpoint.putAll(properties);
+        ServerImpl serv = getServer(addr);
+        if (addr != null) {
+            serv.getEndpoint().getEndpointInfo().setAddress(addr);
         }
+        serv.start();
+    }
+    
+    public ServerImpl getServer() {
+        return getServer(null);
+    }
+    public synchronized ServerImpl getServer(String addr) {
+        if (server == null) {
+            checkProperties();
+
+            // Initialize the endpointName so we can do configureObject
+            if (endpointName == null) {
+                JaxWsImplementorInfo implInfo = new JaxWsImplementorInfo(implementor.getClass());
+                endpointName = implInfo.getEndpointName();
+            }
 
-        if (endpointName != null) {
-            serverFactory.getServiceFactory().setEndpointName(endpointName);
+            if (serviceName != null) {
+                serverFactory.getServiceFactory().setServiceName(serviceName);
+            }
+
+            configureObject(this);
+            
+            // Set up the server factory
+            serverFactory.setAddress(addr);
+            serverFactory.setStart(false);
+            serverFactory.setEndpointName(endpointName);
+            serverFactory.setServiceBean(implementor);
+            serverFactory.setBus(bus);
+            serverFactory.setFeatures(features);
+            
+            // Be careful not to override any serverfactory settings as a user might
+            // have supplied their own.
+            if (getWsdlLocation() != null) {
+                serverFactory.setWsdlURL(getWsdlLocation());
+            }
+            
+            if (bindingUri != null) {
+                serverFactory.setBindingId(bindingUri);
+            }
+            
+            if (serviceName != null) {
+                serverFactory.getServiceFactory().setServiceName(serviceName);
+            }
+            
+            configureObject(serverFactory);
+            
+            server = serverFactory.create();
+            
+            init();
+            
+            org.apache.cxf.endpoint.Endpoint endpoint = getEndpoint();
+            if (getInInterceptors() != null) {
+                endpoint.getInInterceptors().addAll(getInInterceptors());
+            }
+            if (getOutInterceptors() != null) {
+                endpoint.getOutInterceptors().addAll(getOutInterceptors());
+            }
+            if (getInFaultInterceptors() != null) {
+                endpoint.getInFaultInterceptors().addAll(getInFaultInterceptors());
+            }
+            if (getOutFaultInterceptors() != null) {
+                endpoint.getOutFaultInterceptors().addAll(getOutFaultInterceptors());
+            }
+            
+            if (properties != null) {
+                endpoint.putAll(properties);
+            }
+            
+            configureObject(endpoint.getService());
+            configureObject(endpoint);            
         }
-        
-        configureObject(endpoint.getService());
-        configureObject(endpoint);
-        
-        server.start();
+        return (ServerImpl) server;
     }
     
     org.apache.cxf.endpoint.Endpoint getEndpoint() {
-        return ((ServerImpl)getServer()).getEndpoint();
+        return ((ServerImpl)getServer(null)).getEndpoint();
     }
     
     private void configureObject(Object instance) {

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java?view=diff&rev=533505&r1=533504&r2=533505
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
Sun Apr 29 06:50:48 2007
@@ -67,20 +67,20 @@
         String binding = getBindingId();
         if (binding == null) {
             binding = jaxBid;
-            
-            if (binding.equals(SOAPBinding.SOAP11HTTP_BINDING) 
-                || binding.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)
-                || binding.equals(SOAPBinding.SOAP12HTTP_BINDING) 
-                || binding.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
-                binding = "http://schemas.xmlsoap.org/soap/";
-                
-                if (getBindingConfig() == null) {
-                    setBindingConfig(new JaxWsSoapBindingConfiguration(sf));
-                }
-            }
-            
             setBindingId(binding);
         }
+        
+        if (binding.equals(SOAPBinding.SOAP11HTTP_BINDING) 
+            || binding.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)
+            || binding.equals(SOAPBinding.SOAP12HTTP_BINDING) 
+            || binding.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
+            binding = "http://schemas.xmlsoap.org/soap/";
+            setBindingId(binding);
+            if (getBindingConfig() == null) {
+                setBindingConfig(new JaxWsSoapBindingConfiguration(sf));
+            }
+        }
+            
         boolean messageMode = implInfo.getServiceMode().equals(javax.xml.ws.Service.Mode.MESSAGE);
         
         if (getBindingConfig() instanceof JaxWsSoapBindingConfiguration) {
@@ -94,7 +94,6 @@
                 conf.setVersion(Soap12.getInstance());
                 conf.setMtomEnabled(true);
             }
-            
             if (jaxBid.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)) {
                 conf.setMtomEnabled(true);
             }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java?view=diff&rev=533505&r1=533504&r2=533505
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spi/ProviderImpl.java
Sun Apr 29 06:50:48 2007
@@ -51,7 +51,7 @@
     public ServiceDelegate createServiceDelegate(URL url,
                                                  QName qname,
                                                  Class cls) {
-        Bus bus = BusFactory.getDefaultBus();
+        Bus bus = BusFactory.getThreadDefaultBus();
         return new ServiceImpl(bus, url, qname, cls);
     }
 
@@ -60,7 +60,7 @@
 
         Endpoint ep = null;
         if (EndpointUtils.isValidImplementor(implementor)) {
-            Bus bus = BusFactory.getDefaultBus();
+            Bus bus = BusFactory.getThreadDefaultBus();
             ep = new EndpointImpl(bus, implementor, bindingId);
             return ep;
         } else {

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java?view=diff&rev=533505&r1=533504&r2=533505
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
Sun Apr 29 06:50:48 2007
@@ -73,6 +73,9 @@
     }
 
     private String getTrimmedPath(String path) {
+        if (path == null) {
+            return "/";
+        }
         final String lh = "http://localhost/";
         final String lhs = "https://localhost/";
         

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java?view=diff&rev=533505&r1=533504&r2=533505
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java
Sun Apr 29 06:50:48 2007
@@ -29,6 +29,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
 import org.apache.cxf.configuration.security.FiltersType;
@@ -245,7 +246,8 @@
     class DefaultBusFactory extends SpringBusFactory {
         public Bus createBus(URL config) {
             Bus bus = super.createBus(config, true);
-            defaultBus = bus;
+            BusFactory.setDefaultBus(bus);
+            BusFactory.setThreadDefaultBus(bus);
             return bus;
         }
     }



Mime
View raw message