Package io.hawt.web.auth
Class RelativeRequestUri
java.lang.Object
io.hawt.web.auth.RelativeRequestUri
URI path relative to a given index. An index represents the number of path
components (portions of request uri separated by '/' character) preceding the
start of the uri. For example:
| Request URI | Path Index | Relative URI |
|---|---|---|
| /a/b/c | 0 | /a/b/c |
| /a/b/c | 1 | /b/c |
| /a/b/c | 3 | (empty) |
-
Constructor Summary
ConstructorsConstructorDescriptionRelativeRequestUri(jakarta.servlet.http.HttpServletRequest request, int pathIndex) Constructor. -
Method Summary
-
Constructor Details
-
RelativeRequestUri
public RelativeRequestUri(jakarta.servlet.http.HttpServletRequest request, int pathIndex) Constructor.- Parameters:
request- HTTP requestpathIndex- index of the first path component relative to a servlet root (not context root!). Path components are parts of the request uri separated by '/' with the first component (servlet root) being assigned index zero.- Throws:
IllegalArgumentException- if pathIndex is negative
-
-
Method Details
-
getRequest
public jakarta.servlet.http.HttpServletRequest getRequest()Gets the original HTTP request.- Returns:
- HTTP request
-
getPrefix
Gets the absolute path from the context root to the start of the uri.- Returns:
- uri prefix
-
getUri
Gets the uri.- Returns:
- request uri
-
getComponents
Gets components of the uri. The result is achieved by splitting request uri using '/' as separator.- Returns:
- array of strings
-
getLastComponent
Gets the last component of request uri.- Returns:
- last uri component or
nullif request is empty
-
toString
-