Package com.google.inject.servlet
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 Summary
Modifier and TypeMethodDescriptionextractPath
(String pattern) Returns the original pattern that was registered.Returns the type of pattern this is.boolean
-
Method Details
-
matches
- 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
- 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(user): 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.
-