Class PathPattern

java.lang.Object
org.glassfish.jersey.uri.PatternWithGroups
org.glassfish.jersey.uri.PathPattern

public final class PathPattern extends PatternWithGroups
A path pattern that is a regular expression generated from a URI path template.

The path pattern is normalized by removing a terminating "/" if present.

The path pattern is post-fixed with a right hand pattern that consists of either a matching group that matches zero or more path segments, see PathPattern.RightHandPath.capturingZeroOrMoreSegments, or zero path segments, see PathPattern.RightHandPath.capturingZeroSegments.

  • Field Details

    • EMPTY_PATTERN

      public static final PathPattern EMPTY_PATTERN
      Empty path pattern matching only empty string.
    • END_OF_PATH_PATTERN

      public static final PathPattern END_OF_PATH_PATTERN
      Path pattern matching the end of a URI path. Can be either empty "" or contain a trailing slash "/".
    • OPEN_ROOT_PATH_PATTERN

      public static final PathPattern OPEN_ROOT_PATH_PATTERN
      Path pattern matching the any URI path.
    • COMPARATOR

      public static final Comparator<PathPattern> COMPARATOR
      Path pattern comparator that defers to comparing the templates associated with the patterns.
    • template

      private final UriTemplate template
  • Constructor Details

  • Method Details

    • asClosed

      public static PathPattern asClosed(PathPattern pattern)
      Return a new path pattern with a same path template but a closed right hand path.
      Parameters:
      pattern - an (open) path pattern to convert to a closed pattern.
      Returns:
      closed path pattern for the same path template.
    • getTemplate

      public UriTemplate getTemplate()
    • postfixWithCapturingGroup

      private static String postfixWithCapturingGroup(String regex)
    • postfixWithCapturingGroup

      private static String postfixWithCapturingGroup(String regex, PathPattern.RightHandPath rhpp)
    • addIndexForRightHandPathCapturingGroup

      private static int[] addIndexForRightHandPathCapturingGroup(int numberOfGroups, int[] indexes)