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.String
originalPattern
private java.util.regex.Pattern
pattern
-
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.String
extractPath(java.lang.String path)
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
public boolean matches(java.lang.String uri)
- Specified by:
matches
in 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:
extractPath
in 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:UriPatternMatcher
Returns the type of pattern this is.- Specified by:
getPatternType
in interfaceUriPatternMatcher
-
getOriginalPattern
public java.lang.String getOriginalPattern()
Description copied from interface:UriPatternMatcher
Returns the original pattern that was registered.- Specified by:
getOriginalPattern
in interfaceUriPatternMatcher
-
-