cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterjo...@apache.org
Subject svn commit: r495793 - in /incubator/cxf/trunk/rt/core/src: main/java/org/apache/cxf/transport/HttpUriMapper.java test/java/org/apache/cxf/transport/HttpUriMapperTest.java
Date Sat, 13 Jan 2007 00:07:18 GMT
Author: peterjones
Date: Fri Jan 12 16:07:18 2007
New Revision: 495793

URL: http://svn.apache.org/viewvc?view=rev&rev=495793
Log:
Minor fix to HttpUriMapper.

If the path part of the uri passed in to the getResourceBase() method had only a
single '/', then it would return "/" instead of the full resource base.  Caused
a problem in the case where a service publishes two endpoints on addresses like
this:
http://localhost:8080/SoapPort1
http://localhost:8080/SoapPort2
The first published endpoint would get all the messages.  Updated the
HttpUriMapperTest.

Modified:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/HttpUriMapper.java
    incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/transport/HttpUriMapperTest.java

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/HttpUriMapper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/HttpUriMapper.java?view=diff&rev=495793&r1=495792&r2=495793
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/HttpUriMapper.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/HttpUriMapper.java
Fri Jan 12 16:07:18 2007
@@ -22,13 +22,13 @@
 public final class HttpUriMapper {
     
     private HttpUriMapper() {
-        // Util class dont need public constructor
+        // Util class doesn't need public constructor
     }
     
     public static String getContextName(String path) {
         String contextName = "";        
         int idx = path.lastIndexOf('/');
-        if (idx > 0) {
+        if (idx >= 0) {
             contextName = path.substring(0, idx);          
         }
         return contextName;
@@ -37,7 +37,7 @@
     public static String getResourceBase(String path) {
         String servletMap = "";
         int idx = path.lastIndexOf('/');
-        if (idx > 0) {
+        if (idx >= 0) {
             servletMap = path.substring(idx);
         }
         if ("".equals(servletMap) || "".equals(path)) {

Modified: incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/transport/HttpUriMapperTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/transport/HttpUriMapperTest.java?view=diff&rev=495793&r1=495792&r2=495793
==============================================================================
--- incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/transport/HttpUriMapperTest.java
(original)
+++ incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/transport/HttpUriMapperTest.java
Fri Jan 12 16:07:18 2007
@@ -47,5 +47,8 @@
         url = new URL("http://localhost:8080/SoapContext/SoapPort/");
         path = url.getPath();
         assertEquals("/", HttpUriMapper.getResourceBase(path));
+        url = new URL("http://localhost:8080/SoapPort");
+        path = url.getPath();
+        assertEquals("/SoapPort", HttpUriMapper.getResourceBase(path));
     }
 }



Mime
View raw message