|
|
|
|
@ -29,9 +29,7 @@ import org.springframework.web.util.pattern.PathPattern.MatchingContext;
@@ -29,9 +29,7 @@ import org.springframework.web.util.pattern.PathPattern.MatchingContext;
|
|
|
|
|
*/ |
|
|
|
|
class LiteralPathElement extends PathElement { |
|
|
|
|
|
|
|
|
|
private final char[] text; |
|
|
|
|
|
|
|
|
|
private final String textString; |
|
|
|
|
private final String text; |
|
|
|
|
|
|
|
|
|
private final int len; |
|
|
|
|
|
|
|
|
|
@ -42,17 +40,7 @@ class LiteralPathElement extends PathElement {
@@ -42,17 +40,7 @@ class LiteralPathElement extends PathElement {
|
|
|
|
|
super(pos, separator); |
|
|
|
|
this.len = literalText.length; |
|
|
|
|
this.caseSensitive = caseSensitive; |
|
|
|
|
if (caseSensitive) { |
|
|
|
|
this.text = literalText; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
// Force all the text lower case to make matching faster
|
|
|
|
|
this.text = new char[literalText.length]; |
|
|
|
|
for (int i = 0; i < this.len; i++) { |
|
|
|
|
this.text[i] = Character.toLowerCase(literalText[i]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.textString = new String(this.text); |
|
|
|
|
this.text = new String(literalText); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -73,17 +61,13 @@ class LiteralPathElement extends PathElement {
@@ -73,17 +61,13 @@ class LiteralPathElement extends PathElement {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (this.caseSensitive) { |
|
|
|
|
// This typically uses a JVM intrinsic
|
|
|
|
|
if (!this.textString.equals(value)) { |
|
|
|
|
if (!this.text.equals(value)) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
for (int i = 0; i < this.len; i++) { |
|
|
|
|
// TODO revisit performance if doing a lot of case-insensitive matching
|
|
|
|
|
if (Character.toLowerCase(value.charAt(i)) != this.text[i]) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
if (!this.text.equalsIgnoreCase(value)) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -116,7 +100,7 @@ class LiteralPathElement extends PathElement {
@@ -116,7 +100,7 @@ class LiteralPathElement extends PathElement {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public char[] getChars() { |
|
|
|
|
return this.text; |
|
|
|
|
return this.text.toCharArray(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@ -126,7 +110,7 @@ class LiteralPathElement extends PathElement {
@@ -126,7 +110,7 @@ class LiteralPathElement extends PathElement {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String toString() { |
|
|
|
|
return "Literal(" + this.textString + ")"; |
|
|
|
|
return "Literal(" + this.text + ")"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|