SPR-5924 - REOPENED -PathVariable mappings are greedy over hard coded mappings

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1536 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Arjen Poutsma 2009-07-14 07:08:02 +00:00
parent b60127a277
commit 309ba05f0b
2 changed files with 2 additions and 1 deletions

View File

@ -409,7 +409,7 @@ public class AntPathMatcher implements PathMatcher {
if (bracketCount1 < bracketCount2) { if (bracketCount1 < bracketCount2) {
return -1; return -1;
} }
else if (bracketCount1 < bracketCount2) { else if (bracketCount2 < bracketCount1) {
return 1; return 1;
} }
return 0; return 0;

View File

@ -388,6 +388,7 @@ public class AntPathMatcherTests {
assertEquals(1, comparator.compare("/hotels/{hotel}", "/hotels/new")); assertEquals(1, comparator.compare("/hotels/{hotel}", "/hotels/new"));
assertEquals(0, comparator.compare("/hotels/{hotel}", "/hotels/{hotel}")); assertEquals(0, comparator.compare("/hotels/{hotel}", "/hotels/{hotel}"));
assertEquals(-1, comparator.compare("/hotels/{hotel}/booking", "/hotels/{hotel}/bookings/{booking}")); assertEquals(-1, comparator.compare("/hotels/{hotel}/booking", "/hotels/{hotel}/bookings/{booking}"));
assertEquals(1, comparator.compare("/hotels/{hotel}/bookings/{booking}", "/hotels/{hotel}/booking"));
assertEquals(-1, comparator.compare("/hotels/{hotel}", "/hotels/*")); assertEquals(-1, comparator.compare("/hotels/{hotel}", "/hotels/*"));
assertEquals(1, comparator.compare("/hotels/*", "/hotels/{hotel}")); assertEquals(1, comparator.compare("/hotels/*", "/hotels/{hotel}"));