public class MockVelocityRequestContextFactory extends Object implements VelocityRequestContextFactory
Constructor and Description |
---|
MockVelocityRequestContextFactory(String baseUrl) |
MockVelocityRequestContextFactory(String baseUrl,
String staticBaseUrl) |
Modifier and Type | Method and Description |
---|---|
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<String,Object> |
getDefaultVelocityParams(Map<String,Object> startingParams,
JiraAuthenticationContext authenticationContext)
Constructs a map with a number of common parameters used by velocity templates.
|
VelocityRequestContext |
getJiraVelocityRequestContext()
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 configured
baseURL is always used. |
void |
setVelocityRequestContext(javax.servlet.http.HttpServletRequest request)
Update the thread-local storage with the given request information.
|
void |
setVelocityRequestContext(String baseUrl,
javax.servlet.http.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.
|
public MockVelocityRequestContextFactory(String baseUrl)
public VelocityRequestContext getJiraVelocityRequestContext()
VelocityRequestContextFactory
getJiraVelocityRequestContext
in interface VelocityRequestContextFactory
public Map<String,Object> getDefaultVelocityParams(Map<String,Object> startingParams, JiraAuthenticationContext authenticationContext)
VelocityRequestContextFactory
getDefaultVelocityParams
in interface VelocityRequestContextFactory
startingParams
- Map of parameters that may be used to override any of the parameters set here.authenticationContext
- JiraAuthenticationContextpublic void cacheVelocityRequestContext(VelocityRequestContext velocityRequestContext)
VelocityRequestContextFactory
cacheVelocityRequestContext
in interface VelocityRequestContextFactory
velocityRequestContext
- The velocity request context to store.public void clearVelocityRequestContext()
VelocityRequestContextFactory
clearVelocityRequestContext
in interface VelocityRequestContextFactory
public void setVelocityRequestContext(javax.servlet.http.HttpServletRequest request)
VelocityRequestContextFactory
setVelocityRequestContext
in interface VelocityRequestContextFactory
request
- The http request context to store.public void setVelocityRequestContext(String baseUrl, javax.servlet.http.HttpServletRequest request)
VelocityRequestContextFactory
setVelocityRequestContext
in interface VelocityRequestContextFactory
baseUrl
- of the request.request
- The http request context to store.public void setVelocityRequestContext(VelocityRequestContext velocityRequestContext)
VelocityRequestContextFactory
setVelocityRequestContext
in interface VelocityRequestContextFactory
velocityRequestContext
- The velocity request context to store.@Nullable public <I,O> O runWithStaticBaseUrl(@Nullable I input, @Nonnull com.google.common.base.Function<I,O> runnable)
VelocityRequestContextFactory
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.runWithStaticBaseUrl
in interface VelocityRequestContextFactory
input
- input to pass to the function.runnable
- the function to execute.Copyright © 2002-2017 Atlassian. All Rights Reserved.