Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-11348

Small Performance optimization in RestConsumerContextPathMatcher

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.19.0
    • 2.20.0
    • camel-core, rest
    • None
    • Novice

    Description

      at https://github.com/apache/camel/blob/57711e2696c32ef3ab99ad4ccc62f09bfda2ab40/camel-core/src/main/java/org/apache/camel/support/RestConsumerContextPathMatcher.java#L97 :

              String p1 = requestPath.toLowerCase(Locale.ENGLISH);
              String p2 = consumerPath.toLowerCase(Locale.ENGLISH);
      
              if (p1.equals(p2)) {
                  return true;
              }
      
              if (matchOnUriPrefix && p1.startsWith(p2)) {
                  return true;
              }
      
              return false;
      

      we can improve to:

          if (requestPath.equalsIgnoreCase(consumerPath)) {
            return true;
          }
          return matchOnUriPrefix && requestPath.regionMatches(true, 0, consumerPath, 0, consumerPath.length());
      

      Attachments

        Issue Links

          Activity

            People

              acosentino Andrea Cosentino
              zolyfarkas Zoltan Farkas
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: