class LiftSession extends LiftMerge with Loggable with HowStateful
The LiftSession class containing the session state information
- Alphabetic
- By Inheritance
- LiftSession
- HowStateful
- Loggable
- LiftMerge
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new LiftSession(_contextPath: String, underlyingId: String, httpSession: Box[HTTPSession])
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
addPostPageJavaScript(func: () ⇒ JsCmd): Unit
Associate a function that renders JavaScript with the current page.
Associate a function that renders JavaScript with the current page. This function will be run and the resulting JavaScript will be appended to any rendering associated with this page... the normal page render, Ajax calls, and even Comet calls for this page.
- func
-- the function that returns JavaScript to be appended to responses associated with this page
-
def
addSessionCleanup(f: (LiftSession) ⇒ Unit): Unit
Adds a cleanup function that will be executed when session is terminated
-
def
allowContainerState_?: Boolean
There may be cases when you are allowed container state (e.g., migratory session, but you're not allowed to write Lift non-migratory state, return true here.
There may be cases when you are allowed container state (e.g., migratory session, but you're not allowed to write Lift non-migratory state, return true here.
- Definition Classes
- HowStateful
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
buildAndStoreComet[T <: LiftCometActor](newCometFn: (CometCreationInfo) ⇒ Box[T])(creationInfo: CometCreationInfo): Box[T]
Need to add your own CometActor to a Session/Page? You might 'cause creating a CometActor programmatically within a snippet may be between that referring to a CometActor by class name.
Need to add your own CometActor to a Session/Page? You might 'cause creating a CometActor programmatically within a snippet may be between that referring to a CometActor by class name.
This is dangerous stuff, so use with caution.
- T
A LiftCometActor or better
- newCometFn
a Function that takes
CometCreateInfo
and returns a CometActor instance- creationInfo
the info to send to the above function
- returns
The created, registered, etc. CometActor
-
def
buildDeferredFunction[A, T](deferredFunction: (A) ⇒ T): (A) ⇒ T
Overload of
buildDeferredFunction
for functions that take a parameter.Overload of
buildDeferredFunction
for functions that take a parameter.The returned function, when invoked with a parameter of type
A
, will invoke the passeddeferredFunction
with that parameter in the original request and session context. -
def
buildDeferredFunction[T](deferredFunction: () ⇒ T): () ⇒ T
During the HTTP request/response cycle or in a CometActor, Lift populates "S" with information about the current session, the current request, etc.
During the HTTP request/response cycle or in a CometActor, Lift populates "S" with information about the current session, the current request, etc. This method allows you to wrap a function in another function that will snapshot current state (request vars, Req, Loc, etc.) such that when the returned function is executed, it will be executed as if it had been executed in the scope of the thread where it was create. This allows you to farm work out to separate threads, but make it look to those threads as if the scope was the same as if it had been executed on the thread that created the function.
-
def
buildRoundtrip(info: Seq[RoundTripInfo]): JsExp
Build a bunch of round-trip calls between the client and the server.
Build a bunch of round-trip calls between the client and the server. The client calls the server with a parameter and the parameter gets marshalled to the server and the code is executed on the server. The result can be an item (JValue) or a Stream of Items.
If the The // HERE
- def buildXformer(xformRule: String, field: List[String]): (NodeSeq) ⇒ NodeSeq
- def cleanupUnseenFuncs(): Unit
-
def
clearPostPageJavaScriptForThisPage(): Unit
Clear the PostPage JavaScript functions for the current page.
Clear the PostPage JavaScript functions for the current page. This is used by CometActor to remove the PostPage JavaScript functions from the given component during redraw.
-
def
clientActorFor(in: LiftActor, xlate: (JValue) ⇒ Box[Any]): JsExp
Pass in a LiftActor and get a JavaScript expression (function(x) {...}) that represents an asynchronous Actor message from the client to the server.
Pass in a LiftActor and get a JavaScript expression (function(x) {...}) that represents an asynchronous Actor message from the client to the server.
The Actor should respond to a message in the form of a JsonAST.JValue.
This method requires the session be stateful
In general, your Actor should be a subclass of ScopedLiftActor because that way you'll have the scope of the current session.
- in
the Actor to send messages to.
- xlate
a function that will take the JsonAST.JValue and convert it into a representation that can be sent to the Actor (probably deserialize it into a case class.) If the translation succeeds, the translated message will be sent to the actor. If the translation fails, an error will be logged and the raw JsonAST.JValue will be sent to the actor
- returns
a JsExp that contains a function that can be called with a parameter and when the function is called, the parameter is JSON serialized and sent to the server
-
def
clientActorFor(in: LiftActor): JsExp
Pass in a LiftActor and get a JavaScript expression (function(x) {...}) that represents an asynchronous Actor message from the client to the server.
Pass in a LiftActor and get a JavaScript expression (function(x) {...}) that represents an asynchronous Actor message from the client to the server.
The Actor should respond to a message in the form of a JsonAST.JValue.
This method requires the session be stateful
In general, your Actor should be a subclass of ScopedLiftActor because that way you'll have the scope of the current session.
- in
the Actor to send messages to.
- returns
a JsExp that contains a function that can be called with a parameter and when the function is called, the parameter is JSON serialized and sent to the server
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
- def cometForHost(hostAndPath: String): (Vector[(LiftActor, Req)], Vector[(LiftActor, Req)])
-
def
contextPath: String
Define the context path for this session.
Define the context path for this session. This allows different sessions to have different context paths.
-
def
destroySession(): Unit
Destroy this session and the underlying container session.
-
def
destroySessionAndContinueInNewSession(continuation: () ⇒ Nothing): Nothing
Destroy the current session, then create a new session and continue the execution of the code.
Destroy the current session, then create a new session and continue the execution of the code. The continuation function must return Nothing (it must throw an exception... this is typically done by calling S.redirectTo(...)). This method is useful for changing sessions on login. Issue #727.
-
def
doAsStateless[A](f: ⇒ A): A
Within the scope of the call, this session is forced into statelessness.
Within the scope of the call, this session is forced into statelessness. This allows for certain URLs in on the site to be stateless and not generate a session, but if a valid session is presented, they have the scope of that session/User
- Definition Classes
- HowStateful
- def doCometActorCleanup(): Unit
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def executeInScope[T](req: Box[Req], renderVersion: String)(f: ⇒ T): T
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
findAndProcessTemplate(name: List[String]): Box[Elem]
Finds a template named name and then runs it throught the Lift processing engine
-
def
findComet(theType: String, name: Box[String]): Box[LiftCometActor]
Find the comet actor by type and name
-
def
findComet(theType: String): List[LiftCometActor]
Finds all Comet actors by type
- def findField(name: List[String], cur: Any): Any
-
def
findFunc(funcName: String): Option[AFuncHolder]
Find a function in the function lookup table.
Find a function in the function lookup table. You probably never need to do this, but well, you can look them up.
- def fixSessionTime(): Unit
-
def
getAsyncComponent(id: String): Box[LiftCometActor]
Finds a Comet actor by ID
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- val httpSession: Box[HTTPSession]
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
var
liftTagProcessing: List[LiftTagPF]
The partial function that defines how lift tags are processed for this session.
The partial function that defines how lift tags are processed for this session. Initially composed of LiftRules.liftTagProcessing orElse the default lift tag processing. If you need to change the way a particular session handles lift tags, alter this partial function.
-
val
logger: Logger
- Attributes
- protected
- Definition Classes
- Loggable
- Annotations
- @transient()
-
def
merge(xhtml: NodeSeq, req: Req): Node
Manages the merge phase of the rendering pipeline
Manages the merge phase of the rendering pipeline
- Definition Classes
- LiftMerge
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
normalizeHtml(in: NodeSeq): NodeSeq
Apply HTML specific corrections such as adding the context path etc.
Apply HTML specific corrections such as adding the context path etc.
In general, you should heavily consider using
normalizeHtmlAndEventHandlers
or its friendliest sibling,normalizeHtmlAndAppendEventHandlers
. -
def
normalizeHtmlAndAppendEventHandlers(in: NodeSeq): NodeSeq
Runs
normalizeHtmlAndEventHandlers
to adjust URLs to context paths and extract JS event handlers from the givenNodeSeq
and pull them into a separate JsCmd, then usesS.appendJs
to append that JS to the response's JavaScript (the page-specific JS file if we are rendering a page, or the end of the returned JS if this is an AJAX or comet request). -
def
normalizeHtmlAndEventHandlers(nodes: NodeSeq, forceExtractInlineJavaScript: Option[Boolean] = None): NodesAndEventJs
Applies various HTML corrections to the passed HTML, including adding the context path to links and extracting event handlers into a separate
JsCmd
.Applies various HTML corrections to the passed HTML, including adding the context path to links and extracting event handlers into a separate
JsCmd
.Note that most of the time you can just call
normalizeHtmlAndAppendEventHandlers
and not worry about the extraJsCmd
, as Lift will automatically append it to the response.- forceExtractInlineJavaScript
If
None
, usesLiftRules.extractInlineJavaScript
to decide whether or not to extract inline JS from the passed nodes. IfSome
, extracts (Some(true)
) or doesn't (Some(false)
).
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
performHeadMerge(in: NodeSeq, req: Req): Node
Merge all the head elements into the main head element and move tail stuff to the end of the page.
-
def
postPageJavaScript(): List[JsCmd]
Get the JavaScript to execute as part of the current page
-
def
postPageJavaScript(pageIds: Seq[String]): List[JsCmd]
Get the post-page JavaScript functions for a sequence of page IDs.
Get the post-page JavaScript functions for a sequence of page IDs. This is used by the CometActor to get the post-page JavaScript functions for the comet actor and for the page the the comet actor is associated with
- def postPageJavaScript(rv: String): List[JsCmd]
-
def
processSurroundAndInclude(page: String, in: NodeSeq): NodeSeq
Processes the surround tag and other lift tags
Processes the surround tag and other lift tags
- page
the name of the page currently being processed
- in
the DOM to process
-
def
processTemplate(template: Box[NodeSeq], request: Req, path: ParsePath, code: Int): Box[LiftResponse]
Convert a template into a Lift Response.
Convert a template into a Lift Response.
- template
-- the NodeSeq that makes up the page... or the template will be located via findVisibleTemplate
- request
-- the Req the led to this rendering
- path
-- the ParsePath that led to this page
- code
-- the HTTP response code (usually 200)
- returns
a Box of LiftResponse with all the proper page rewriting
-
var
progressListener: Box[(Long, Long, Int) ⇒ Unit]
Set your session-specific progress listener for mime uploads pBytesRead - The total number of bytes, which have been read so far.
Set your session-specific progress listener for mime uploads pBytesRead - The total number of bytes, which have been read so far. pContentLength - The total number of bytes, which are being read. May be -1, if this number is unknown. pItems - The number of the field, which is currently being read. (0 = no item so far, 1 = first item is being read, ...)
-
def
queueCometMessage(cometType: String, cometName: Box[String], msg: Any): Unit
Queue a message for a comet that is not started yet.
-
def
queueCometMessage(cometType: String, msg: Any): Unit
Queue a message for a comet that is not started yet.
-
def
removeFunction(name: String): AFuncHolder
Removes the function with the given
name
.Removes the function with the given
name
. Note that this will not triggerLiftSession$.onFunctionOwnersRemoved
listeners. - val requestHtmlProperties: TransientRequestVar[HtmlProperties]
-
def
runParams(state: Req): List[Any]
Executes the user's functions based on the query parameters
- def runSourceContext(value: Any, xform: (NodeSeq) ⇒ NodeSeq, ns: NodeSeq): NodeSeq
-
def
runTemplate(pageName: String, template: NodeSeq): NodeSeq
A nicely named proxy for processSurroundAndInclude.
A nicely named proxy for processSurroundAndInclude. This method processes a Lift template
- pageName
-- the name of the page being processed (for error reporting)
- template
-- the template to process using Lift's templating engine
- def running_?: Boolean
-
def
sendCometMessage[T](name: Box[String], msg: Any)(implicit cometManifest: Manifest[T]): Unit
Similar behavior to the main sendCometMessage, except that this version will limit based on the name of the comet and it takes its type selector as a type parameter.
Similar behavior to the main sendCometMessage, except that this version will limit based on the name of the comet and it takes its type selector as a type parameter.
- name
the optional name of the CometActor
- msg
the message to send to the CometActor
-
def
sendCometMessage(theType: String, name: Box[String], msg: Any): Unit
Similar behavior to the main sendCometMessage, except that this version will limit based on the name of the comet.
Similar behavior to the main sendCometMessage, except that this version will limit based on the name of the comet. Providing
name
asEmpty
, will specifically select comets with no name.- theType
the type of the CometActor
- name
the optional name of the CometActor
- msg
the message to send to the CometActor
-
def
sendCometMessage[T](msg: Any)(implicit cometManifest: Manifest[T]): Unit
Similar behavior to the main sendCometMessage, except that the type argument is taken as a type parameter instead of a string.
Similar behavior to the main sendCometMessage, except that the type argument is taken as a type parameter instead of a string.
- msg
the message to send to the CometActor
-
def
sendCometMessage(theType: String, msg: Any): Unit
This method will send a message to a CometActor, whether or not the CometActor is instantiated.
This method will send a message to a CometActor, whether or not the CometActor is instantiated. If the CometActor already exists in the session, the message will be sent immediately. If the CometActor is not yet instantiated, the message will be sent to the CometActor as part of setup
queueCometMessage
if it is created as part of the current HTTP request/response cycle.- theType
the type of the CometActor
- msg
the message to send to the CometActor
-
def
serverActorForClient(toCall: String, setupFunc: Box[(LiftActor) ⇒ Unit] = Empty, shutdownFunc: Box[(LiftActor) ⇒ Unit] = Empty, dataFilter: (Any) ⇒ Any = a => a): LiftActor
Create a Actor that will take messages on the server and then send them to the client.
Create a Actor that will take messages on the server and then send them to the client. So, from the server perspective, it's just an Async message send. From the client perspective, they get a function called each time the message is sent from the server.
If the message sent to the LiftActor is a JsCmd or JsExp, then the code is sent directly to the client and executed on the client.
If the message is a JsonAST.JValue, it's turned into a JSON string, sent to the client and the client calls the function named in the
toCall
parameter with the value.If the message is anything else, we attempt to JSON serialize the message and if it can be JSON serialized, it's sent over the wire and passed to the
toCall
function on the server- toCall
the name of the browser-side function that should be called when the data is delivered
- setupFunc
called by
localSetup
in the CometActor- shutdownFunc
called by
localShutdown
in the CometActor- dataFilter
messages are passed through this function... it allows conversion of data from
- returns
a server-side Actor that is a proxy for the client-side Actor/Function call
- def sessionHtmlProperties: (Req) ⇒ HtmlProperties
-
def
stateful_?: Boolean
Test the statefulness of this session.
Test the statefulness of this session.
- Definition Classes
- HowStateful
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- def terminateHint: Unit
-
def
testStatefulFeature[T](f: ⇒ T): T
Run the code, but if the session is not stateful, then throw a StateInStatelessException
-
def
toString(): String
- Definition Classes
- AnyRef → Any
- val underlyingId: String
-
val
uniqueId: String
The unique id of this session.
The unique id of this session. Can be used to securely and uniquely identify the session, unlike underlyingId which is tied to the host session id. This id should be secure to emit into a page as needed (for example, it is used to provide randomness/cache-busting to the comet request path).
-
def
updateFunctionMap(funcs: Map[String, AFuncHolder], uniqueId: String, when: Long): Unit
Updates the internal functions mapping
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
- object currentSourceContext extends TransientRequestVar[Any]
- object legacyIeCompatibilityMode extends SessionVar[Boolean]
Deprecated Value Members
-
def
fixHtml(in: NodeSeq): NodeSeq
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0) Use normalizeHtml instead.
-
def
sendCometActorMessage(theType: String, name: Box[String], msg: Any): Unit
- Annotations
- @deprecated
- Deprecated
(Since version 3.1) Please switch to using sendCometMessage.
-
def
setupComet(cometType: String, cometName: Box[String], msg: Any): Unit
Queue a message for a comet that is not started yet.
Queue a message for a comet that is not started yet.
- Annotations
- @deprecated
- Deprecated
(Since version 3.1) Please use queueCometMessage instead.