Author: ffang
Date: Thu Oct 20 07:47:28 2011
New Revision: 1186645
URL: http://svn.apache.org/viewvc?rev=1186645&view=rev
Log:
Merged revisions 1186634 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1186634 | ffang | 2011-10-20 15:10:30 +0800 (四, 20 10 2011) | 1 line
[CXF-3866]CXF-Service List page mess up in some case
........
Modified:
cxf/branches/2.4.x-fixes/ (props changed)
cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java
cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/UnformattedServiceListWriter.java
cxf/branches/2.4.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=1186645&r1=1186644&r2=1186645&view=diff
==============================================================================
---
cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
(original)
+++
cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
Thu Oct 20 07:47:28 2011
@@ -742,6 +742,9 @@ public abstract class AbstractHTTPDestin
registry = null;
}
+ public String getPath() {
+ return path;
+ }
@Override
public void shutdown() {
Modified:
cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java?rev=1186645&r1=1186644&r2=1186645&view=diff
==============================================================================
---
cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java
(original)
+++
cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java
Thu Oct 20 07:47:28 2011
@@ -24,6 +24,7 @@ import java.util.Map;
import org.apache.cxf.service.model.OperationInfo;
import org.apache.cxf.transport.AbstractDestination;
+import org.apache.cxf.transport.servlet.ServletDestination;
public class FormattedServiceListWriter implements ServiceListWriter {
private String styleSheetPath;
@@ -114,7 +115,11 @@ public class FormattedServiceListWriter
return endpointAddress;
}
endpointAddress = d.getEndpointInfo().getAddress();
- if (basePath == null || endpointAddress.startsWith(basePath)) {
+ if (d instanceof ServletDestination
+ && (endpointAddress.startsWith("http://") ||
endpointAddress.startsWith("https://"))) {
+ String path = ((ServletDestination)d).getPath();
+ return basePath + path;
+ } else if (basePath == null || endpointAddress.startsWith(basePath)) {
return endpointAddress;
} else {
return basePath + endpointAddress;
Modified:
cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/UnformattedServiceListWriter.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/UnformattedServiceListWriter.java?rev=1186645&r1=1186644&r2=1186645&view=diff
==============================================================================
---
cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/UnformattedServiceListWriter.java
(original)
+++
cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/UnformattedServiceListWriter.java
Thu Oct 20 07:47:28 2011
@@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.PrintWriter;
import org.apache.cxf.transport.AbstractDestination;
+import org.apache.cxf.transport.servlet.ServletDestination;
public class UnformattedServiceListWriter implements ServiceListWriter {
boolean renderWsdlList;
@@ -76,7 +77,11 @@ public class UnformattedServiceListWrite
return endpointAddress;
}
endpointAddress = d.getEndpointInfo().getAddress();
- if (basePath == null || endpointAddress.startsWith(basePath)) {
+ if (d instanceof ServletDestination
+ && (endpointAddress.startsWith("http://") ||
endpointAddress.startsWith("https://"))) {
+ String path = ((ServletDestination)d).getPath();
+ return basePath + path;
+ } else if (basePath == null || endpointAddress.startsWith(basePath)) {
return endpointAddress;
} else {
return basePath + endpointAddress;
Modified:
cxf/branches/2.4.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java?rev=1186645&r1=1186644&r2=1186645&view=diff
==============================================================================
---
cxf/branches/2.4.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
(original)
+++
cxf/branches/2.4.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
Thu Oct 20 07:47:28 2011
@@ -143,6 +143,29 @@ public class CXFServletTest extends Abst
}
@Test
+ public void testServiceListWithLoopAddress() throws Exception {
+ ServletUnitClient client = newClient();
+ client.setExceptionsThrownOnErrorStatus(false);
+
+ WebResponse res = client.getResponse(CONTEXT_URL + "/services");
+
+
assertTrue(res.getText().contains("http://localhost/mycontext/services/greeter3"));
+
assertTrue(res.getText().contains("http://localhost/mycontext/services/greeter2"));
+
assertTrue(res.getText().contains("http://localhost/mycontext/services/greeter"));
+ WebRequest req = new GetMethodQueryWebRequest(CONTEXT_URL +
"/services/greeter?wsdl");
+ res = client.getResponse(req);
+ req = new GetMethodQueryWebRequest(CONTEXT_URL +
"/services/greeter2?wsdl");
+ res = client.getResponse(req);
+ req = new GetMethodQueryWebRequest(CONTEXT_URL +
"/services/greeter3?wsdl");
+ res = client.getResponse(req);
+ String loopAddr = "http://127.0.0.1/mycontext";
+ res = client.getResponse(loopAddr + "/services");
+ assertFalse(res.getText().contains(
+
"http://127.0.0.1/mycontext/serviceshttp://localhost/mycontext/services/greeter"));
+
+ }
+
+ @Test
public void testGetWSDL() throws Exception {
ServletUnitClient client = newClient();
client.setExceptionsThrownOnErrorStatus(true);