com.atlassian.confluence.util
Class UrlUtils

java.lang.Object
  extended by com.atlassian.confluence.util.UrlUtils

public class UrlUtils
extends java.lang.Object

Contains url utility methods.

Since:
5.2

Constructor Summary
UrlUtils()
           
 
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrlUtils

public UrlUtils()
Method Detail

isSameOrigin

public static boolean isSameOrigin(java.net.URL url,
                                   java.net.URL origin)
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

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.


Copyright © 2003-2014 Atlassian. All Rights Reserved.