abstract class RequestVar[T] extends 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.
- Alphabetic
- By Inheritance
- RequestVar
- HasLogUnreadVal
- AnyVar
- AnyVarTrait
- HasCalcDefaultValue
- PSettableValueHolder
- SettableValueHolder
- Settable
- PValueHolder
- ValueHolder
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- 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
- type CleanUpParam = Box[LiftSession]
- Definition Classes
- RequestVar → AnyVarTrait
- type FuncType = (Box[T], Boolean) => Unit
- Definition Classes
- AnyVarTrait
- type ValueType = T
- Definition Classes
- PValueHolder → ValueHolder
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def __nameSalt: String
- Attributes
- protected
- Definition Classes
- AnyVarTrait
- def apply(what: T): T
- Definition Classes
- AnyVarTrait
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def atomicUpdate(f: (ValueType) => ValueType): ValueType
- Definition Classes
- Settable
- def calcDefaultValue: T
- Attributes
- protected
- Definition Classes
- AnyVar → AnyVarTrait → HasCalcDefaultValue
- def clearFunc(name: String): Unit
- Attributes
- protected
- Definition Classes
- RequestVar → AnyVarTrait
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- 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
- RequestVar → AnyVarTrait
- def doWith[F](newVal: T)(f: => F): F
- Definition Classes
- AnyVarTrait
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def findFunc(name: String): Box[T]
- Attributes
- protected
- Definition Classes
- RequestVar → AnyVarTrait
- final def generateSnapshotRestorer[T](): (() => T) => T
Generate a function that will take a snapshot of the current RequestVars such that they can be restored
- def get: T
- Definition Classes
- AnyVarTrait → ValueHolder
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def is: T
- Definition Classes
- AnyVarTrait
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- 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
- lazy val name: String
- Attributes
- protected
- Definition Classes
- AnyVarTrait
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def onChange(f: FuncType): Unit
- Definition Classes
- AnyVarTrait
- def onShutdown(session: CleanUpParam): Unit
- Attributes
- protected
- Definition Classes
- AnyVarTrait
- def performAtomicOperation[T](f: => T): T
- Definition Classes
- Settable
- def registerCleanupFunc(in: (Box[LiftSession]) => Unit): Unit
- Attributes
- protected
- Definition Classes
- RequestVar → AnyVarTrait
- final def registerGlobalCleanupFunc(in: (CleanUpParam) => Unit): Unit
- Attributes
- protected
- Definition Classes
- AnyVarTrait
- def remove(): Unit
- Definition Classes
- AnyVarTrait
- def set(what: T): T
- Definition Classes
- AnyVarTrait → Settable
- def setFunc(name: String, value: T): Unit
- Attributes
- protected
- Definition Classes
- RequestVar → AnyVarTrait
- def setIfUnset(value: => T): T
- Definition Classes
- AnyVarTrait
- def set_?: Boolean
- Definition Classes
- AnyVarTrait
- def settingDefault_?: Boolean
- Attributes
- protected
- Definition Classes
- AnyVarTrait
- def snapshot(): () => Unit
Return a function that, when applied, will set the value of the RequestVar to its current value
- def snapshotGroup: Box[RequestVarSnapshotGroup]
Is this RequestVar a member of a snapshot group? If so, specify the group here
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def testWasSet(name: String, bn: String): Boolean
- Attributes
- protected
- Definition Classes
- RequestVar → AnyVarTrait
- def toString(): String
- Definition Classes
- AnyVarTrait → AnyRef → Any
- def update(f: (T) => T): T
- Definition Classes
- AnyVarTrait
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def wasInitialized(name: String, bn: String): Boolean
- Attributes
- protected
- Definition Classes
- RequestVar → AnyVarTrait