com.atlassian.jira.util
Class DefaultBaseUrl

java.lang.Object
  extended by com.atlassian.jira.util.DefaultBaseUrl
All Implemented Interfaces:
BaseUrl

public class DefaultBaseUrl
extends Object
implements BaseUrl

Since:
v5.2

Constructor Summary
DefaultBaseUrl(VelocityRequestContextFactory factory)
           
 
Method Summary
 String getBaseUrl()
           
 String getCanonicalBaseUrl()
           
<I,O> O
runWithStaticBaseUrl(I input, com.google.common.base.Function<I,O> runnable)
          Run the passed function in an environment where JIRA's configured baseURL is always used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultBaseUrl

public DefaultBaseUrl(VelocityRequestContextFactory factory)
Method Detail

getBaseUrl

@Nonnull
public String getBaseUrl()
Specified by:
getBaseUrl in interface BaseUrl
Returns:
The base URL for this instance, also known as the context path. If running in the context of a web request, this will return a url relative to the server root (ie "/jira/"). If running via email, it will return an absolute URL (eg. "http://example.com/jira/").

getCanonicalBaseUrl

@Nonnull
public String getCanonicalBaseUrl()
Specified by:
getCanonicalBaseUrl in interface BaseUrl
Returns:
The canonical base URL for this instance. It will return an absolute URL (eg. "http://example.com/jira/").

runWithStaticBaseUrl

@Nullable
public <I,O> O runWithStaticBaseUrl(@Nullable
                                             I input,
                                             @Nonnull
                                             com.google.common.base.Function<I,O> runnable)
Description copied from interface: BaseUrl
Run the passed function in an environment where JIRA's configured baseURL is always used. This basically makes the passed function ignore any smart baseURL that can be generated from the request associated with the calling thread.

Specified by:
runWithStaticBaseUrl in interface BaseUrl
Parameters:
input - input to pass to the function.
runnable - the function to execute.
Returns:
the result of the function.


Copyright © 2002-2014 Atlassian. All Rights Reserved.