You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2011/08/02 21:32:18 UTC
svn commit: r1153251 - in /cxf/branches/2.4.x-fixes: ./
rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistryImpl.java
rt/transports/http/src/test/java/org/apache/cxf/transport/http/DestinationRegistryImplTest.java
Author: sergeyb
Date: Tue Aug 2 19:32:17 2011
New Revision: 1153251
URL: http://svn.apache.org/viewvc?rev=1153251&view=rev
Log:
Merged revisions 1153249 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1153249 | sergeyb | 2011-08-02 20:27:57 +0100 (Tue, 02 Aug 2011) | 1 line
[CXF-3510] Better support for addresses with trailing slashes
........
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/DestinationRegistryImpl.java
cxf/branches/2.4.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/DestinationRegistryImplTest.java
Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
svn:mergeinfo = /cxf/trunk:1153249
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/DestinationRegistryImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistryImpl.java?rev=1153251&r1=1153250&r2=1153251&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistryImpl.java (original)
+++ cxf/branches/2.4.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/DestinationRegistryImpl.java Tue Aug 2 19:32:17 2011
@@ -33,7 +33,7 @@ import java.util.concurrent.ConcurrentMa
import org.apache.cxf.transport.AbstractDestination;
public class DestinationRegistryImpl implements DestinationRegistry {
-
+ private static final String SLASH = "/";
private ConcurrentMap<String, AbstractHTTPDestination> destinations
= new ConcurrentHashMap<String, AbstractHTTPDestination>();
private Map<String, AbstractHTTPDestination> decodedDestinations =
@@ -78,12 +78,14 @@ public class DestinationRegistryImpl imp
public AbstractHTTPDestination checkRestfulRequest(String address) {
int len = -1;
AbstractHTTPDestination ret = null;
- for (String path : getDestinationsPaths()) {
- if ((address.equals(path)
- || "/".equals(path)
- || (address.length() > path.length()
- && address.startsWith(path) && address.charAt(path.length()) == '/'))
- && path.length() > len) {
+ for (String path : getDestinationsPaths()) {
+ String thePath = path.length() > 1 && path.endsWith(SLASH)
+ ? path.substring(0, path.length() - 1) : path;
+ if ((address.equals(thePath)
+ || SLASH.equals(thePath)
+ || (address.length() > thePath.length()
+ && address.startsWith(thePath) && address.charAt(thePath.length()) == '/'))
+ && thePath.length() > len) {
ret = getDestinationForPath(path);
len = path.length();
}
Modified: cxf/branches/2.4.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/DestinationRegistryImplTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/DestinationRegistryImplTest.java?rev=1153251&r1=1153250&r2=1153251&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/DestinationRegistryImplTest.java (original)
+++ cxf/branches/2.4.x-fixes/rt/transports/http/src/test/java/org/apache/cxf/transport/http/DestinationRegistryImplTest.java Tue Aug 2 19:32:17 2011
@@ -41,13 +41,13 @@ public class DestinationRegistryImplTest
private static final QName QNAME = new QName(ADDRESS, "foobar");
private static final String[] REGISTERED_PATHS = {"/soap", "/soap2", "/soappath", "/soap/test",
- "/test/tst"};
+ "/test/tst", "/test2/"};
private static final String[] REQUEST_PATHS = {"/soap", "/soap/2", "/soap2", "/soap3",
"/soap/test", "/soap/tst", "/soap/", "/test/tst/2",
- "/test/2"};
+ "/test/2", "/test2", "/test2/", "/test2/3"};
private static final int[] MATCHED_PATH_INDEXES = {0, 0, 1, -1,
3, 0, 0, 4,
- -1};
+ -1, 5, 5, 5};
private IMocksControl control;
private DestinationRegistry registry;
private MessageObserver observer;