com.atlassian.confluence.util
Class UrlUtils
java.lang.Object
com.atlassian.confluence.util.UrlUtils
public class UrlUtils
- extends java.lang.Object
Contains url utility methods.
- Since:
- 5.2
Method Summary |
static java.lang.String |
addContextPath(java.lang.String url,
ContextPathHolder contextPathHolder)
Adds the context path to the given url, if required. |
static boolean |
isAbsoluteUrl(java.lang.String url)
Checks if the given URL is absolute. |
static boolean |
isSameOrigin(java.net.URL url,
java.net.URL origin)
|
static java.lang.String |
removeUrlsFromString(java.lang.String text)
Remove all Urls from a string |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
URL_PATTERN
public static final java.lang.String URL_PATTERN
UrlUtils
public UrlUtils()
isSameOrigin
public static boolean isSameOrigin(java.net.URL url,
java.net.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 java.lang.String addContextPath(java.lang.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.
isAbsoluteUrl
public static boolean isAbsoluteUrl(java.lang.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 java.lang.String removeUrlsFromString(java.lang.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
Copyright © 2003-2014 Atlassian. All Rights Reserved.