Author: asoldano
Date: Tue Dec 4 18:24:03 2012
New Revision: 1417095
URL: http://svn.apache.org/viewvc?rev=1417095&view=rev
Log:
[CXF-4674] Early consume publishedEndpointUrl information
Modified:
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
Modified:
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java?rev=1417095&r1=1417094&r2=1417095&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
(original)
+++
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
Tue Dec 4 18:24:03 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,7 @@ import org.apache.cxf.databinding.DataBi
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.endpoint.ServerImpl;
import org.apache.cxf.feature.Feature;
+import org.apache.cxf.frontend.WSDLGetUtils;
import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.interceptor.Interceptor;
import org.apache.cxf.interceptor.InterceptorProvider;
@@ -70,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 {
@@ -334,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/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java?rev=1417095&r1=1417094&r2=1417095&view=diff
==============================================================================
---
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
(original)
+++
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
Tue Dec 4 18:24:03 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());