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 PathSpecGroup
group
protected int
pathDepth
protected java.lang.String
pathSpec
protected java.lang.String
prefix
protected int
specLength
protected java.lang.String
suffix
-
Constructor Summary
Constructors Constructor Description PathSpec()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
compareTo(PathSpec other)
boolean
equals(java.lang.Object obj)
java.lang.String
getDeclaration()
The as-provided path spec.PathSpecGroup
getGroup()
int
getPathDepth()
Get the number of path elements that this path spec declares.abstract java.lang.String
getPathInfo(java.lang.String path)
Return the portion of the path that is after the path spec.abstract java.lang.String
getPathMatch(java.lang.String path)
Return the portion of the path that matches a path spec.java.lang.String
getPrefix()
A simple prefix match for the pathspec or nullabstract java.lang.String
getRelativePath(java.lang.String base, java.lang.String path)
Get the relative path.java.lang.String
getSuffix()
A simple suffix match for the pathspec or nullint
hashCode()
abstract boolean
matches(java.lang.String path)
Test to see if the provided path matches this path specjava.lang.String
toString()
-
-
-
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:
compareTo
in interfacejava.lang.Comparable<PathSpec>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in 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:
hashCode
in 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:
toString
in classjava.lang.Object
-
-