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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
extractPath(java.lang.String pattern)
java.lang.String
getOriginalPattern()
Returns the original pattern that was registered.UriPatternType
getPatternType()
Returns the type of pattern this is.boolean
matches(java.lang.String uri)
-
-
-
Method Detail
-
matches
boolean matches(java.lang.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
java.lang.String extractPath(java.lang.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(user): This method returns null for the regex pattern matcher.
-
getPatternType
UriPatternType getPatternType()
Returns the type of pattern this is.
-
getOriginalPattern
java.lang.String getOriginalPattern()
Returns the original pattern that was registered.
-
-