davsclaus commented on code in PR #11638:
URL: https://github.com/apache/camel/pull/11638#discussion_r1361904133


##########
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:
   Ah okay pre-compiled really helps, so its only calling the matcher per 
message



-- 
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

Reply via email to