Packages

abstract class RequestVar[T] extends util.AnyVar[T, RequestVar[T]] with HasLogUnreadVal

A typesafe container for data with a lifetime nominally equivalent to the lifetime of a page rendered by an HTTP request. RequestVars maintain their value throughout the duration of the current HTTP request and any callbacks for servicing AJAX calls associated with the rendered page. RequestVar instances have no value at the beginning of request servicing (excluding AJAX callbacks) and their value is discarded at the end of request processing. They are commonly used to share values across many snippets. Basic usage:

object MySnippetCompanion { object myRequestVar extends RequestVar[String]("hello") }

The standard pattern is to create a singleton object extending RequestVar instead of creating an instance variable of a concrete RequestVar subclass. This is preferred because RequestVar will use the name of its instantiating class for part of its state maintenance mechanism.

If you find it necessary to create a RequestVar subclass of which there may be more than one instance, it is necessary to override the nameSalt() method to return a unique salt value for each instance to prevent name collisions.

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RequestVar
  2. HasLogUnreadVal
  3. AnyVar
  4. AnyVarTrait
  5. HasCalcDefaultValue
  6. PSettableValueHolder
  7. SettableValueHolder
  8. Settable
  9. PValueHolder
  10. ValueHolder
  11. AnyRef
  12. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new RequestVar(dflt: ⇒ T)

    dflt

    - the default value to be returned if none was set prior to requesting a value to be returned from the container

