Package com.atlassian.jira.web
Class HttpRequestLocal<T>
java.lang.Object
com.atlassian.jira.web.HttpRequestLocal<T>
Per-request variable (similar to
ThreadLocal, but request-scoped).- Since:
- v4.4
-
Constructor Summary
ConstructorsConstructorDescriptionHttpRequestLocal(String name) Creates a new HttpRequestLocal, specifying the name to use. -
Method Summary
Modifier and TypeMethodDescriptionget()Returns the value of this HttpRequestLocal, or null if it is not set.protected TReturns the current request's "initial value" for this request-local variable.voidremove()Removes the value of this HttpRequestLocal.voidSets the value of this HttpRequestLocal.
-
Constructor Details
-
HttpRequestLocal
Creates a new HttpRequestLocal, specifying the name to use. This name is used as the attribute name under which this request local is stored in the servlet request.- Parameters:
name- a String containing the attribute name to use in the servlet request
-
-
Method Details
-
get
Returns the value of this HttpRequestLocal, or null if it is not set. If there is no current HTTP request, this method returns null regardless of whatinitialValue()would have returned.- Returns:
- the value of this HttpRequestLocal, or null
-
set
Sets the value of this HttpRequestLocal.- Parameters:
value- the value to set
-
remove
public void remove()Removes the value of this HttpRequestLocal. -
initialValue
Returns the current request's "initial value" for this request-local variable. This method will be invoked the first time that this request local variable'sget()method is called in a request.This implementation simply returns null. Override this method for different initial values.
- Returns:
- the initial value for this request local
-