build() {
+ return new ImmutableSubstringMap<>(table);
+ }
+ }
}
diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/PathMatcher.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/PathMatcher.java
deleted file mode 100644
index c069fe2645a0c..0000000000000
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/PathMatcher.java
+++ /dev/null
@@ -1,223 +0,0 @@
-package io.quarkus.vertx.http.runtime.security;
-
-import java.util.Comparator;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import io.quarkus.vertx.http.runtime.security.ImmutableSubstringMap.SubstringMatch;
-
-/**
- * Handler that dispatches to a given handler based of a prefix match of the path.
- *
- * This only matches a single level of a request, e.g. if you have a request that takes the form:
- *
- * /foo/bar
- *
- *
- * @author Stuart Douglas
- *
- * @deprecated use {@link ImmutablePathMatcher} instead
- */
-@Deprecated
-public class PathMatcher {
-
- private static final String STRING_PATH_SEPARATOR = "/";
-
- private volatile T defaultHandler;
- private final SubstringMap paths = new SubstringMap<>();
- private final ConcurrentMap exactPathMatches = new ConcurrentHashMap<>();
-
- /**
- * lengths of all registered paths
- */
- private volatile int[] lengths = {};
-
- public PathMatcher(final T defaultHandler) {
- this.defaultHandler = defaultHandler;
- }
-
- public PathMatcher() {
- }
-
- /**
- * Matches a path against the registered handlers.
- *
- * @param path The relative path to match
- * @return The match match. This will never be null, however if none matched its value field will be
- */
- public PathMatch match(String path) {
- if (!exactPathMatches.isEmpty()) {
- T match = getExactPath(path);
- if (match != null) {
- return new PathMatch<>(path, "", match);
- }
- }
-
- int length = path.length();
- final int[] lengths = this.lengths;
- for (int pathLength : lengths) {
- if (pathLength == length) {
- SubstringMatch next = paths.get(path, length);
- if (next != null) {
- return new PathMatch<>(path, "", next.getValue());
- }
- } else if (pathLength < length) {
- char c = path.charAt(pathLength);
- if (c == '/') {
-
- //String part = path.substring(0, pathLength);
- SubstringMatch next = paths.get(path, pathLength);
- if (next != null) {
- return new PathMatch<>(next.getKey(), path.substring(pathLength), next.getValue());
- }
- }
- }
- }
- return new PathMatch<>("", path, defaultHandler);
- }
-
- /**
- * Adds a path prefix and a handler for that path. If the path does not start
- * with a / then one will be prepended.
- *
- * The match is done on a prefix bases, so registering /foo will also match /bar. Exact
- * path matches are taken into account first.
- *
- * If / is specified as the path then it will replace the default handler.
- *
- * @param path The path
- * @param handler The handler
- */
- public synchronized PathMatcher addPrefixPath(final String path, final T handler) {
- if (path.isEmpty()) {
- throw new IllegalArgumentException("Path not specified");
- }
-
- if (PathMatcher.STRING_PATH_SEPARATOR.equals(path)) {
- this.defaultHandler = handler;
- return this;
- }
-
- paths.put(path, handler);
-
- buildLengths();
- return this;
- }
-
- public synchronized PathMatcher addExactPath(final String path, final T handler) {
- if (path.isEmpty()) {
- throw new IllegalArgumentException("Path not specified");
- }
- exactPathMatches.put(path, handler);
- return this;
- }
-
- public T getExactPath(final String path) {
- return exactPathMatches.get(path);
- }
-
- public T getPrefixPath(final String path) {
-
- // enable the prefix path mechanism to return the default handler
- SubstringMatch match = paths.get(path);
- if (PathMatcher.STRING_PATH_SEPARATOR.equals(path) && match == null) {
- return this.defaultHandler;
- }
- if (match == null) {
- return null;
- }
-
- // return the value for the given path
- return match.getValue();
- }
-
- private void buildLengths() {
- final Set lengths = new TreeSet<>(new Comparator() {
- @Override
- public int compare(Integer o1, Integer o2) {
- return -o1.compareTo(o2);
- }
- });
- for (String p : paths.keys()) {
- lengths.add(p.length());
- }
-
- int[] lengthArray = new int[lengths.size()];
- int pos = 0;
- for (int i : lengths) {
- lengthArray[pos++] = i;
- }
- this.lengths = lengthArray;
- }
-
- @Deprecated
- public synchronized PathMatcher removePath(final String path) {
- return removePrefixPath(path);
- }
-
- public synchronized PathMatcher removePrefixPath(final String path) {
- if (path == null || path.isEmpty()) {
- throw new IllegalArgumentException("Path not specified");
- }
-
- if (PathMatcher.STRING_PATH_SEPARATOR.equals(path)) {
- defaultHandler = null;
- return this;
- }
-
- paths.remove(path);
-
- buildLengths();
- return this;
- }
-
- public synchronized PathMatcher removeExactPath(final String path) {
- if (path == null || path.isEmpty()) {
- throw new IllegalArgumentException("Path not specified");
- }
-
- exactPathMatches.remove(path);
-
- return this;
- }
-
- public synchronized PathMatcher clearPaths() {
- paths.clear();
- exactPathMatches.clear();
- this.lengths = new int[0];
- defaultHandler = null;
- return this;
- }
-
- public Map getPaths() {
- return paths.toMap();
- }
-
- public static final class PathMatch {
- private final String matched;
- private final String remaining;
- private final T value;
-
- public PathMatch(String matched, String remaining, T value) {
- this.matched = matched;
- this.remaining = remaining;
- this.value = value;
- }
-
- public String getRemaining() {
- return remaining;
- }
-
- public String getMatched() {
- return matched;
- }
-
- public T getValue() {
- return value;
- }
- }
-
-}
diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/SubstringMap.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/SubstringMap.java
deleted file mode 100644
index 75867de490fe0..0000000000000
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/SubstringMap.java
+++ /dev/null
@@ -1,221 +0,0 @@
-package io.quarkus.vertx.http.runtime.security;
-
-import static io.quarkus.vertx.http.runtime.security.ImmutableSubstringMap.doEquals;
-import static io.quarkus.vertx.http.runtime.security.ImmutableSubstringMap.hash;
-import static io.quarkus.vertx.http.runtime.security.ImmutableSubstringMap.tablePos;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.NoSuchElementException;
-
-import io.quarkus.vertx.http.runtime.security.ImmutableSubstringMap.SubstringMatch;
-
-/**
- * A string keyed map that can be accessed as a substring, eliminating the need to allocate a new string
- * to do a key comparison against.
- *
- * This class uses linear probing and is thread safe due to copy on write semantics. As such it is not recommended
- * for data that changes frequently.
- *
- * This class does not actually implement the map interface to avoid implementing unnecessary operations.
- *
- * @author Stuart Douglas
- */
-public class SubstringMap {
-
- private volatile Object[] table = new Object[16];
- private int size;
-
- /**
- * @deprecated use {@link ImmutablePathMatcher}
- */
- @Deprecated
- public SubstringMatch get(String key, int length) {
- return get(key, length, false);
- }
-
- /**
- * @deprecated use {@link ImmutablePathMatcher}
- */
- @Deprecated
- public SubstringMatch get(String key) {
- return get(key, key.length(), false);
- }
-
- @SuppressWarnings("unchecked")
- private SubstringMatch get(String key, int length, boolean exact) {
- if (key.length() < length) {
- throw new IllegalArgumentException();
- }
- Object[] table = this.table;
- int hash = hash(key, length);
- int pos = tablePos(table, hash);
- int start = pos;
- while (table[pos] != null) {
- if (exact) {
- if (table[pos].equals(key)) {
- return (SubstringMatch) table[pos + 1];
- }
- } else {
- if (doEquals((String) table[pos], key, length)) {
- return (SubstringMatch) table[pos + 1];
- }
- }
- pos += 2;
- if (pos >= table.length) {
- pos = 0;
- }
- if (pos == start) {
- return null;
- }
- }
- return null;
- }
-
- /**
- * @deprecated use {@link ImmutablePathMatcher}
- */
- @Deprecated
- public synchronized void put(String key, V value) {
- put(key, value, null);
- }
-
- void put(String key, V value, ImmutablePathMatcher> subPathMatcher) {
- if (key == null) {
- throw new NullPointerException();
- }
-
- Object[] newTable;
- if (table.length / (double) size < 4 && table.length != Integer.MAX_VALUE) {
- newTable = new Object[table.length << 1];
- for (int i = 0; i < table.length; i += 2) {
- if (table[i] != null) {
- doPut(newTable, (String) table[i], table[i + 1]);
- }
- }
- } else {
- newTable = new Object[table.length];
- System.arraycopy(table, 0, newTable, 0, table.length);
- }
- doPut(newTable, key, new SubstringMatch<>(key, value, subPathMatcher));
- this.table = newTable;
- size++;
- }
-
- /**
- * @deprecated use {@link ImmutablePathMatcher}
- */
- @Deprecated
- public synchronized V remove(String key) {
- if (key == null) {
- throw new NullPointerException();
- }
- //we just assume it is present, and always do a copy
- //for this maps intended use cases as a path matcher it won't be called when
- //the value is not present anyway
- V value = null;
- Object[] newTable = new Object[table.length];
- for (int i = 0; i < table.length; i += 2) {
- if (table[i] != null && !table[i].equals(key)) {
- doPut(newTable, (String) table[i], table[i + 1]);
- } else if (table[i] != null) {
- value = (V) table[i + 1];
- size--;
- }
- }
- this.table = newTable;
- if (value == null) {
- return null;
- }
- return ((SubstringMatch) value).getValue();
- }
-
- private void doPut(Object[] newTable, String key, Object value) {
- int hash = hash(key, key.length());
- int pos = tablePos(newTable, hash);
- while (newTable[pos] != null && !newTable[pos].equals(key)) {
- pos += 2;
- if (pos >= newTable.length) {
- pos = 0;
- }
- }
- newTable[pos] = key;
- newTable[pos + 1] = value;
- }
-
- /**
- * @deprecated use {@link ImmutablePathMatcher}
- */
- @Deprecated
- public Map toMap() {
- Map map = new HashMap<>();
- Object[] t = this.table;
- for (int i = 0; i < t.length; i += 2) {
- if (t[i] != null) {
- map.put((String) t[i], ((SubstringMatch) t[i + 1]).getValue());
- }
- }
- return map;
- }
-
- /**
- * @deprecated use {@link ImmutablePathMatcher}
- */
- @Deprecated
- public synchronized void clear() {
- size = 0;
- table = new Object[16];
- }
-
- public Iterable keys() {
- return new Iterable() {
- @Override
- public Iterator iterator() {
- final Object[] tMap = table;
- int i = 0;
- while (i < table.length && tMap[i] == null) {
- i += 2;
- }
- final int startPos = i;
-
- return new Iterator() {
-
- private Object[] map = tMap;
-
- private int pos = startPos;
-
- @Override
- public boolean hasNext() {
- return pos < table.length;
- }
-
- @Override
- public String next() {
- if (!hasNext()) {
- throw new NoSuchElementException();
- }
- String ret = (String) map[pos];
-
- pos += 2;
- while (pos < table.length && tMap[pos] == null) {
- pos += 2;
- }
- return ret;
- }
-
- @Override
- public void remove() {
- throw new UnsupportedOperationException();
- }
- };
- }
- };
-
- }
-
- ImmutableSubstringMap asImmutableMap() {
- return new ImmutableSubstringMap<>(table);
- }
-
-}
diff --git a/independent-projects/tools/registry-client/src/test/resources/catalog-config/quarkus-bom-quarkus-platform-descriptor-999-SNAPSHOT-999-SNAPSHOT.json b/independent-projects/tools/registry-client/src/test/resources/catalog-config/quarkus-bom-quarkus-platform-descriptor-999-SNAPSHOT-999-SNAPSHOT.json
index 1ee6e7f002a23..973f32cb1d933 100644
--- a/independent-projects/tools/registry-client/src/test/resources/catalog-config/quarkus-bom-quarkus-platform-descriptor-999-SNAPSHOT-999-SNAPSHOT.json
+++ b/independent-projects/tools/registry-client/src/test/resources/catalog-config/quarkus-bom-quarkus-platform-descriptor-999-SNAPSHOT-999-SNAPSHOT.json
@@ -1023,7 +1023,7 @@
"guide" : "https://quarkus.io/guides/kafka-reactive-getting-started",
"categories" : [ "messaging" ],
"status" : "stable",
- "config" : [ "mp.messaging.", "quarkus.reactive-messaging.", "quarkus.kafka." ],
+ "config" : [ "mp.messaging.", "quarkus.messaging.", "quarkus.kafka." ],
"built-with-quarkus-core" : "999-SNAPSHOT",
"extension-dependencies" : [ "io.quarkus:quarkus-kafka-client", "io.quarkus:quarkus-arc", "io.quarkus:quarkus-core", "io.quarkus:quarkus-caffeine", "io.quarkus:quarkus-jackson", "io.quarkus:quarkus-smallrye-reactive-messaging", "io.quarkus:quarkus-mutiny-reactive-streams-operators", "io.quarkus:quarkus-mutiny", "io.quarkus:quarkus-smallrye-context-propagation", "io.quarkus:quarkus-vertx", "io.quarkus:quarkus-netty" ]
},
@@ -1038,7 +1038,7 @@
"guide" : "https://quarkus.io/guides/amqp",
"categories" : [ "messaging" ],
"status" : "stable",
- "config" : [ "mp.messaging.", "quarkus.reactive-messaging.", "quarkus.amqp." ],
+ "config" : [ "mp.messaging.", "quarkus.messaging.", "quarkus.amqp." ],
"built-with-quarkus-core" : "999-SNAPSHOT",
"extension-dependencies" : [ "io.quarkus:quarkus-mutiny-reactive-streams-operators", "io.quarkus:quarkus-mutiny", "io.quarkus:quarkus-core", "io.quarkus:quarkus-smallrye-context-propagation", "io.quarkus:quarkus-smallrye-reactive-messaging", "io.quarkus:quarkus-arc", "io.quarkus:quarkus-vertx", "io.quarkus:quarkus-netty", "io.quarkus:quarkus-jackson" ]
},
@@ -1051,7 +1051,7 @@
"keywords" : [ "mqtt", "reactive-mqtt" ],
"categories" : [ "messaging" ],
"status" : "preview",
- "config" : [ "mp.messaging.", "quarkus.reactive-messaging." ],
+ "config" : [ "mp.messaging.", "quarkus.messaging." ],
"built-with-quarkus-core" : "999-SNAPSHOT",
"extension-dependencies" : [ "io.quarkus:quarkus-mutiny-reactive-streams-operators", "io.quarkus:quarkus-mutiny", "io.quarkus:quarkus-core", "io.quarkus:quarkus-smallrye-context-propagation", "io.quarkus:quarkus-smallrye-reactive-messaging", "io.quarkus:quarkus-arc", "io.quarkus:quarkus-vertx", "io.quarkus:quarkus-netty", "io.quarkus:quarkus-jackson" ]
},
diff --git a/integration-tests/devmode/pom.xml b/integration-tests/devmode/pom.xml
index 5963045aa0889..fd04d7eb2ac6b 100644
--- a/integration-tests/devmode/pom.xml
+++ b/integration-tests/devmode/pom.xml
@@ -51,7 +51,7 @@