summaryrefslogtreecommitdiffstats
path: root/jdisc_core
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@yahooinc.com>2022-02-15 14:35:34 +0100
committerHåkon Hallingstad <hakon@yahooinc.com>2022-02-15 14:35:34 +0100
commitef64b3c004c437201a3e3cea6ecde9a0274cb07d (patch)
tree860fc2fd5729d21cc613d7ed4bbdc573e9b63f31 /jdisc_core
parentc4c939d7d0240d238ec7b644a7b7ff37fa12ee80 (diff)
Remove priority from UriPattern
Diffstat (limited to 'jdisc_core')
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/application/UriPattern.java33
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/application/UriPatternTestCase.java14
2 files changed, 0 insertions, 47 deletions
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/application/UriPattern.java b/jdisc_core/src/main/java/com/yahoo/jdisc/application/UriPattern.java
index 4d9a843b8fb..1ddf91aee2b 100644
--- a/jdisc_core/src/main/java/com/yahoo/jdisc/application/UriPattern.java
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/application/UriPattern.java
@@ -29,7 +29,6 @@ import java.util.regex.Pattern;
*/
public class UriPattern implements Comparable<UriPattern> {
- public static final int DEFAULT_PRIORITY = 0;
private static final Pattern PATTERN = Pattern.compile("([^:]+)://([^:/]+)(:((\\*)|([0-9]+)))?/(.*)",
Pattern.UNICODE_CASE | Pattern.CANON_EQ);
private final String pattern;
@@ -38,9 +37,6 @@ public class UriPattern implements Comparable<UriPattern> {
private final int port;
private final GlobPattern path;
- // TODO Vespa 8 jonmv remove
- private final int priority;
-
/**
* <p>Creates a new instance of this class that represents the given pattern string, with a priority of <code>0</code>.
* The input string must be on the form <code>&lt;scheme&gt;://&lt;host&gt;[:&lt;port&gt;]&lt;path&gt;</code>, where
@@ -59,31 +55,6 @@ public class UriPattern implements Comparable<UriPattern> {
port = parseOrZero(matcher.group(4));
path = GlobPattern.compile(nonNullOrWildcard(matcher.group(7)));
pattern = scheme + "://" + host + ":" + (port > 0 ? port : "*") + "/" + path;
- this.priority = DEFAULT_PRIORITY;
- }
-
- /**
- * <p>Creates a new instance of this class that represents the given pattern string, with the given priority. The
- * input string must be on the form <code>&lt;scheme&gt;://&lt;host&gt;[:&lt;port&gt;]&lt;path&gt;</code>, where
- * '*' can be used as a wildcard character at any position.</p>
- *
- * @deprecated Use {@link #UriPattern(String)} and let's avoid another complication here.
- * @param uri The pattern to parse.
- * @param priority The priority of this pattern.
- * @throws IllegalArgumentException If the pattern could not be parsed.
- */
- @Deprecated(forRemoval = true, since = "7")
- public UriPattern(String uri, int priority) {
- Matcher matcher = PATTERN.matcher(uri);
- if (!matcher.find()) {
- throw new IllegalArgumentException(uri);
- }
- scheme = GlobPattern.compile(normalizeScheme(nonNullOrWildcard(matcher.group(1))));
- host = GlobPattern.compile(nonNullOrWildcard(matcher.group(2)));
- port = parseOrZero(matcher.group(4));
- path = GlobPattern.compile(nonNullOrWildcard(matcher.group(7)));
- pattern = scheme + "://" + host + ":" + (port > 0 ? port : "*") + "/" + path;
- this.priority = priority;
}
/**
@@ -135,10 +106,6 @@ public class UriPattern implements Comparable<UriPattern> {
@Override
public int compareTo(UriPattern rhs) {
int cmp;
- cmp = rhs.priority - priority;
- if (cmp != 0) {
- return cmp;
- }
cmp = scheme.compareTo(rhs.scheme);
if (cmp != 0) {
return cmp;
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/UriPatternTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/UriPatternTestCase.java
index f7488aa392a..32327ace4f4 100644
--- a/jdisc_core/src/test/java/com/yahoo/jdisc/application/UriPatternTestCase.java
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/UriPatternTestCase.java
@@ -147,20 +147,6 @@ public class UriPatternTestCase {
}
@Test
- @SuppressWarnings("removal")
- public void requireThatPrioritiesAreOrderedDescending() {
- assertCompareLt(new UriPattern("scheme://host:69/path", 1),
- new UriPattern("scheme://host:69/path", 0));
- }
-
- @Test
- @SuppressWarnings("removal")
- public void requireThatPriorityOrdersBeforeScheme() {
- assertCompareLt(new UriPattern("*://host:69/path", 1),
- new UriPattern("scheme://host:69/path", 0));
- }
-
- @Test
public void requireThatSchemesAreOrdered() {
assertCompareLt("b://host:69/path",
"a://host:69/path");