You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by em...@apache.org on 2015/11/05 10:23:58 UTC

[1/2] cxf git commit: [CXF-6172]:WS-Discovery should work also in IPv6 only environment

Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes bee60953d -> 9b0e4b5d9


[CXF-6172]:WS-Discovery should work also in IPv6 only environment


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/6c78cdfe
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/6c78cdfe
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/6c78cdfe

Branch: refs/heads/3.0.x-fixes
Commit: 6c78cdfe39f46bf97ad3aab35f422b411db9bbf0
Parents: bee6095
Author: Jim Ma <em...@apache.org>
Authored: Thu Nov 5 16:51:31 2015 +0800
Committer: Jim Ma <em...@apache.org>
Committed: Thu Nov 5 17:19:28 2015 +0800

----------------------------------------------------------------------
 .../apache/cxf/ws/discovery/WSDiscoveryClient.java | 14 +++++++++++---
 .../discovery/internal/WSDiscoveryServiceImpl.java | 17 ++++++++++++++---
 2 files changed, 25 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/6c78cdfe/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/WSDiscoveryClient.java
----------------------------------------------------------------------
diff --git a/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/WSDiscoveryClient.java b/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/WSDiscoveryClient.java
index e5734ca..ab6c740 100644
--- a/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/WSDiscoveryClient.java
+++ b/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/WSDiscoveryClient.java
@@ -77,10 +77,8 @@ import org.apache.cxf.ws.discovery.wsdl.ScopesType;
 public class WSDiscoveryClient implements Closeable {
     
     public static final QName SERVICE_QNAME = new QName(WSDVersion.NS_1_1, "DiscoveryProxy");
-    
-    
-    
     String address = "soap.udp://239.255.255.250:3702";
+    String ipv6Address = "soap.udp://[FF02::C]:3702";
     boolean adHoc = true;
     AtomicInteger msgId = new AtomicInteger(1);
     long instanceId = System.currentTimeMillis();
@@ -95,9 +93,11 @@ public class WSDiscoveryClient implements Closeable {
 
     public WSDiscoveryClient() {
         this((Bus)null);
+        setIpV6Address();
     }
     public WSDiscoveryClient(Bus b) {
         this.bus = b == null ? BusFactory.getThreadDefaultBus() : b;
+        setIpV6Address();
     }
     public WSDiscoveryClient(String address) {
         this((Bus)null);
@@ -160,6 +160,14 @@ public class WSDiscoveryClient implements Closeable {
             uncache();
         }
     }
+
+    private void setIpV6Address() {
+        String preferIPv4StackValue = System.getProperty("java.net.preferIPv4Stack");
+        String preferIPv6AddressesValue = System.getProperty("java.net.preferIPv6Addresses");
+        if ("true".equals(preferIPv6AddressesValue) && "false".equals(preferIPv4StackValue)) {
+            address = "soap.udp://[FF02::C]:3702";
+        }
+    }
     private void uncache() {
         if (dispatch instanceof Closeable) {
             try {

http://git-wip-us.apache.org/repos/asf/cxf/blob/6c78cdfe/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java b/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java
index 0ddf0c2..00edfe4 100644
--- a/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java
+++ b/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java
@@ -238,15 +238,26 @@ public class WSDiscoveryServiceImpl implements WSDiscoveryService {
         startup(false);
     }    
     public synchronized boolean startup(boolean optional) {
+        String preferIPv4StackValue = System.getProperty("java.net.preferIPv4Stack");
+        String preferIPv6AddressesValue = System.getProperty("java.net.preferIPv6Addresses");
         if (!started && client.isAdHoc()) {
             Bus b = BusFactory.getAndSetThreadDefaultBus(bus);
             try {
                 udpEndpoint = new EndpointImpl(bus, new WSDiscoveryProvider());
                 Map<String, Object> props = new HashMap<String, Object>();
                 props.put("jaxws.provider.interpretNullAsOneway", "true");
-                udpEndpoint.setProperties(props);
-                udpEndpoint.publish("soap.udp://239.255.255.250:3702");
-                started = true;
+                if ("true".equals(preferIPv6AddressesValue) && "false".equals(preferIPv4StackValue)) {
+                    try {
+                        udpEndpoint.publish("soap.udp://[FF02::C]:3702");
+                        started = true;
+                    } catch (Exception e) {
+                        LOG.log(Level.WARNING, "Could not start WS-Discovery Service with ipv6 address", e);
+                    }
+                }
+                if (!started) {
+                    udpEndpoint.publish("soap.udp://239.255.255.250:3702");
+                    started = true;
+                }
             } catch (RuntimeException ex) {
                 if (!optional) {
                     throw ex;


[2/2] cxf git commit: [CXF-6172]:Restore the wrongly delete line

Posted by em...@apache.org.
[CXF-6172]:Restore the wrongly delete line


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/9b0e4b5d
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9b0e4b5d
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9b0e4b5d

Branch: refs/heads/3.0.x-fixes
Commit: 9b0e4b5d9e078416e466bd060497b4ecddb4b05f
Parents: 6c78cdf
Author: Jim Ma <em...@apache.org>
Authored: Thu Nov 5 17:17:08 2015 +0800
Committer: Jim Ma <em...@apache.org>
Committed: Thu Nov 5 17:19:44 2015 +0800

----------------------------------------------------------------------
 .../apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java    | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/9b0e4b5d/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java b/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java
index 00edfe4..ff82f52 100644
--- a/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java
+++ b/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java
@@ -246,6 +246,7 @@ public class WSDiscoveryServiceImpl implements WSDiscoveryService {
                 udpEndpoint = new EndpointImpl(bus, new WSDiscoveryProvider());
                 Map<String, Object> props = new HashMap<String, Object>();
                 props.put("jaxws.provider.interpretNullAsOneway", "true");
+                udpEndpoint.setProperties(props);
                 if ("true".equals(preferIPv6AddressesValue) && "false".equals(preferIPv4StackValue)) {
                     try {
                         udpEndpoint.publish("soap.udp://[FF02::C]:3702");