Package org.eclipse.jetty.http.pathmap
Class PathSpec
- java.lang.Object
-
- org.eclipse.jetty.http.pathmap.PathSpec
-
- All Implemented Interfaces:
Comparable<PathSpec>
- Direct Known Subclasses:
RegexPathSpec,ServletPathSpec
public abstract class PathSpec extends Object implements Comparable<PathSpec>
The base PathSpec, what all other path specs are based on
-
-
Field Summary
Fields Modifier and Type Field Description protected PathSpecGroupgroupprotected intpathDepthprotected StringpathSpecprotected Stringprefixprotected intspecLengthprotected Stringsuffix
-
Constructor Summary
Constructors Constructor Description PathSpec()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intcompareTo(PathSpec other)booleanequals(Object obj)StringgetDeclaration()The as-provided path spec.PathSpecGroupgetGroup()intgetPathDepth()Get the number of path elements that this path spec declares.abstract StringgetPathInfo(String path)Return the portion of the path that is after the path spec.abstract StringgetPathMatch(String path)Return the portion of the path that matches a path spec.StringgetPrefix()A simple prefix match for the pathspec or nullabstract StringgetRelativePath(String base, String path)Get the relative path.StringgetSuffix()A simple suffix match for the pathspec or nullinthashCode()abstract booleanmatches(String path)Test to see if the provided path matches this path specStringtoString()
-
-
-
Field Detail
-
pathSpec
protected String pathSpec
-
group
protected PathSpecGroup group
-
pathDepth
protected int pathDepth
-
specLength
protected int specLength
-
prefix
protected String prefix
-
suffix
protected String suffix
-
-
Method Detail
-
compareTo
public int compareTo(PathSpec other)
- Specified by:
compareToin interfaceComparable<PathSpec>
-
getGroup
public PathSpecGroup getGroup()
-
getPathDepth
public int getPathDepth()
Get the number of path elements that this path spec declares.This is used to determine longest match logic.
- Returns:
- the depth of the path segments that this spec declares
-
getPathInfo
public abstract String getPathInfo(String path)
Return the portion of the path that is after the path spec.- Parameters:
path- the path to match against- Returns:
- the path info portion of the string
-
getPathMatch
public abstract String getPathMatch(String path)
Return the portion of the path that matches a path spec.- Parameters:
path- the path to match against- Returns:
- the match, or null if no match at all
-
getDeclaration
public String getDeclaration()
The as-provided path spec.- Returns:
- the as-provided path spec
-
getPrefix
public String getPrefix()
A simple prefix match for the pathspec or null- Returns:
- A simple prefix match for the pathspec or null
-
getSuffix
public String getSuffix()
A simple suffix match for the pathspec or null- Returns:
- A simple suffix match for the pathspec or null
-
getRelativePath
public abstract String getRelativePath(String base, String path)
Get the relative path.- Parameters:
base- the base the path is relative topath- the additional path- Returns:
- the base plus path with pathSpec portion removed
-
matches
public abstract boolean matches(String path)
Test to see if the provided path matches this path spec- Parameters:
path- the path to test- Returns:
- true if the path matches this path spec, false otherwise
-
-