Package org.springframework.http.server
Interface PathContainer
- All Known Subinterfaces:
RequestPath
public interface PathContainer
Structured representation of a URI path parsed viaparsePath(String)
into a sequence ofPathContainer.Separator
andPathContainer.PathSegment
elements.Each
PathContainer.PathSegment
exposes its content in decoded form and with path parameters removed. This makes it safe to match one path segment at a time without the risk of decoded reserved characters altering the structure of the path.- Since:
- 5.0
- Author:
- Rossen Stoyanchev
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
PathContainer.Element
A path element, either separator or path segment.static class
PathContainer.Options
Options to customize parsing based on the type of input path.static interface
PathContainer.PathSegment
Path segment element.static interface
PathContainer.Separator
Path separator element.
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description List<PathContainer.Element>
elements()
The contained path elements, eitherPathContainer.Separator
orPathContainer.PathSegment
.static PathContainer
parsePath(String path)
static PathContainer
parsePath(String path, PathContainer.Options options)
Parse the path value into a sequence ofSeparator
andPathSegment
elements.default PathContainer
subPath(int index)
Extract a sub-path from the given offset into the elements list.default PathContainer
subPath(int startIndex, int endIndex)
Extract a sub-path from the given start offset into the element list (inclusive) and to the end offset (exclusive).String
value()
The original path from which this instance was parsed.
Method Detail
elements
List<PathContainer.Element> elements()
The contained path elements, eitherPathContainer.Separator
orPathContainer.PathSegment
.
subPath
default PathContainer subPath(int index)
Extract a sub-path from the given offset into the elements list.- Parameters:
index
- the start element index (inclusive)- Returns:
- the sub-path
subPath
default PathContainer subPath(int startIndex, int endIndex)
Extract a sub-path from the given start offset into the element list (inclusive) and to the end offset (exclusive).- Parameters:
startIndex
- the start element index (inclusive)endIndex
- the end element index (exclusive)- Returns:
- the sub-path
parsePath
static PathContainer parsePath(String path)
- Parameters:
path
- the encoded, raw path value to parse- Returns:
- the parsed path
parsePath
static PathContainer parsePath(String path, PathContainer.Options options)
Parse the path value into a sequence ofSeparator
andPathSegment
elements.- Parameters:
path
- the encoded, raw path value to parseoptions
- to customize parsing- Returns:
- the parsed path
- Since:
- 5.2