@Immutable public class

HttpRequestLocal

extends Object
java.lang.Object
   ↳ com.atlassian.jira.web.HttpRequestLocal<T>

Class Overview

Per-request variable (similar to ThreadLocal, but request-scoped).

Summary

Public Constructors
HttpRequestLocal(String name)
Creates a new HttpRequestLocal, specifying the name to use.
Public Methods
T get()
Returns the value of this HttpRequestLocal, or null if it is not set.
void remove()
Removes the value of this HttpRequestLocal.
void set(T value)
Sets the value of this HttpRequestLocal.
Protected Methods
T initialValue()
Returns the current request's "initial value" for this request-local variable.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public HttpRequestLocal (String name)

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

Public Methods

public T 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 what initialValue() would have returned.

Returns
  • the value of this HttpRequestLocal, or null

public void remove ()

Removes the value of this HttpRequestLocal.

public void set (T value)

Sets the value of this HttpRequestLocal.

Parameters
value the value to set

Protected Methods

protected T 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's get() 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