public class UrlUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static List<String> |
URL_PROTOCOLS |
protected static int |
URL_SCHEMA_LENGTH
Maximum length of a URL schema, e.g.
|
| Constructor and Description |
|---|
UrlUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
buildNewRelativeUrl(javax.servlet.http.HttpServletRequest request,
String name,
String value)
Deprecated.
since 3.12 this is not used. Builds a URL with a new parameter, replacing any existing parameters with that name
but maintaining all other parameters.
For example /foo.html?name=fred&key=FLINT
|
static boolean |
containsUrl(String str) |
static String |
correctBaseUrls(String html,
String baseUrl)
Fixes the URLs used in content imported from external sources to have a base URL that points to that external
source.
|
static String |
escapeSpecialCharacters(String url)
Deprecated.
since 3.12 use
HtmlEscaper.escapeAmpersands(String, boolean) passing 'true' to
preserveExistingEntities. |
static String |
escapeUrlFirstCharacter(String linkBody) |
static Map |
getQueryParameters(String url)
Returns a map of query parameters extracted the given url.
|
static int |
getUrlIndex(String str) |
static boolean |
isRelativeTo(String baseUrl,
String fullUrl)
Test whether is relative to .
|
static boolean |
startsWithUrl(String str) |
protected static final int URL_SCHEMA_LENGTH
public static String escapeSpecialCharacters(String url)
HtmlEscaper.escapeAmpersands(String, boolean) passing 'true' to
preserveExistingEntities.public static boolean startsWithUrl(String str)
public static boolean containsUrl(String str)
public static int getUrlIndex(String str)
public static String correctBaseUrls(String html, String baseUrl)
html - the HTML text which will have its links corrected to match the base URL of the remote server.baseUrl - the URL which local links will be made relative to. Typically this is the base URL of the remote
content.public static String buildNewRelativeUrl(javax.servlet.http.HttpServletRequest request, String name, String value)
request - The current requestname - The name of the parameter to add/replacevalue - The value of the parameter to add/replacepublic static Map getQueryParameters(String url)
url - to extract query parameters fromMap of query parametersCopyright © 2019 Atlassian. All rights reserved.