Package com.atlassian.jira.util.velocity
Class MockVelocityRequestContextFactory
java.lang.Object
com.atlassian.jira.util.velocity.MockVelocityRequestContextFactory
- All Implemented Interfaces:
VelocityRequestContextFactory
public class MockVelocityRequestContextFactory
extends Object
implements VelocityRequestContextFactory
-
Constructor Summary
ConstructorsConstructorDescriptionMockVelocityRequestContextFactory(String baseUrl) MockVelocityRequestContextFactory(String baseUrl, String staticBaseUrl) MockVelocityRequestContextFactory(String baseUrl, String canonicalBaseUrl, String staticBaseUrl) -
Method Summary
Modifier and TypeMethodDescriptionvoidcacheVelocityRequestContext(VelocityRequestContext velocityRequestContext) Update the thread-local storage with the given velocityRequestContext.voidResets the thread local storage as if no request has occurred, effectively nulling out the current thread local velocity request context.getDefaultVelocityParams(Map<String, Object> startingParams, JiraAuthenticationContext authenticationContext) Constructs a map with a number of common parameters used by velocity templates.Get the request context.<I,O> O runWithStaticBaseUrl(I input, com.google.common.base.Function<I, O> runnable) Run the passed function in an environment where JIRA's configuredbaseURLis always used.voidsetVelocityRequestContext(VelocityRequestContext velocityRequestContext) Update the thread-local storage with the given velocityRequestContext.voidsetVelocityRequestContext(String baseUrl, javax.servlet.http.HttpServletRequest request) Update the thread-local storage with the given request information.voidsetVelocityRequestContext(javax.servlet.http.HttpServletRequest request) Update the thread-local storage with the given request information.
-
Constructor Details
-
MockVelocityRequestContextFactory
-
MockVelocityRequestContextFactory
-
MockVelocityRequestContextFactory
-
-
Method Details
-
getJiraVelocityRequestContext
Description copied from interface:VelocityRequestContextFactoryGet the request context.- Specified by:
getJiraVelocityRequestContextin interfaceVelocityRequestContextFactory- Returns:
- The request context.
-
getDefaultVelocityParams
public Map<String,Object> getDefaultVelocityParams(Map<String, Object> startingParams, JiraAuthenticationContext authenticationContext) Description copied from interface:VelocityRequestContextFactoryConstructs a map with a number of common parameters used by velocity templates.- Specified by:
getDefaultVelocityParamsin interfaceVelocityRequestContextFactory- 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
-
cacheVelocityRequestContext
Description copied from interface:VelocityRequestContextFactoryUpdate the thread-local storage with the given velocityRequestContext.- Specified by:
cacheVelocityRequestContextin interfaceVelocityRequestContextFactory- Parameters:
velocityRequestContext- The velocity request context to store.
-
clearVelocityRequestContext
public void clearVelocityRequestContext()Description copied from interface:VelocityRequestContextFactoryResets the thread local storage as if no request has occurred, effectively nulling out the current thread local velocity request context.- Specified by:
clearVelocityRequestContextin interfaceVelocityRequestContextFactory
-
setVelocityRequestContext
public void setVelocityRequestContext(javax.servlet.http.HttpServletRequest request) Description copied from interface:VelocityRequestContextFactoryUpdate the thread-local storage with the given request information.- Specified by:
setVelocityRequestContextin interfaceVelocityRequestContextFactory- Parameters:
request- The http request context to store.
-
setVelocityRequestContext
public void setVelocityRequestContext(String baseUrl, javax.servlet.http.HttpServletRequest request) Description copied from interface:VelocityRequestContextFactoryUpdate the thread-local storage with the given request information.- Specified by:
setVelocityRequestContextin interfaceVelocityRequestContextFactory- Parameters:
baseUrl- of the request.request- The http request context to store.
-
setVelocityRequestContext
Description copied from interface:VelocityRequestContextFactoryUpdate the thread-local storage with the given velocityRequestContext.- Specified by:
setVelocityRequestContextin interfaceVelocityRequestContextFactory- Parameters:
velocityRequestContext- The velocity request context to store.
-
runWithStaticBaseUrl
@Nullable public <I,O> O runWithStaticBaseUrl(@Nullable I input, @Nonnull com.google.common.base.Function<I, O> runnable) Description copied from interface:VelocityRequestContextFactoryRun the passed function in an environment where JIRA's configuredbaseURLis always used. This basically makes the passed function ignore any smartbaseURLthat can be generated from the request associated with the calling thread.- Specified by:
runWithStaticBaseUrlin interfaceVelocityRequestContextFactory- Parameters:
input- input to pass to the function.runnable- the function to execute.- Returns:
- the result of the function.
-