Type Members

  1. type CleanUpParam = Box[LiftSession]
    Definition Classes
    RequestVarAnyVarTrait
  2. type FuncType = (Box[T], Boolean) ⇒ Unit

    The function takes a Box[T] (Full if the Var is being set, Empty if it's being cleared) and a Boolean indicating that the set function is setting to the default value.

    The function takes a Box[T] (Full if the Var is being set, Empty if it's being cleared) and a Boolean indicating that the set function is setting to the default value.

    Definition Classes
    AnyVarTrait
  3. type ValueType = T
    Definition Classes
    PValueHolderValueHolder

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def __nameSalt: String
    Attributes
    protected
    Definition Classes
    AnyVarTrait
  5. def apply(what: T): T

    Set the session variable

    Set the session variable

    what

    -- the value to set the session variable to

    Definition Classes
    AnyVarTrait
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def atomicUpdate(f: (ValueType) ⇒ ValueType): ValueType

    Perform an atomic update of this Settable.

    Perform an atomic update of this Settable. The current value is passed to the function and the ValueHolder is set to the result of the function. This is enclosed in the performAtomicOperation method which will, by default, synchronize this instance

    Definition Classes
    Settable
  8. def calcDefaultValue: T
    Attributes
    protected
    Definition Classes
    AnyVarAnyVarTraitHasCalcDefaultValue
  9. def clearFunc(name: String): Unit
    Attributes
    protected
    Definition Classes
    RequestVarAnyVarTrait
  10. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. def doSync[F](f: ⇒ F): F

    Different Vars require different mechanisms for synchronization.

    Different Vars require different mechanisms for synchronization. This method implements the Var specific synchronization mechanism

    Definition Classes
    RequestVarAnyVarTrait
  12. def doWith[F](newVal: T)(f: ⇒ F): F

    Change the value of the Var for the lifespan of the function

    Change the value of the Var for the lifespan of the function

    Definition Classes
    AnyVarTrait
  13. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  15. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. def findFunc(name: String): Box[T]
    Attributes
    protected
    Definition Classes
    RequestVarAnyVarTrait
  17. final def generateSnapshotRestorer[T](): (() ⇒ T) ⇒ T

    Generate a function that will take a snapshot of the current RequestVars such that they can be restored

  18. def get: T

    Shadow of the 'is' method

    Shadow of the 'is' method

    Definition Classes
    AnyVarTraitValueHolder
  19. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  20. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  21. def is: T

    The current value of the variable

    The current value of the variable

    Definition Classes
    AnyVarTrait
  22. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  23. def logUnreadVal: Boolean

    This defines whether or not Lift will log when a RequestVar is set but then not read within the same request cycle.

    This defines whether or not Lift will log when a RequestVar is set but then not read within the same request cycle. Change this to false to turn off logging. Logging can also be turned off globally via LiftRules.logUnreadRequestVars.

    Definition Classes
    RequestVar → HasLogUnreadVal
    See also

    LiftRules#logUnreadRequestVars

  24. lazy val name: String
    Attributes
    protected
    Definition Classes
    AnyVarTrait
  25. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  26. final def notify(): Unit
    Definition Classes
    AnyRef
  27. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  28. def onChange(f: FuncType): Unit

    On any change to this Var, invoke the function.

    On any change to this Var, invoke the function. Changes are setting the value, clearing the value. There may not be a call if the Var goes out of scope (e.g., a RequestVar at the end of the Request).

    The function takes a Box[T] (Full if the Var is being set, Empty if it's being cleared) and a Boolean indicating that the set function is setting to the default value.

    The function should execute *very* quickly (e.g., Schedule a function to be executed on a different thread).

    The function should generally be set in Boot or when a singleton is created.

    f

    the function to execute on change

    Definition Classes
    AnyVarTrait
  29. def onShutdown(session: CleanUpParam): Unit
    Attributes
    protected
    Definition Classes
    AnyVarTrait
  30. def performAtomicOperation[T](f: ⇒ T): T

    Perform an atomic operation on the Settable.

    Perform an atomic operation on the Settable. By default synchronizes the instance, but it could use other mechanisms

    Definition Classes
    Settable
  31. def registerCleanupFunc(in: (Box[LiftSession]) ⇒ Unit): Unit
    Attributes
    protected
    Definition Classes
    RequestVarAnyVarTrait
  32. final def registerGlobalCleanupFunc(in: (CleanUpParam) ⇒ Unit): Unit
    Attributes
    protected
    Definition Classes
    AnyVarTrait
  33. def remove(): Unit
    Definition Classes
    AnyVarTrait
  34. def set(what: T): T

    Shadow of the apply method

    Shadow of the apply method

    Definition Classes
    AnyVarTraitSettable
  35. def setFunc(name: String, value: T): Unit
    Attributes
    protected
    Definition Classes
    RequestVarAnyVarTrait
  36. def setIfUnset(value: ⇒ T): T

    Set the Var if it has not been calculated

    Set the Var if it has not been calculated

    Definition Classes
    AnyVarTrait
  37. def set_?: Boolean

    Has this Var been set or accessed and had its default value calculated

    Has this Var been set or accessed and had its default value calculated

    Definition Classes
    AnyVarTrait
  38. def settingDefault_?: Boolean
    Attributes
    protected
    Definition Classes
    AnyVarTrait
  39. def snapshot(): () ⇒ Unit

    Return a function that, when applied, will set the value of the RequestVar to its current value

  40. def snapshotGroup: Box[RequestVarSnapshotGroup]

    Is this RequestVar a member of a snapshot group? If so, specify the group here

  41. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  42. def testWasSet(name: String, bn: String): Boolean

    A non-side-effecting test if the value was initialized

    A non-side-effecting test if the value was initialized

    Attributes
    protected
    Definition Classes
    RequestVarAnyVarTrait
  43. def toString(): String
    Definition Classes
    AnyVarTrait → AnyRef → Any
  44. def update(f: (T) ⇒ T): T

    Applies the given function to the contents of this variable and sets the variable to the resulting value.

    Applies the given function to the contents of this variable and sets the variable to the resulting value.

    f

    -- the function to apply and set the result from.

    Definition Classes
    AnyVarTrait
  45. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  46. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  47. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. def wasInitialized(name: String, bn: String): Boolean
    Attributes
    protected
    Definition Classes
    RequestVarAnyVarTrait

Inherited from HasLogUnreadVal

Inherited from util.AnyVar[T, RequestVar[T]]

Inherited from AnyVarTrait[T, RequestVar[T]]

Inherited from HasCalcDefaultValue[T]

Inherited from PSettableValueHolder[T]

Inherited from SettableValueHolder

Inherited from Settable

Inherited from PValueHolder[T]

Inherited from ValueHolder

Inherited from AnyRef

Inherited from Any

Ungrouped