Package com.atlassian.confluence.util
Class UrlUtils
- java.lang.Object
-
- com.atlassian.confluence.util.UrlUtils
-
public class UrlUtils extends Object
Contains url utility methods.- Since:
- 5.2
-
-
Field Summary
Fields Modifier and Type Field Description static String
URL_PATTERN
-
Constructor Summary
Constructors Constructor Description UrlUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
addContextPath(String url, ContextPathHolder contextPathHolder)
Adds the context path to the given url, if required.static boolean
isAbsoluteUrl(String url)
Checks if the given URL is absolute.static boolean
isBlogPostCreationUrl(String url)
static boolean
isBlogPostEditUrl(String url)
static boolean
isEditingUrl(String url)
static boolean
isEditorLoaderUrl(String url)
static boolean
isPageCreationUrl(String url)
static boolean
isPageEditUrl(String url)
static boolean
isResumeDraftUrl(String url)
static boolean
isSameOrigin(URL url, URL origin)
static boolean
isTemplateCreationUrl(String url)
static boolean
isTemplateEditUrl(String url)
static String
removeUrlsFromString(String text)
Remove all Urls from a stringstatic boolean
verifyUrl(String url)
Checks if the supplied URL is valid.
-
-
-
Field Detail
-
URL_PATTERN
public static final String URL_PATTERN
-
-
Method Detail
-
isSameOrigin
public static boolean isSameOrigin(URL url, URL origin)
- Parameters:
url
- the url to checkorigin
- the origin to check against.- Returns:
- true if the given url is the same origin as the given origin url otherwise returns false.
-
addContextPath
public static String addContextPath(String url, ContextPathHolder contextPathHolder)
Adds the context path to the given url, if required.- Parameters:
url
- the url to add the context path to.contextPathHolder
- the holder for the context path to add.- Returns:
- the url including the context path, if the url is relative. Otherwise, the original url.
-
verifyUrl
public static boolean verifyUrl(String url)
Checks if the supplied URL is valid.- Parameters:
url
- the URL to check- Returns:
- boolean indicating whether or not it is valid
-
isAbsoluteUrl
public static boolean isAbsoluteUrl(String url)
Checks if the given URL is absolute.- Parameters:
url
- the URL to check.- Returns:
- true, if the URL starts with either the http or https protocol.
-
removeUrlsFromString
public static String removeUrlsFromString(String text)
Remove all Urls from a string- Parameters:
text
- the text to be clean- Returns:
- Urls removed string or "" if input text is null
-
isResumeDraftUrl
public static boolean isResumeDraftUrl(String url)
-
isPageCreationUrl
public static boolean isPageCreationUrl(String url)
-
isPageEditUrl
public static boolean isPageEditUrl(String url)
-
isBlogPostCreationUrl
public static boolean isBlogPostCreationUrl(String url)
-
isBlogPostEditUrl
public static boolean isBlogPostEditUrl(String url)
-
isTemplateCreationUrl
public static boolean isTemplateCreationUrl(String url)
-
isTemplateEditUrl
public static boolean isTemplateEditUrl(String url)
-
isEditorLoaderUrl
public static boolean isEditorLoaderUrl(String url)
-
isEditingUrl
public static boolean isEditingUrl(String url)
-
-