You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by as...@apache.org on 2012/12/14 09:24:39 UTC
svn commit: r1421721 -
/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
Author: asoldano
Date: Fri Dec 14 08:24:38 2012
New Revision: 1421721
URL: http://svn.apache.org/viewvc?rev=1421721&view=rev
Log:
[CXF-4695] Applying patch
Modified:
cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
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=1421721&r1=1421720&r2=1421721&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 Fri Dec 14 08:24:38 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
}