You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2012/12/04 21:56:35 UTC

svn commit: r1417171 - in /cxf/branches/2.6.x-fixes/rt/frontend: jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java

Author: dkulp
Date: Tue Dec  4 20:56:34 2012
New Revision: 1417171

URL: http://svn.apache.org/viewvc?rev=1417171&view=rev
Log:
Merged revisions 1417095 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1417095 | asoldano | 2012-12-04 13:24:03 -0500 (Tue, 04 Dec 2012) | 2 lines

  [CXF-4674] Early consume publishedEndpointUrl information

........

Modified:
    cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
    cxf/branches/2.6.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java

Modified: cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java?rev=1417171&r1=1417170&r2=1417171&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java (original)
+++ cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java Tue Dec  4 20:56:34 2012
@@ -31,6 +31,7 @@ import java.util.Map.Entry;
 import java.util.concurrent.Executor;
 import java.util.logging.Logger;
 
+import javax.wsdl.Definition;
 import javax.xml.namespace.QName;
 import javax.xml.transform.Source;
 import javax.xml.ws.Binding;
@@ -60,6 +61,8 @@ import org.apache.cxf.databinding.DataBi
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.endpoint.ServerImpl;
 import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.frontend.WSDLGetUtils;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.interceptor.InterceptorProvider;
 import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
@@ -69,6 +72,8 @@ import org.apache.cxf.message.Message;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.invoker.Invoker;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.wsdl.WSDLManager;
+import org.apache.cxf.wsdl11.WSDLServiceBuilder;
 
 public class EndpointImpl extends javax.xml.ws.Endpoint 
     implements InterceptorProvider, Configurable {
@@ -333,8 +338,15 @@ public class EndpointImpl extends javax.
                     endpointInfo.setAddress(addr);
                 }
                 if (publishedEndpointUrl != null) {
-                    // TODO is there a good place to put this key-string as a constant?
-                    endpointInfo.setProperty("publishedEndpointUrl", publishedEndpointUrl);
+                    endpointInfo.setProperty(WSDLGetUtils.PUBLISHED_ENDPOINT_URL, publishedEndpointUrl);
+                    //early update the publishedEndpointUrl so that endpoints in the same app sharing the same wsdl
+                    //do not require all of them to be queried for wsdl before the wsdl is finally fully updated
+                    Definition def = endpointInfo.getService()
+                        .getProperty(WSDLServiceBuilder.WSDL_DEFINITION, Definition.class);
+                    if (def == null) {
+                        bus.getExtension(WSDLManager.class).getDefinition(wsdlLocation);
+                    }
+                    new WSDLGetUtils().updateWSDLPublishedEndpointAddress(def, endpointInfo);
                 }
 
                 if (null != properties) {

Modified: cxf/branches/2.6.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java?rev=1417171&r1=1417170&r2=1417171&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java (original)
+++ cxf/branches/2.6.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java Tue Dec  4 20:56:34 2012
@@ -215,7 +215,7 @@ public class WSDLGetUtils {
                         updatePublishedEndpointUrl(epurl, def, endpointInfo.getName());
                         base = epurl;
                     }
-        
+
                     WSDLWriter wsdlWriter = bus.getExtension(WSDLManager.class)
                         .getWSDLFactory().newWSDLWriter();
                     def.setExtensionRegistry(bus.getExtension(WSDLManager.class).getExtensionRegistry());
@@ -436,6 +436,19 @@ public class WSDLGetUtils {
             }
         }
     }    
+    
+    public void updateWSDLPublishedEndpointAddress(Definition def, EndpointInfo endpointInfo)
+    {
+        synchronized (def) {
+            //writing a def is not threadsafe.  Sync on it to make sure
+            //we don't get any ConcurrentModificationExceptions
+            if (endpointInfo.getProperty(PUBLISHED_ENDPOINT_URL) != null) {
+                String epurl = 
+                    String.valueOf(endpointInfo.getProperty(PUBLISHED_ENDPOINT_URL));
+                updatePublishedEndpointUrl(epurl, def, endpointInfo.getName());
+            }
+        }
+    }
 
     protected void updatePublishedEndpointUrl(String publishingUrl, Definition def, QName name) {
         Collection<Service> services = CastUtils.cast(def.getAllServices().values());