Interface UriPatternMatcher

All Known Implementing Classes:
UriPatternType.RegexUriPatternMatcher, UriPatternType.ServletStyleUriPatternMatcher

interface UriPatternMatcher
A general interface for matching a URI against a URI pattern. Guice-servlet provides regex and servlet-style pattern matching out of the box.
  • Method Details

    • matches

      boolean matches(String uri)
      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

      String extractPath(String pattern)
      Parameters:
      pattern - 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(dhanji): This method returns null for the regex pattern matcher.

    • getPatternType

      UriPatternType getPatternType()
      Returns the type of pattern this is.
    • getOriginalPattern

      String getOriginalPattern()
      Returns the original pattern that was registered.