public class UrlUtil extends Object
For internal use only. May be renamed or removed in a future release.
Modifier and Type | Method and Description |
---|---|
static String |
encodeURI(String uri)
Encodes a full URI.
|
static String |
encodeURIComponent(String path)
Encodes a path segment of a URI.
|
static boolean |
isExternal(String url)
checks if the given url is an external URL (e.g.
|
public static boolean isExternal(String url)
url
- is the url to be checked.public static String encodeURI(String uri)
Corresponds to encodeURI in JavaScript https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI
The path can contain /
and other special URL characters as these
will not be encoded. See encodeURIComponent(String)
if you want
to encode all special characters.
The following characters are not escaped: A-Za-z0-9;,/?:@&=+$-_.!~*'()#
uri
- the uri to encodepublic static String encodeURIComponent(String path)
Corresponds to encodeURIComponent in JavaScript https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
The following characters are not escaped: A-Za-z0-9-_.!~*'()
path
- the path to encodeCopyright © 2024. All rights reserved.