@ -75,12 +83,17 @@ public class ParsingPathMatcher implements PathMatcher {
@@ -75,12 +83,17 @@ public class ParsingPathMatcher implements PathMatcher {
@ -100,22 +113,38 @@ public class ParsingPathMatcher implements PathMatcher {
@@ -100,22 +113,38 @@ public class ParsingPathMatcher implements PathMatcher {
PathPatternp2=getPathPattern(o2);
returnthis.ppcp.compare(p1,p2);
}
}
@Override
publicbooleanisPattern(Stringpath){
// TODO crude, should be smarter, lookup pattern and ask it
/** First path element in the parsed chain of path elements for this pattern */
privatePathElementhead;
@ -88,12 +87,12 @@ public class PathPattern implements Comparable<PathPattern> {
@@ -88,12 +87,12 @@ public class PathPattern implements Comparable<PathPattern> {
@ -106,41 +105,58 @@ public class PathPattern implements Comparable<PathPattern> {
@@ -106,41 +105,58 @@ public class PathPattern implements Comparable<PathPattern> {
path="";// Will allow CaptureTheRest to bind the variable to empty
}
else{
@ -148,31 +164,31 @@ public class PathPattern implements Comparable<PathPattern> {
@@ -148,31 +164,31 @@ public class PathPattern implements Comparable<PathPattern> {
@ -194,7 +210,7 @@ public class PathPattern implements Comparable<PathPattern> {
@@ -194,7 +210,7 @@ public class PathPattern implements Comparable<PathPattern> {
@ -202,7 +218,7 @@ public class PathPattern implements Comparable<PathPattern> {
@@ -202,7 +218,7 @@ public class PathPattern implements Comparable<PathPattern> {
@ -212,31 +228,19 @@ public class PathPattern implements Comparable<PathPattern> {
@@ -212,31 +228,19 @@ public class PathPattern implements Comparable<PathPattern> {
@ -253,26 +257,29 @@ public class PathPattern implements Comparable<PathPattern> {
@@ -253,26 +257,29 @@ public class PathPattern implements Comparable<PathPattern> {
// Now separatorCount indicates how many sections of the path to skip
char[]pathChars=path.toCharArray();
intlen=pathChars.length;
@ -289,6 +296,7 @@ public class PathPattern implements Comparable<PathPattern> {
@@ -289,6 +296,7 @@ public class PathPattern implements Comparable<PathPattern> {
end--;
}
}
// Check if multiple separators embedded in the resulting path, if so trim them out.
// Example: aaa////bbb//ccc/d -> aaa/bbb/ccc/d
// The stringWithDuplicateSeparatorsRemoved is only computed if necessary
@ -314,28 +322,31 @@ public class PathPattern implements Comparable<PathPattern> {
@@ -314,28 +322,31 @@ public class PathPattern implements Comparable<PathPattern> {
@ -344,26 +355,28 @@ public class PathPattern implements Comparable<PathPattern> {
@@ -344,26 +355,28 @@ public class PathPattern implements Comparable<PathPattern> {
return+1;
}
}
elseif(p.isCatchAll()){
elseif(otherPattern.isCatchAll()){
return-1;
}
// 3) This will sort such that if they differ in terms of wildcards or
// captured variable counts, the one with the most will be sorted last
@ -371,28 +384,118 @@ public class PathPattern implements Comparable<PathPattern> {
@@ -371,28 +384,118 @@ public class PathPattern implements Comparable<PathPattern> {
@ -400,18 +503,44 @@ public class PathPattern implements Comparable<PathPattern> {
@@ -400,18 +503,44 @@ public class PathPattern implements Comparable<PathPattern> {
@ -430,9 +559,9 @@ public class PathPattern implements Comparable<PathPattern> {
@@ -430,9 +559,9 @@ public class PathPattern implements Comparable<PathPattern> {
privateMap<String,String>extractedVariables;
booleanextractingVariables;
booleandetermineRemainingPath=false;
// if determineRemaining is true, this is set to the position in
// the candidate where the pattern finished matching - i.e. it
// points to the remaining path that wasn't consumed
@ -447,7 +576,7 @@ public class PathPattern implements Comparable<PathPattern> {
@@ -447,7 +576,7 @@ public class PathPattern implements Comparable<PathPattern> {
publicvoidsetMatchAllowExtraPath(){
determineRemainingPath=true;
}
publicbooleanisAllowOptionalTrailingSlash(){
returnallowOptionalTrailingSlash;
}
@ -465,7 +594,7 @@ public class PathPattern implements Comparable<PathPattern> {
@@ -465,7 +594,7 @@ public class PathPattern implements Comparable<PathPattern> {
publicMap<String,String>getExtractedVariables(){
if(this.extractedVariables==null){
returnNO_VARIABLES_MAP;
returnCollections.emptyMap();
}
else{
returnthis.extractedVariables;
@ -475,7 +604,6 @@ public class PathPattern implements Comparable<PathPattern> {
@@ -475,7 +604,6 @@ public class PathPattern implements Comparable<PathPattern> {
@ -490,79 +618,4 @@ public class PathPattern implements Comparable<PathPattern> {
@@ -490,79 +618,4 @@ public class PathPattern implements Comparable<PathPattern> {
@ -103,8 +103,8 @@ public abstract class AbstractHandlerMapping extends ApplicationObjectSupport im
@@ -103,8 +103,8 @@ public abstract class AbstractHandlerMapping extends ApplicationObjectSupport im
@ -59,8 +59,8 @@ public class SimpleUrlHandlerMapping extends AbstractUrlHandlerMapping {
@@ -59,8 +59,8 @@ public class SimpleUrlHandlerMapping extends AbstractUrlHandlerMapping {
@ -71,8 +71,8 @@ public class SimpleUrlHandlerMapping extends AbstractUrlHandlerMapping {
@@ -71,8 +71,8 @@ public class SimpleUrlHandlerMapping extends AbstractUrlHandlerMapping {
@ -54,7 +54,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
@@ -54,7 +54,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
@ -64,19 +64,19 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
@@ -64,19 +64,19 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
@ -184,7 +184,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
@@ -184,7 +184,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed