Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8DC0972C9 for ; Thu, 20 Oct 2011 07:48:00 +0000 (UTC) Received: (qmail 8850 invoked by uid 500); 20 Oct 2011 07:47:57 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 8736 invoked by uid 500); 20 Oct 2011 07:47:54 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 8729 invoked by uid 99); 20 Oct 2011 07:47:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Oct 2011 07:47:51 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,NORMAL_HTTP_TO_IP X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Oct 2011 07:47:48 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id CDDDD238890A for ; Thu, 20 Oct 2011 07:47:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1186645 - in /cxf/branches/2.4.x-fixes: ./ rt/transports/http/src/main/java/org/apache/cxf/transport/http/ rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/ systests/transports/src/test/java/org/apache/cxf/syst... Date: Thu, 20 Oct 2011 07:47:28 -0000 To: commits@cxf.apache.org From: ffang@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111020074728.CDDDD238890A@eris.apache.org> 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);