public class

MockVelocityRequestContextFactory

extends Object
implements VelocityRequestContextFactory
java.lang.Object
   ↳ com.atlassian.jira.util.velocity.MockVelocityRequestContextFactory

Summary

Public Constructors
MockVelocityRequestContextFactory(String baseUrl)
MockVelocityRequestContextFactory(String baseUrl, String staticBaseUrl)
Public Methods
void cacheVelocityRequestContext(VelocityRequestContext velocityRequestContext)
Update the thread-local storage with the given velocityRequestContext.
void clearVelocityRequestContext()
Resets the thread local storage as if no request has occurred, effectively nulling out the current thread local velocity request context.
Map<StringObject> getDefaultVelocityParams(Map<StringObject> startingParams, JiraAuthenticationContext authenticationContext)
Constructs a map with a number of common parameters used by velocity templates.
VelocityRequestContext getJiraVelocityRequestContext()
Get the request context.
@Nullable <I, O> O runWithStaticBaseUrl(I input, Function<I, O> runnable)
Run the passed function in an environment where JIRA's configured baseURL is always used.
void setVelocityRequestContext(HttpServletRequest request)
Update the thread-local storage with the given request information.
void setVelocityRequestContext(VelocityRequestContext velocityRequestContext)
Update the thread-local storage with the given velocityRequestContext.
void setVelocityRequestContext(String baseUrl, HttpServletRequest request)
Update the thread-local storage with the given request information.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.util.velocity.VelocityRequestContextFactory

Public Constructors

public MockVelocityRequestContextFactory (String baseUrl)

public MockVelocityRequestContextFactory (String baseUrl, String staticBaseUrl)

Public Methods

public void cacheVelocityRequestContext (VelocityRequestContext velocityRequestContext)

Update the thread-local storage with the given velocityRequestContext.

Parameters
velocityRequestContext The velocity request context to store.

public void clearVelocityRequestContext ()

Resets the thread local storage as if no request has occurred, effectively nulling out the current thread local velocity request context.

public Map<StringObject> getDefaultVelocityParams (Map<StringObject> startingParams, JiraAuthenticationContext authenticationContext)

Constructs a map with a number of common parameters used by velocity templates.

Parameters
startingParams Map of parameters that may be used to override any of the parameters set here.
authenticationContext JiraAuthenticationContext
Returns
  • a Map with common velocity parameters

public VelocityRequestContext getJiraVelocityRequestContext ()

Get the request context.

Returns
  • The request context.

@Nullable public O runWithStaticBaseUrl (I input, Function<I, O> runnable)

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.

Parameters
input input to pass to the function.
runnable the function to execute.
Returns
  • the result of the function.

public void setVelocityRequestContext (HttpServletRequest request)

Update the thread-local storage with the given request information.

Parameters
request The http request context to store.

public void setVelocityRequestContext (VelocityRequestContext velocityRequestContext)

Update the thread-local storage with the given velocityRequestContext.

Parameters
velocityRequestContext The velocity request context to store.

public void setVelocityRequestContext (String baseUrl, HttpServletRequest request)

Update the thread-local storage with the given request information.

Parameters
baseUrl of the request.
request The http request context to store.