Package com.atlassian.confluence.util
Class UrlUtils
java.lang.Object
com.atlassian.confluence.util.UrlUtils
Contains url utility methods.
- Since:
- 5.2
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic StringaddContextPath(String url, ContextPathHolder contextPathHolder) Deprecated, for removal: This API element is subject to removal in a future version.static StringaddContextPath(String url, String context) Adds the context path to the given url, if required.static StringAppends an ampersand if the given string already contains a question mark, or a question mark otherwise.static StringgetJdbcUrlQuery(String jdbcUrl) Parses the query string from a JDBC URL.static booleanisAbsoluteUrl(String url) Checks if the given URL is absolute.static booleanstatic booleanisBlogPostEditUrl(String url) static booleanisEditingUrl(String url) static booleanisEditorLoaderUrl(String url) static booleanisPageCreationUrl(String url) static booleanisPageEditUrl(String url) static booleanisResumeDraftUrl(String url) static booleanisSafeTitleForUrl(String title) static booleanisSameOrigin(URL url, URL origin) static booleanstatic booleanisTemplateEditUrl(String url) static StringremoveUrlsFromString(String text) Remove all Urls from a stringstatic booleanChecks if the supplied URL is valid.
- 
Field Details- 
URL_PATTERN
 
- 
- 
Constructor Details- 
UrlUtilspublic UrlUtils()
 
- 
- 
Method Details- 
isSameOrigin- Parameters:
- url- the url to check
- origin- the origin to check against.
- Returns:
- true if the given url is the same origin as the given origin url otherwise returns false.
 
- 
addContextPath@Deprecated(forRemoval=true, since="9.3") public static String addContextPath(String url, ContextPathHolder contextPathHolder) Deprecated, for removal: This API element is subject to removal in a future version.since 9.3 useaddContextPath(String, String)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.
 
- 
addContextPathAdds the context path to the given url, if required.- Parameters:
- url- the url to add the context path to.
- context- the context path to add.
- Returns:
- the url including the context path, if the url is relative. Otherwise, the original url.
 
- 
verifyUrlChecks if the supplied URL is valid.- Parameters:
- url- the URL to check
- Returns:
- boolean indicating whether or not it is valid
 
- 
isAbsoluteUrlChecks 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.
 
- 
removeUrlsFromStringRemove all Urls from a string- Parameters:
- text- the text to be clean
- Returns:
- Urls removed string or "" if input text is null
 
- 
isResumeDraftUrl
- 
isPageCreationUrl
- 
isPageEditUrl
- 
isBlogPostCreationUrl
- 
isBlogPostEditUrl
- 
isTemplateCreationUrl
- 
isTemplateEditUrl
- 
isEditorLoaderUrl
- 
isEditingUrl
- 
getJdbcUrlQueryParses the query string from a JDBC URL.- Parameters:
- jdbcUrl- a string regarded a URI
- Returns:
- the query string; nullif empty or undefined
 
- 
isSafeTitleForUrl
- 
appendAmpersandOrQuestionMarkAppends an ampersand if the given string already contains a question mark, or a question mark otherwise.- Parameters:
- str- the string to prepare for adding a query param to.
- Returns:
- the given string with a question mark
- Since:
- 8.6
 
 
- 
addContextPath(String, String)