Class UriPatternType.RegexUriPatternMatcher

java.lang.Object
com.google.inject.servlet.UriPatternType.RegexUriPatternMatcher
All Implemented Interfaces:
UriPatternMatcher
Enclosing class:
UriPatternType

private static class UriPatternType.RegexUriPatternMatcher extends Object implements UriPatternMatcher
Matches URIs using a regular expression.
  • Field Details

    • pattern

      private final Pattern pattern
    • originalPattern

      private final String originalPattern
  • Constructor Details

    • RegexUriPatternMatcher

      public RegexUriPatternMatcher(String pattern)
  • Method Details

    • matches

      public boolean matches(String uri)
      Specified by:
      matches in interface UriPatternMatcher
      Parameters:
      uri - A "contextual" (i.e. relative) and "normalized" Request URI, *not* a complete one.
      Returns:
      Returns true if the uri matches the pattern.
    • extractPath

      public String extractPath(String path)
      Specified by:
      extractPath in interface UriPatternMatcher
      Parameters:
      path - The Path that this service pattern can match against.
      Returns:
      Returns a canonical servlet path from this pattern. For instance, if the pattern is /home/* then the path extracted will be /home. Each pattern matcher implementation must decide and publish what a canonical path represents.

      NOTE(user): This method returns null for the regex pattern matcher.

    • getPatternType

      public UriPatternType getPatternType()
      Description copied from interface: UriPatternMatcher
      Returns the type of pattern this is.
      Specified by:
      getPatternType in interface UriPatternMatcher
    • getOriginalPattern

      public String getOriginalPattern()
      Description copied from interface: UriPatternMatcher
      Returns the original pattern that was registered.
      Specified by:
      getOriginalPattern in interface UriPatternMatcher