cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r634052 - in /incubator/cxf/trunk/rt: frontend/simple/src/main/java/org/apache/cxf/frontend/ frontend/simple/src/main/java/org/apache/cxf/service/factory/ transports/http/src/main/java/org/apache/cxf/transport/http/
Date Wed, 05 Mar 2008 22:09:06 GMT
Author: dkulp
Date: Wed Mar  5 14:09:05 2008
New Revision: 634052

URL: http://svn.apache.org/viewvc?rev=634052&view=rev
Log:
Be a little more defensive against null addresses in the Conduit.   Create invoker up front
to avoid it being created twice.

Modified:
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java?rev=634052&r1=634051&r2=634052&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
Wed Mar  5 14:09:05 2008
@@ -104,6 +104,11 @@
             if (serviceBean != null && getServiceClass() == null) {
                 setServiceClass(serviceBean.getClass());
             }
+            if (invoker != null) {
+                getServiceFactory().setInvoker(invoker);
+            } else if (serviceBean != null) {
+                getServiceFactory().setInvoker(createInvoker());
+            }
             
             Endpoint ep = createEndpoint();
             server = new ServerImpl(getBus(), 

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=634052&r1=634051&r2=634052&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Wed Mar  5 14:09:05 2008
@@ -695,6 +695,10 @@
         }
     }
     protected Invoker createInvoker() {
+        Class<?> cls = getServiceClass();
+        if (cls.isInterface()) {
+            return null;
+        }
         return new FactoryInvoker(new SingletonFactory(getServiceClass()));
     }
 

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?rev=634052&r1=634051&r2=634052&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Wed Mar  5 14:09:05 2008
@@ -192,17 +192,13 @@
      */
     private final EndpointInfo endpointInfo;
     
-    /**
-     * This field holds the "default" address for this particular conduit, which
-     * is set at construction.
-     */
-    private final String defaultEndpointAddress;
 
     /**
      * This field holds the "default" URL for this particular conduit, which
      * is created on demand.
      */
     private URL defaultEndpointURL;
+    private boolean fromEndpointReferenceType;
 
     private Destination decoupledDestination;
     private MessageObserver decoupledObserver;
@@ -290,9 +286,9 @@
         bus = b;
         endpointInfo = ei;
 
-        defaultEndpointAddress = t == null
-                                 ? ei.getAddress()
-                                 : t.getAddress().getValue();
+        if (t != null) {
+            fromEndpointReferenceType = true;
+        }
 
         initializeConfig();                                    
     }
@@ -666,11 +662,13 @@
      * @throws MalformedURLException
      */
     private URL setupURL(Message message) throws MalformedURLException {
-        String value = (String)message.get(Message.ENDPOINT_ADDRESS);
+        String result = (String)message.get(Message.ENDPOINT_ADDRESS);
         String pathInfo = (String)message.get(Message.PATH_INFO);
         String queryString = (String)message.get(Message.QUERY_STRING);
-        
-        String result = value != null ? value : getURL().toString();
+        if (result == null) {
+            result = getURL().toString();
+            
+        }
         
         // REVISIT: is this really correct?
         if (null != pathInfo && !result.endsWith(pathInfo)) { 
@@ -724,7 +722,12 @@
      * @return the default target address
      */
     protected String getAddress() throws MalformedURLException {
-        return defaultEndpointAddress;
+        if (defaultEndpointURL != null) {
+            return defaultEndpointURL.toExternalForm();
+        } else if (fromEndpointReferenceType) {
+            return getTarget().getAddress().getValue();
+        }
+        return endpointInfo.getAddress();
     }
 
     /**
@@ -741,7 +744,14 @@
     protected synchronized URL getURL(boolean createOnDemand)
         throws MalformedURLException {
         if (defaultEndpointURL == null && createOnDemand) {
-            defaultEndpointURL = new URL(defaultEndpointAddress);
+            if (fromEndpointReferenceType && getTarget().getAddress().getValue()
!= null) {
+                defaultEndpointURL = new URL(this.getTarget().getAddress().getValue());
+                return defaultEndpointURL;
+            }
+            if (endpointInfo.getAddress() == null) {
+                throw new MalformedURLException("Invalid address. Endpoint address cannot
be null.");
+            }
+            defaultEndpointURL = new URL(endpointInfo.getAddress());
         }
         return defaultEndpointURL;
     }



Mime
View raw message