TUCJVXCB commented on code in PR #11638: URL: https://github.com/apache/camel/pull/11638#discussion_r1361869928
########## core/camel-support/src/main/java/org/apache/camel/support/RestConsumerContextPathMatcher.java: ########## @@ -331,11 +345,31 @@ private static int countWildcards(String consumerPath) { String[] consumerPaths = consumerPath.split("/"); for (String p2 : consumerPaths) { if (p2.startsWith("{") && p2.endsWith("}")) { - wildcards++; + curlyBraces++; } } - return wildcards; + return curlyBraces; + } + + private static boolean matchWildCard(String requestPath, String consumerPath) { + if (!requestPath.endsWith("/")) { + requestPath = requestPath + "/"; + } + // Convert URI template to a regex pattern + String regex = consumerPath + .replace("/", "\\/") + .replace("{", "(?<") + .replace("}", ">[^\\/]+)"); + + // Add support for wildcard * as path suffix + regex = regex.replace("*", ".*"); + + // Match the provided path against the regex pattern Review Comment: > Is there a way to avoid regexp compile, as its slow and would impact high performance. We need to do a simpler way of checking this. Trie tree is suitable for route matching, but it may require substantial code modifications. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org