cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1408720 - in /cxf/branches/2.5.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java
Date Tue, 13 Nov 2012 13:46:05 GMT
Author: sergeyb
Date: Tue Nov 13 13:46:04 2012
New Revision: 1408720

URL: http://svn.apache.org/viewvc?rev=1408720&view=rev
Log:
Merged revisions 1408718 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes

................
  r1408718 | sergeyb | 2012-11-13 13:37:13 +0000 (Tue, 13 Nov 2012) | 9 lines
  
  Merged revisions 1408702 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1408702 | sergeyb | 2012-11-13 12:36:35 +0000 (Tue, 13 Nov 2012) | 1 line
    
    [CXF-4631] Using HttpServletRequest.getServerPort to build the absolute URI, thanks to
Jakub BocheĊ„ski
  ........
................

Modified:
    cxf/branches/2.5.x-fixes/   (props changed)
    cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
    cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java

Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1408702
  Merged /cxf/branches/2.6.x-fixes:r1408718

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

Modified: cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java?rev=1408720&r1=1408719&r2=1408720&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
Tue Nov 13 13:46:04 2012
@@ -209,11 +209,13 @@ public final class HttpUtils {
         boolean absolute = u.isAbsolute();
         if (request != null && (!absolute || u.toString().contains(ANY_IP_ADDRESS_START)))
{
             String serverAndPort = request.getServerName();
+            boolean localAddressUsed = false;
             if (absolute && ANY_IP_ADDRESS.equals(serverAndPort)) {
                 serverAndPort = request.getLocalAddr();
+                localAddressUsed = true;
             }
                 
-            int port = request.getLocalPort();
+            int port = localAddressUsed ? request.getLocalPort() : request.getServerPort();
             if (port != DEFAULT_HTTP_PORT) {
                 serverAndPort += ":" + port;
             }

Modified: cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java?rev=1408720&r1=1408719&r2=1408720&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/HttpUtilsTest.java
Tue Nov 13 13:46:04 2012
@@ -171,7 +171,7 @@ public class HttpUtilsTest extends Asser
         EasyMock.expectLastCall().andReturn("http");
         req.getServerName();
         EasyMock.expectLastCall().andReturn("localhost");
-        req.getLocalPort();
+        req.getServerPort();
         EasyMock.expectLastCall().andReturn(8080);
         EasyMock.replay(req);
         URI u = HttpUtils.toAbsoluteUri(URI.create("http://0.0.0.0/bar/foo"), m);
@@ -187,7 +187,7 @@ public class HttpUtilsTest extends Asser
         EasyMock.expectLastCall().andReturn("http");
         req.getServerName();
         EasyMock.expectLastCall().andReturn("localhost");
-        req.getLocalPort();
+        req.getServerPort();
         EasyMock.expectLastCall().andReturn(8080);
         EasyMock.replay(req);
         URI u = HttpUtils.toAbsoluteUri(URI.create("http://0.0.0.0:8080/bar/foo"), m);



Mime
View raw message