public class UriNormalizationUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static URI |
normalizeWithBase(URI base,
String segment,
boolean trailingSlash)
Resolve a string path against a URI base.
|
static String |
relativize(String rootPath,
String leafPath) |
static URI |
toURI(String path,
boolean trailingSlash)
Create a URI path from a string.
|
public static URI toURI(String path, boolean trailingSlash)
Examples:
toUri("/", true) will return a URI with path /toUri("/", false) will return a URI with an empty path /toUri("./", true) will return a URI with path /toUri("./", false) will return a URI with an empty path /toUri("foo/", true) will return a URI with path foo/toUri("foo/", false) will return a URI with an empty path foopath - String to convert into a URItrailingSlash - true if resulting URI must end with a '/'IllegalArgumentException - if the path contains invalid characters or path segments.public static URI normalizeWithBase(URI base, String segment, boolean trailingSlash)
Examples:
normalizeWithBase(new URI("/"), "example", true)
will return a URI with path /example/normalizeWithBase(new URI("/"), "example", false)
will return a URI with an empty path /examplenormalizeWithBase(new URI("/"), "/example", true)
will return a URI with path /example/normalizeWithBase(new URI("/"), "/example", false)
will return a URI with an empty /examplebase - URI to resolve relative paths. Use toURI(String, boolean) to construct this parameter.segment - Relative or absolute pathtrailingSlash - true if resulting URI must end with a '/'IllegalArgumentException - if the path contains invalid characters or path segments.Copyright © 2021 JBoss by Red Hat. All rights reserved.