Package com.google.inject.servlet
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 java.lang.Object implements UriPatternMatcher
Matches URIs using a regular expression.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringoriginalPatternprivate java.util.regex.Patternpattern
-
Constructor Summary
Constructors Constructor Description RegexUriPatternMatcher(java.lang.String pattern)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringextractPath(java.lang.String path)java.lang.StringgetOriginalPattern()Returns the original pattern that was registered.UriPatternTypegetPatternType()Returns the type of pattern this is.booleanmatches(java.lang.String uri)
-
-
-
Method Detail
-
matches
public boolean matches(java.lang.String uri)
- Specified by:
matchesin interfaceUriPatternMatcher- 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 java.lang.String extractPath(java.lang.String path)
- Specified by:
extractPathin interfaceUriPatternMatcher- 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(dhanji): This method returns null for the regex pattern matcher.
-
getPatternType
public UriPatternType getPatternType()
Description copied from interface:UriPatternMatcherReturns the type of pattern this is.- Specified by:
getPatternTypein interfaceUriPatternMatcher
-
getOriginalPattern
public java.lang.String getOriginalPattern()
Description copied from interface:UriPatternMatcherReturns the original pattern that was registered.- Specified by:
getOriginalPatternin interfaceUriPatternMatcher
-
-