public final class Paths extends Object
Modifier and Type | Method and Description |
---|---|
static String |
addLeadingSlash(String rawPath)
Add leading slash (if there is not already), returns the same value otherwise.
|
static String |
addTrailingSlash(String rawPath)
Adds a trailing slash at the end of the given raw path or returns the same value if an end slash is present.
|
static List<String> |
getPathElements(String rawPath)
Converts a path into a list of URL-decoded path elements.
|
static String |
joinPath(List<String> elements)
Joins a list of URL-decoded path elements into a url-encoded path.
|
static String |
removeLeadingSlash(String rawPath)
Removes the leading slash, if present, from the resource name.
|
static String |
removeTrailingSlash(String rawPath)
Removes trailing slash (if there is any), returns the same value otherwise.
|
static String |
urlDecode(Object value)
Returns the URL path decoding of the provided object's string
representation.
|
static String |
urlEncode(Object value)
Returns the URL path encoding of the provided object's string
representation.
|
public static String urlDecode(Object value)
value
- The value to be URL path decoded.public static String urlEncode(Object value)
value
- The value to be URL path encoded.public static List<String> getPathElements(String rawPath)
null
, ""
and "/"
will
all return an empty list, and "//"
will return a list with two elements, both
empty strings, as all intermediate and trailing empty paths are retained.rawPath
- The raw, URL-encoded path string.public static String joinPath(List<String> elements)
elements
- The list of (URL-decoded) elements.public static String addTrailingSlash(String rawPath)
rawPath
- The raw, URL-encoded path string, not null
.public static String removeTrailingSlash(String rawPath)
rawPath
- The raw path with (possibly) trailing slash, not null
.public static String addLeadingSlash(String rawPath)
rawPath
- The raw, URL-encoded path string, not null
.public static String removeLeadingSlash(String rawPath)
rawPath
- The raw, URL-encoded path string, not null
.NullPointerException
- If the specified resourceName is null
.Copyright © 2010-2018, ForgeRock All Rights Reserved.