Package com.atlassian.bamboo.util
Class RequestCacheThreadLocal
- java.lang.Object
-
- com.atlassian.bamboo.util.RequestCacheThreadLocal
-
public class RequestCacheThreadLocal extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONTEXT_PATH_KEY
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
canRequestMutateState()
static void
clearRequestCache()
This method should only be called from the RequestCacheThreadLocalFilterstatic @Nullable String
getContextPath()
static @NotNull javax.servlet.http.HttpServletRequest
getNonNullRequest()
static @NotNull javax.servlet.http.HttpServletResponse
getNonNullResponse()
static @Nullable javax.servlet.http.HttpServletRequest
getRequest()
static @NotNull Map<String,Object>
getRequestCache()
static @Nullable javax.servlet.http.HttpServletResponse
getResponse()
static void
setRequestCache(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse)
Initialise the threadlocal request cache.static void
update(@NotNull javax.servlet.http.HttpServletRequest request)
-
-
-
Field Detail
-
CONTEXT_PATH_KEY
public static final String CONTEXT_PATH_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
setRequestCache
public static void setRequestCache(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse)
Initialise the threadlocal request cache.- Throws:
IllegalArgumentException
- in case XSS is suspected in the request
-
clearRequestCache
public static void clearRequestCache()
This method should only be called from the RequestCacheThreadLocalFilter
-
getContextPath
@Nullable public static @Nullable String getContextPath()
-
getRequest
@Nullable public static @Nullable javax.servlet.http.HttpServletRequest getRequest()
-
getResponse
@Nullable public static @Nullable javax.servlet.http.HttpServletResponse getResponse()
-
canRequestMutateState
public static boolean canRequestMutateState()
- Returns:
- true iff we are in a request context and the request is allowed to mutate state
-
update
public static void update(@NotNull @NotNull javax.servlet.http.HttpServletRequest request)
- Throws:
IllegalArgumentException
- in case XSS is suspected in the request
-
getNonNullRequest
@NotNull public static @NotNull javax.servlet.http.HttpServletRequest getNonNullRequest()
-
getNonNullResponse
@NotNull public static @NotNull javax.servlet.http.HttpServletResponse getNonNullResponse()
- Returns:
- current
HttpServletResponse
. ThrowsIllegalStateException
if called outside of HTTP request context
-
-