cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asold...@apache.org
Subject svn commit: r1421744 - in /cxf/branches/2.6.x-fixes: ./ rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
Date Fri, 14 Dec 2012 08:57:05 GMT
Author: asoldano
Date: Fri Dec 14 08:57:03 2012
New Revision: 1421744

URL: http://svn.apache.org/viewvc?rev=1421744&view=rev
Log:
Merged revisions 1421721 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1421721 | asoldano | 2012-12-14 09:24:38 +0100 (Fri, 14 Dec 2012) | 2 lines
  
  [CXF-4695] Applying patch
........

Modified:
    cxf/branches/2.6.x-fixes/   (props changed)
    cxf/branches/2.6.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1421721

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

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=1421744&r1=1421743&r2=1421744&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
Fri Dec 14 08:57:03 2012
@@ -21,6 +21,7 @@ package org.apache.cxf.frontend;
 
 import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
+import java.net.URI;
 import java.net.URL;
 import java.net.URLDecoder;
 import java.util.Collection;
@@ -335,9 +336,10 @@ public class WSDLGetUtils {
             List<Element> portList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
                                                                          "http://schemas.xmlsoap.org/wsdl/",
                                                                          "port");
+            String basePath = (String) message.get("http.base.path");
             for (Element el : portList) {
-                rewriteAddressProtocolHostPort(base, el, "http://schemas.xmlsoap.org/wsdl/soap/");
-                rewriteAddressProtocolHostPort(base, el, "http://schemas.xmlsoap.org/wsdl/soap12/");
+                rewriteAddressProtocolHostPort(base, el, basePath, "http://schemas.xmlsoap.org/wsdl/soap/");
+                rewriteAddressProtocolHostPort(base, el, basePath, "http://schemas.xmlsoap.org/wsdl/soap12/");
             }
         }
         Object rewriteSoapAddress = message.getContextualProperty(AUTO_REWRITE_ADDRESS);
@@ -378,19 +380,23 @@ public class WSDLGetUtils {
         }
     }
 
-    protected void rewriteAddressProtocolHostPort(String base, Element el, String soapNS)
{
+    protected void rewriteAddressProtocolHostPort(String base, Element el, String httpBasePathProp,
String soapNS) {
         List<Element> sadEls = DOMUtils.findAllElementsByTagNameNS(el,
                                              soapNS,
                                              "address");
         for (Element soapAddress : sadEls) {
+            String location = soapAddress.getAttribute("location").trim();
             try {
-                String location = soapAddress.getAttribute("location").trim();
-                URL locUrl = new URL(location);
-                URL baseUrl = new URL(base);
-                StringBuilder sb = new StringBuilder(baseUrl.getProtocol());
-                sb.append("://").append(baseUrl.getHost()).append(":").append(baseUrl.getPort())
-                    .append(locUrl.getPath());
-                soapAddress.setAttribute("location", sb.toString());
+                URI locUri = new URI(location);
+                if (locUri.isAbsolute()) {
+                    URL baseUrl = new URL(base);
+                    StringBuilder sb = new StringBuilder(baseUrl.getProtocol());
+                    sb.append("://").append(baseUrl.getHost()).append(":").append(baseUrl.getPort())
+                        .append(locUri.getPath());
+                    soapAddress.setAttribute("location", sb.toString());
+                } else if (httpBasePathProp != null) {
+                    soapAddress.setAttribute("location", httpBasePathProp + location);
+                }
             } catch (Exception e) {
                 //ignore
             }



Mime
View raw message