com.atlassian.jira.util
Class BaseUrlSwapper

java.lang.Object
  extended by com.atlassian.jira.util.BaseUrlSwapper

public class BaseUrlSwapper
extends Object

Utility class for swapping the base of a URL.

Since:
v5.0

Constructor Summary
BaseUrlSwapper()
           
 
Method Summary
static String swapBaseUrl(String url, String oldBaseUrl, String newBaseUrl)
          Swap the base of the given url from the oldBaseUrl to the newBaseUrl.
static String swapRpcUrlToDisplayUrl(String url, com.atlassian.applinks.api.ApplicationLink appLink)
          Swap the base of the given url to be the display url of the given application link.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseUrlSwapper

public BaseUrlSwapper()
Method Detail

swapBaseUrl

public static String swapBaseUrl(String url,
                                 String oldBaseUrl,
                                 String newBaseUrl)
Swap the base of the given url from the oldBaseUrl to the newBaseUrl. If the url does not start with the oldBaseUrl, the original url is returned. If the url is null, null is returned.

Parameters:
url - the url to swap the base of
oldBaseUrl - the base url of the given url
newBaseUrl - the new base url to set on the given url
Returns:
the url with the newBaseUrl as a base

swapRpcUrlToDisplayUrl

public static String swapRpcUrlToDisplayUrl(String url,
                                            com.atlassian.applinks.api.ApplicationLink appLink)
Swap the base of the given url to be the display url of the given application link. The swap is made only when the base of the given url is the RPC url of the given application link. If no swap is made, the original url is returned. If the url is null, null is returned.

Parameters:
url - the url to swap the base of
appLink - the application link
Returns:
the url with the display url as a base


Copyright © 2002-2013 Atlassian. All Rights Reserved.