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

Small Performance optimization in RestConsumerContextPathMatcher

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.19.0
    • Fix Version/s: 2.20.0
    • Component/s: camel-core, rest
    • Labels:
      None
    • Estimated Complexity:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: