@PublicApi @InjectableComponent public interface VelocityRequestContextFactory
Provides a request context that can be used to get the 'correct' baseurl.
It will use information from the HttpRequest if one was made or applicationProperties otherwise to determine the baseurl.
Modifier and Type | Method and Description |
---|---|
void |
cacheVelocityRequestContext(VelocityRequestContext velocityRequestContext)
Deprecated.
Use
setVelocityRequestContext(VelocityRequestContext) instead. Since v5.0. |
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.
|
VelocityRequestContext getJiraVelocityRequestContext()
Map<String,Object> getDefaultVelocityParams(Map<String,Object> startingParams, JiraAuthenticationContext authenticationContext)
startingParams
- Map of parameters that may be used to override any of the parameters set here.authenticationContext
- JiraAuthenticationContextvoid cacheVelocityRequestContext(VelocityRequestContext velocityRequestContext)
setVelocityRequestContext(VelocityRequestContext)
instead. Since v5.0.velocityRequestContext
- The velocity request context to store.void clearVelocityRequestContext()
void setVelocityRequestContext(javax.servlet.http.HttpServletRequest request)
request
- The http request context to store.void setVelocityRequestContext(String baseUrl, javax.servlet.http.HttpServletRequest request)
baseUrl
- of the request.request
- The http request context to store.void setVelocityRequestContext(VelocityRequestContext velocityRequestContext)
velocityRequestContext
- The velocity request context to store.@Nullable <I,O> O runWithStaticBaseUrl(@Nullable I input, @Nonnull com.google.common.base.Function<I,O> runnable)
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.input
- input to pass to the function.runnable
- the function to execute.Copyright © 2002-2019 Atlassian. All Rights Reserved.