@Immutable public class HttpRequestLocal<T> extends Object
ThreadLocal
, but request-scoped).Constructor and Description |
---|
HttpRequestLocal(String name)
Creates a new HttpRequestLocal, specifying the name to use.
|
Modifier and Type | Method and Description |
---|---|
T |
get()
Returns the value of this HttpRequestLocal, or null if it is not set.
|
protected T |
initialValue()
Returns the current request's "initial value" for this request-local variable.
|
void |
remove()
Removes the value of this HttpRequestLocal.
|
void |
set(T value)
Sets the value of this HttpRequestLocal.
|
public HttpRequestLocal(String name)
name
- a String containing the attribute name to use in the servlet requestpublic T get()
initialValue()
would have returned.public void set(T value)
value
- the value to setpublic void remove()
protected T initialValue()
get()
method is called in a request.
This implementation simply returns null. Override this method for different initial values.
Copyright © 2002-2021 Atlassian. All Rights Reserved.