Package org.eclipse.jetty.http.pathmap
Class PathSpec
- java.lang.Object
-
- org.eclipse.jetty.http.pathmap.PathSpec
-
- All Implemented Interfaces:
java.lang.Comparable<PathSpec>
- Direct Known Subclasses:
RegexPathSpec,ServletPathSpec
public abstract class PathSpec extends java.lang.Object implements java.lang.Comparable<PathSpec>
The base PathSpec, what all other path specs are based on
-
-
Field Summary
Fields Modifier and Type Field Description protected PathSpecGroupgroupprotected intpathDepthprotected java.lang.StringpathSpecprotected java.lang.Stringprefixprotected intspecLengthprotected java.lang.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(java.lang.Object obj)java.lang.StringgetDeclaration()The as-provided path spec.PathSpecGroupgetGroup()intgetPathDepth()Get the number of path elements that this path spec declares.abstract java.lang.StringgetPathInfo(java.lang.String path)Return the portion of the path that is after the path spec.abstract java.lang.StringgetPathMatch(java.lang.String path)Return the portion of the path that matches a path spec.java.lang.StringgetPrefix()A simple prefix match for the pathspec or nullabstract java.lang.StringgetRelativePath(java.lang.String base, java.lang.String path)Get the relative path.java.lang.StringgetSuffix()A simple suffix match for the pathspec or nullinthashCode()abstract booleanmatches(java.lang.String path)Test to see if the provided path matches this path specjava.lang.StringtoString()
-
-
-
Field Detail
-
pathSpec
protected java.lang.String pathSpec
-
group
protected PathSpecGroup group
-
pathDepth
protected int pathDepth
-
specLength
protected int specLength
-
prefix
protected java.lang.String prefix
-
suffix
protected java.lang.String suffix
-
-
Method Detail
-
compareTo
public int compareTo(PathSpec other)
- Specified by:
compareToin interfacejava.lang.Comparable<PathSpec>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
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 java.lang.String getPathInfo(java.lang.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 java.lang.String getPathMatch(java.lang.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 java.lang.String getDeclaration()
The as-provided path spec.- Returns:
- the as-provided path spec
-
getPrefix
public java.lang.String getPrefix()
A simple prefix match for the pathspec or null- Returns:
- A simple prefix match for the pathspec or null
-
getSuffix
public java.lang.String getSuffix()
A simple suffix match for the pathspec or null- Returns:
- A simple suffix match for the pathspec or null
-
getRelativePath
public abstract java.lang.String getRelativePath(java.lang.String base, java.lang.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
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
matches
public abstract boolean matches(java.lang.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
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-