| OVERVIEW | PACKAGE | CONSTR | FIELDS | METHODS | FRAMES NO FRAMES | INHERITED |
object S
extends
HasParams with Loggable
- LiftFilter - LiftSession
def this
|
| BinFuncHolder.. |
object BinFuncHolder
|
|
||||||||||||
| LFuncHolder.. |
object LFuncHolder
|
|
||||||||||||
| NFuncHolder.. |
object NFuncHolder
|
|
||||||||||||
| PFPromoter.. |
object PFPromoter
|
|
||||||||||||
| SFuncHolder.. |
object SFuncHolder
|
|
||||||||||||
| attr.. |
object attr
Used to get an attribute by its name
[details]
There are several means to getting
attributes:
// Get a Box for the attribute:
val myAttr = S.attr("test") openOr "Not found"
// Get an attribute or return a default value:
val myAttr = S.attr("name", "Fred")
// Apply a transform function on the attribute value, or return an Empty:
val pageSize = S.attr("count", _.toInt) openOr 20
// There are also prefixed versions:
val prefixedAttr = S.attr("prefix", "name") openOr "Not found"
|
|
||||||||||||
| attrsFlattenToMap.. |
def attrsFlattenToMap
Converts the S
[details]
attrs to a Map[String, String]. The key of the map depends on whether
the attribute is prefixed or not. Prefixed attributes have keys of the form
"prefix:name", while unprefixed attributes have keys of the form "name". If you only want
attributes for a specific prefix, use prefixedAttrsToMap.
|
Map[String, String] | ||||||||||||
| attrsToMetaData.. |
def attrsToMetaData
Converts S
[details]
attrs attributes to a MetaData object that can be used to add
attributes to one or more XML elements. Similar to prefixedAttrsToMetaData, except
that it handles both prefixed and unprefixed attributes. This version of the method will
use all of the currently set attributes from S.attrs. If you want to filter it, use the
attrsToMetaData(String => Boolean) version, which allows you to specify a predicate
function for filtering. For example, if you want all of the current attributes to be
added to a div tag, you could do:
val myDiv = (
|
MetaData | ||||||||||||
| clearHighLevelSessionDispatcher.. |
def clearHighLevelSessionDispatcher
Clears all custom dispatch functions from the current session
[details]
See
addHighLevelSessionDispatcher for an example of usage.
|
Box[Unit] | ||||||||||||
| clearSessionRewriter.. |
def clearSessionRewriter
Clears the per-session rewrite table
[details]
See addSessionRewriter for an
example of usage.
|
Box[Unit] | ||||||||||||
| containerRequest.. |
def containerRequest
The current container request
|
Box[HTTPRequest] | ||||||||||||
| containerSession.. |
def containerSession
Returns the HttpSession
|
Box[HTTPSession] | ||||||||||||
| contextPath.. |
def contextPath
The current context path for the deployment
|
String | ||||||||||||
| currentAttrs.. |
def currentAttrs
|
MetaData | ||||||||||||
| currentAttrsToMetaData.. |
def currentAttrsToMetaData
Converts S
[details]
attrs attributes to a MetaData object that can be used to add
attributes to one or more XML elements. Similar to prefixedAttrsToMetaData, except
that it handles both prefixed and unprefixed attributes. This version of the method will
use all of the currently set attributes from S.attrs. If you want to filter it, use the
attrsToMetaData(String => Boolean) version, which allows you to specify a predicate
function for filtering. For example, if you want all of the current attributes to be
added to a div tag, you could do:
val myDiv = (
|
MetaData | ||||||||||||
| currentSnippet.. |
def currentSnippet
|
Box[String] | ||||||||||||
| disableTestFuncNames_?.. |
def disableTestFuncNames_?
|
Boolean | ||||||||||||
| formFuncName.. |
def formFuncName
|
String | ||||||||||||
| functionLifespan_?.. |
def functionLifespan_?
Returns whether functions are currently extended to the lifetime of the session
[details]
|
Boolean | ||||||||||||
| functionMap.. |
def functionMap
Get a map of function name bindings that are used for form and other processing
[details]
Using these
bindings is considered advanced functionality.
|
Map[String, AFuncHolder] | ||||||||||||
| get_?.. |
def get_?
Test the current request to see if it's a GET
[details]
This is a thin wrapper on Req.get_?
|
Boolean | ||||||||||||
| highLevelSessionDispatchList.. |
def highLevelSessionDispatchList
Return the list of DispatchHolders set for this session
[details]
|
List[DispatchHolder] | ||||||||||||
| highLevelSessionDispatcher.. |
def highLevelSessionDispatcher
Return a List of the LiftRules
[details]
DispatchPF functions that are set for this
session. See addHighLevelSessionDispatcher for an example of how these are
used.
|
List[PartialFunction] | ||||||||||||
| hostAndPath.. |
def hostAndPath
The host and path of the request up to and including the context path
[details]
This does
not include the template path or query string.
|
String | ||||||||||||
| hostName.. |
def hostName
The hostname to which the request was sent
[details]
This is taken from the "Host" HTTP header, or if that
does not exist, the DNS name or IP address of the server.
|
String | ||||||||||||
| ieMode.. |
def ieMode
[details]
|
Boolean | ||||||||||||
| inStatefulScope_?.. |
def inStatefulScope_?
This method returns true if the S object has been initialized for our current scope
[details]
If
the S object has not been initialized then functionality on S will not work.
|
Boolean | ||||||||||||
| invokedAs.. |
def invokedAs
Returns the 'type' S attribute
[details]
This corresponds to the current Snippet's name. For example, the snippet:
<lift:Hello.world />Will return "Hello.world". |
String | ||||||||||||
| liftCoreResourceBundle.. |
def liftCoreResourceBundle
Get the lift core resource bundle for the current locale as defined by the
LiftRules
[details]
liftCoreResourceName varibale.
|
Box[ResourceBundle] | ||||||||||||
| locale.. |
def locale
Returns the Locale for this request based on the LiftRules
[details]
localeCalculator
method.
|
Locale | ||||||||||||
| location.. |
def location
|
Box[Loc[Any]] | ||||||||||||
| loggedIn_?.. |
def loggedIn_?
This method is a convenience accessor for LiftRules
[details]
loggedInTest. You can define your own
function to check to see if a user is logged in there and this will call it.
|
Boolean | ||||||||||||
| logger.. |
protected val logger
|
Logger | Loggable | |||||||||||
| post_?.. |
def post_?
Test the current request to see if it's a POST
[details]
This is a thin wrapper
over Req.post_?
|
Boolean | ||||||||||||
| queryString.. |
def queryString
Returns the query string for the current request
|
Box[String] | ||||||||||||
| receivedCookies.. |
def receivedCookies
[details]
|
List[HTTPCookie] | ||||||||||||
| referer.. |
def referer
Returns the 'Referer' HTTP header attribute
|
Box[String] | ||||||||||||
| request.. |
def request
Get a Req representing our current HTTP request
[details]
|
Box[Req] | ||||||||||||
| resourceBundles.. |
def resourceBundles
Get a List of the resource bundles for the current locale
[details]
The resource bundles are defined by
the LiftRules.resourceNames and LiftRules.resourceBundleFactories variables.
|
List[ResourceBundle] | ||||||||||||
| responseCookies.. |
def responseCookies
[details]
|
List[HTTPCookie] | ||||||||||||
| session.. |
def session
The current LiftSession
|
Box[LiftSession] | ||||||||||||
| sessionRewriter.. |
def sessionRewriter
Return the list of RewriteHolders set for this session
[details]
See addSessionRewriter
for an example of how to use per-session rewrites.
|
List[RewriteHolder] | ||||||||||||
| skipDocType.. |
def skipDocType
When this is true, Lift will not emit a DocType definition at the start of the response
content
[details]
If you're sending XHTML and this is set to true, you need to include the DocType
in your template.
|
Boolean | ||||||||||||
| skipXmlHeader.. |
def skipXmlHeader
If true, then the xml header at the beginning of
the returned XHTML page will not be inserted
|
Boolean | ||||||||||||
| templateFromTemplateAttr.. |
def templateFromTemplateAttr
|
Box[NodeSeq] | ||||||||||||
| timeZone.. |
def timeZone
Return the current timezone based on the LiftRules
[details]
timeZoneCalculator
method.
|
TimeZone | ||||||||||||
| uri.. |
def uri
The URI of the current request (not re-written)
[details]
The URI is the portion of the request
URL after the context path. For example, with a context path of "myApp",
Lift would return the following URIs for the given requests:
val fullURI = S.request.map(_.request.getRequestURI) openOr ("Undefined")
The URI may be used to provide a link back to the same page as the current request:
bind(...,
"selflink" -> SHtml.link(S.uri, { () => ... }, Text("Self link")),
...)
|
String | ||||||||||||
| uriAndQueryString.. |
def uriAndQueryString
|
Box[String] |
| !=.. |
final def !=(arg0 : Any)
|
Boolean | Any | ||||||
| !=.. |
final def !=(arg0 : Object)
|
Boolean | AnyRef | ||||||
| ==.. |
final def ==(arg0 : Object)
|
Boolean | AnyRef | ||||||
| ==.. |
final def ==(arg0 : Any)
|
Boolean | Any | ||||||
| ?.. |
def ?(str : String)
Get a localized string or return the original string
[details]
|
String | |||||||
| ?.. |
def ?(str : String, params : Any*)
Attempt to localize and then format the given string
[details]
This uses the String.format method
to format the localized string.
|
String | |||||||
| ??.. |
def ??(str : String)
Get a core lift localized string or return the original string
[details]
|
String | |||||||
| ??.. |
def ??(str : String, params : Object*)
Get a core lift localized and formatted string or return the original string
[details]
|
String | |||||||
| addAnalyzer.. |
def addAnalyzer(f : (Box[Req], Long, List[(String, Long)]) => Any)
Add a query analyzer (passed queries for analysis or logging)
[details]
The analyzer
methods are executed with the request, total time to process the request, and
the List of query log entries once the current request completes.
|
Unit | |||||||
| addAround.. |
def addAround(lw : LoanWrapper)
You can wrap the handling of an HTTP request with your own wrapper
[details]
The wrapper can
execute code before and after the request is processed (but still have S scope).
This allows for query analysis, etc. Wrappers are chained, much like servlet filters,
so you can layer processing on the request. As an example, let's look at a wrapper that opens
a resource and makes it available via a RequestVar, then closes the resource when finished:
import net.liftweb.http.{ ResourceVar,S }
import net.liftweb.util.LoanWrapper
// Where "ResourceType" is defined by you
object myResource extends ResourceVar[ResourceType](...)
class Boot {
def boot {
...
S.addAround(
new LoanWrapper {
def apply[T](f: => T) : T = {
myResource(... code to open and return a resource instance ...)
f() // This call propagates the request further down the "chain" for template processing, etc.
myResource.is.close() // Release the resource
}
}
)
...
}
}
|
Unit | |||||||
| addAround.. |
def addAround(lw : List[LoanWrapper])
You can wrap the handling of an HTTP request with your own wrapper
[details]
The wrapper can
execute code before and after the request is processed (but still have S scope).
This allows for query analysis, etc. See S.addAround(LoanWrapper) for an example.
This version of the method takes a list of LoanWrappers that are applied in order.
|
Unit | |||||||
| addCleanupFunc.. |
def addCleanupFunc(f : () => Unit)
Adds a cleanup function that will be executed at the end of the request pocessing
[details]
Exceptions thrown from these functions will be swallowed, so make sure to handle any
expected exceptions within your function.
|
Unit | |||||||
| addCookie.. |
def addCookie(cookie : HTTPCookie)
Adds a Cookie to the List[Cookies] that will be sent with the Response
[details]
If you wish to delete a Cookie as part of the Response, use the deleteCookie
method.
An example of adding and removing a Cookie is:
import net.liftweb.http.provider.HTTPCookie
class MySnippet {
final val cookieName = "Fred"
def cookieDemo (xhtml : NodeSeq) : NodeSeq = {
var cookieVal = S.findCookie(cookieName).map(_.getvalue) openOr ""
def setCookie() {
val cookie = HTTPCookie(cookieName, cookieVal).setMaxAge(3600) // 3600 seconds, or one hour
S.addCookie(cookie)
}
bind("cookie", xhtml,
"value" -> SHtml.text(cookieVal, cookieVal = _),
"add" -> SHtml.submit("Add", setCookie)
"remove" -> SHtml.link(S.uri, () => S.deleteCookie(cookieName), "Delete Cookie")
)
}
}
|
Unit | |||||||
| addFunctionMap.. |
def addFunctionMap(name : String, value : AFuncHolder)
Associates a name with a function impersonated by AFuncHolder
[details]
These are basically functions
that are executed when a request contains the 'name' request parameter.
|
Unit | |||||||
| addHighLevelSessionDispatcher.. |
def addHighLevelSessionDispatcher(name : String, disp : PartialFunction)
Adds a dispatch function for the current session, as opposed to a global
dispatch through LiftRules
[details]
dispatch. An example would be if we wanted a user
to be able to download a document only when logged in. First, we define
a dispatch function to handle the download, specific to a given user:
def getDocument(userId : Long)() : Box[LiftResponse] = { ... }
Then, in the login/logout handling snippets, we could install and remove
the custom dispatch as appropriate:
def login(xhtml : NodeSeq) : NodeSeq = {
def doAuth () {
...
if (user.loggedIn_?) {
S.addHighLevelSessionDispatcher("docDownload", {
case Req(List("download", "docs"), _, _) => getDocument(user.id)
} )
}
}
def logout(xhtml : NodeSeq) : NodeSeq = {
def doLogout () {
...
S.removeHighLevelSessionDispatcher("docDownload")
// or, if more than one dispatch has been installed, this is simpler
S.clearHighLevelSessionDispatcher
}
}
It's important to note that per-session dispatch takes precedence over
LiftRules.dispatch, so you can override things set there.
|
Box[Unit] | |||||||
| addSessionRewriter.. |
def addSessionRewriter(name : String, rw : PartialFunction)
Adds a per-session rewrite function
[details]
This can be used if you only want a particular rewrite
to be valid within a given session. Per-session rewrites take priority over rewrites set in
LiftRules.rewrite, so you can use this mechanism to override global functionality. For example,
you could set up a global rule to make requests for the "account profile" page go back to the home
page by default:
package bootstrap.liftweb
... imports ...
class Boot {
def boot {
LiftRules.rewrite.append {
case RewriteRequest(ParsePath(List("profile")), _, _, _) =>
RewriteResponse(List("index"))
}
}
}
Then, in your login snippet, you could set up a per-session rewrite to the correct template:
def loginSnippet (xhtml : NodeSeq) : NodeSeq = {
...
def doLogin () {
...
S.addSessionRewriter("profile", {
case RewriteRequest(ParsePath(List("profile")), _, _, _) =>
RewriteResponse(List("viewProfile"), Map("user" -> user.id))
}
...
}
...
}
And in your logout snippet you can remove the rewrite:
def doLogout () {
S.removeSessionRewriter("profile")
// or
S.clearSessionRewriter
}
|
Box[Unit] | |||||||
| addSnippetForClass.. |
def addSnippetForClass(cls : String, inst : DispatchSnippet)
Register a stateful snippet for a given class name
[details]
Only registers if the name
is not already set.
|
Unit | |||||||
| asInstanceOf.. |
final def asInstanceOf[T0]
|
T0 | Any | ||||||
| attrs.. |
def attrs
Get a list of current attributes
[details]
Each attribute item is a pair of (key,value). The key
is an Either that depends on whether the attribute is prefixed or not. If the attribute
is prefixed, the key is a Right((prefix, name)). If the attribute is unprefixed then the
key is a Left(name). For example, the following table shows how various tag attributes
would be represented:
The prefixedAttrsToMap method provides a convenient way to retrieve only attributes with a given prefix. The prefixedAttrsToMetaData method can be used to add attributes onto an XML node
|
List[(Either[String, (String, String)], String)] | |||||||
| attrsToMetaData.. |
def attrsToMetaData(predicate : (String) => Boolean)
Similar to S
[details]
attrsToMetaData, but lets you specify a predicate function that filters the
generated MetaData. For example, if you only wanted the "id" attribute, you could do:
val myDiv = (
|
MetaData | |||||||
| buildJsonFunc.. |
def buildJsonFunc(f : (Any) => JsCmd)
Build a handler for incoming JSON commands
[details]
|
(JsonCall, JsCmd) | |||||||
| buildJsonFunc.. |
def buildJsonFunc(name : Box[String], onError : Box[JsCmd], f : (Any) => JsCmd)
Build a handler for incoming JSON commands
[details]
|
(JsonCall, JsCmd) | |||||||
| buildJsonFunc.. |
def buildJsonFunc(onError : JsCmd, f : (Any) => JsCmd)
|
(JsonCall, JsCmd) | |||||||
| callOnce.. |
def callOnce[T](f : => T)
If you bind functions (i
[details]
e. using SHtml helpers) inside the closure passed to callOnce,
after your function is invoked, it will be automatically removed from functions cache so
that it cannot be invoked again.
|
T | |||||||
| clearCurrentNotices.. |
def clearCurrentNotices
Clears up the notices
|
Unit | |||||||
| clearFunctionMap.. |
def clearFunctionMap
Clears the function map
[details]
potentially very destuctive... use at your own risk!
|
Unit | |||||||
| clone.. |
protected def clone
|
Object | AnyRef | ||||||
| contextFuncBuilder.. |
def contextFuncBuilder(f : AFuncHolder)
Wrap an AFuncHolder with the current snippet and Loc context so that for Ajax calls, the original snippets,
RequestVars and Loc (location) are populated
[details]
|
AFuncHolder | |||||||
| cookieValue.. |
def cookieValue(name : String)
Get the cookie value for the given cookie
|
Box[String] | |||||||
| createJsonFunc.. |
def createJsonFunc(onError : JsCmd, f : PFPromoter[JValue, JsCmd])
Build a handler for incoming JSON commands based on the new Json Parser
[details]
|
(JsonCall, JsCmd) | |||||||
| createJsonFunc.. |
def createJsonFunc(name : Box[String], onError : Box[JsCmd], pfp : PFPromoter[JValue, JsCmd])
Build a handler for incoming JSON commands based on the new Json Parser
[details]
You
can use the helpful Extractor in net.liftweb.util.JsonCommand
|
(JsonCall, JsCmd) | |||||||
| createJsonFunc.. |
def createJsonFunc(f : PFPromoter[JValue, JsCmd])
Build a handler for incoming JSON commands based on the new Json Parser
[details]
|
(JsonCall, JsCmd) | |||||||
| currentAttrsToMetaData.. |
def currentAttrsToMetaData(predicate : (String) => Boolean)
Similar to S
[details]
attrsToMetaData, but lets you specify a predicate function that filters the
generated MetaData. For example, if you only wanted the "id" attribute, you could do:
val myDiv = (
|
MetaData | |||||||
| deleteCookie.. |
def deleteCookie(cookie : HTTPCookie)
Deletes the cookie from the user's browser
[details]
|
Unit | |||||||
| deleteCookie.. |
def deleteCookie(name : String)
Deletes the cookie from the user's browser
[details]
|
Unit | |||||||
| disableTestFuncNames.. |
def disableTestFuncNames[T](f : => T)
|
T | |||||||
| encodeURL.. |
def encodeURL(url : String)
Decorates an URL with jsessionid parameter in case cookies are disabled from the container
[details]
Also
it appends general purpose parameters defined by LiftRules.urlDecorate
|
String | |||||||
| eq.. |
final def eq(arg0 : Object)
|
Boolean | AnyRef | ||||||
| equals.. |
def equals(arg0 : Any)
|
Boolean | AnyRef | ||||||
| error.. |
def error(vi : List[FieldError])
Sets an ERROR notices from a List[FieldError]
|
Unit | |||||||
| error.. |
def error(n : String)
Sets an ERROR notice as a plain text
|
Unit | |||||||
| error.. |
def error(id : String, n : NodeSeq)
Sets an ERROR notice as an XML sequence and associates it with an id
|
Unit | |||||||
| error.. |
def error(id : String, n : String)
Sets an ERROR notice as plain text and associates it with an id
|
Unit | |||||||
| error.. |
def error(n : NodeSeq)
Sets an ERROR notice as an XML sequence
|
Unit | |||||||
| errors.. |
def errors
Returns only ERROR notices
|
List[(NodeSeq, Box[String])] | |||||||
| finalize.. |
protected def finalize
|
Unit | AnyRef | ||||||
| findCookie.. |
def findCookie(name : String)
Finds a cookie with the given name that was sent in the request
[details]
|
Box[HTTPCookie] | |||||||
| fmapFunc.. |
def fmapFunc[T](in : AFuncHolder)(f : (String) => T)
Maps a function with an random generated and name
|
T | |||||||
| formGroup.. |
def formGroup[T](group : Int)(f : => T)
|
T | |||||||
| functionLifespan.. |
def functionLifespan[T](span : Boolean)(f : => T)
Functions that are mapped to HTML elements are, by default,
garbage collected if they are not seen in the browser in the last 10 minutes (defined in LiftRules
[details]
unusedFunctionsLifeTime).
In some cases (e.g., JSON handlers), you may want to extend the
lifespan of the functions to the lifespan of the session.
|
T | |||||||
| get.. |
def get(what : String)
Returns the LiftSession parameter denominated by 'what'
[details]
|
Box[String] | |||||||
| getAllNotices.. |
def getAllNotices
Returns the current and "old" notices
|
List[(Value, NodeSeq, Box[String])] | |||||||
| getClass.. |
final def getClass
|
Class[Any] | AnyRef | ||||||
| getDocType.. |
def getDocType
Returns the document type that was set for the response
[details]
The default is XHTML 1.0
Transitional.
|
(Boolean, Box[String]) | |||||||
| getHeader.. |
def getHeader(name : String)
Returns the current set value of the given HTTP response header as a Box
[details]
If
you want a request header, use Req.getHeader or S.getRequestHeader.
|
Box[String] | |||||||
| getHeaders.. |
def getHeaders(in : List[(String, String)])
Returns the currently set HTTP response headers as a List[(String, String)]
[details]
To retrieve
a specific response header, use S.getHeader. If you want to get request headers (those
sent by the client), use Req.getHeaders or S.getRequestHeader.
|
List[(String, String)] | |||||||
| getNotices.. |
def getNotices
Returns the current notices
|
List[(Value, NodeSeq, Box[String])] | |||||||
| getRequestHeader.. |
def getRequestHeader(name : String)
Returns the current value of the given HTTP request header as a Box
[details]
This is
really just a thin wrapper on Req.header(String). For response headers, see
S.getHeaders, S.setHeader, or S.getHeader.
|
Box[String] | |||||||
| getSessionAttribute.. |
def getSessionAttribute(what : String)
Returns the HttpSession parameter denominated by 'what'
[details]
|
Box[String] | |||||||
| hashCode.. |
def hashCode
|
Int | AnyRef | ||||||
| idMessages.. |
def idMessages(f : => List[(NodeSeq, Box[String])])
Returns the messages that are associated with any id
[details]
Messages associated with the same id will be enlisted.
|
List[(String, List[NodeSeq])] | |||||||
| init.. |
def init[B](request : Req, session : LiftSession)(f : => B)
Initialize the current request session
[details]
Generally this is handled by Lift during request
processing, but this method is available in case you want to use S outside the scope
of a request (standard HTTP or Comet).
|
B | |||||||
| initIfUninitted.. |
def initIfUninitted[B](session : LiftSession)(f : => B)
|
B | |||||||
| isInstanceOf.. |
final def isInstanceOf[T0]
|
Boolean | Any | ||||||
| jsonFmapFunc.. |
def jsonFmapFunc[T](in : (Any) => JsObj)(f : (String) => T)
Maps a function with an random generated and name
|
T | |||||||
| loc.. |
def loc(str : String)
Localize the incoming string based on a resource bundle for the current locale
[details]
The
localized string is converted to an XML element if necessary via the
LiftRules.localizeStringToXml
function (the default behavior is to wrap it in a Text element). If the lookup fails for a given resource
bundle (e.g. a null is returned), then the LiftRules.localizationLookupFailureNotice
function is called with the input string and locale.
|
Box[NodeSeq] | |||||||
| loc.. |
def loc(str : String, dflt : NodeSeq)
Localize the incoming string based on a resource bundle for the current locale,
with a default value to to return if localization fails
[details]
|
NodeSeq | |||||||
| locateMappedSnippet.. |
def locateMappedSnippet(name : String)
|
Box[(NodeSeq) => NodeSeq] | |||||||
| locateSnippet.. |
def locateSnippet(name : String)
Finds a snippet function by name
[details]
|
Box[(NodeSeq) => NodeSeq] | |||||||
| logQuery.. |
def logQuery(query : String, time : Long)
Log a query for the given request
[details]
The query log can be tested to see
if queries for the particular page rendering took too long. The query log
starts empty for each new request. net.liftweb.mapper.DB.queryCollector is a
method that can be used as a log function for the net.liftweb.mapper.DB.addLogFunc
method to enable logging of Mapper queries. You would set it up in your bootstrap like:
import net.liftweb.mapper.DB
import net.liftweb.http.S
class Boot {
def boot {
...
DB.addLogFunc(DB.queryCollector)
...
}
}
Note that the query log is simply stored as a List and is not sent to any output
by default. To retrieve the List of query log items, use S.queryLog. You can also
provide your own analysis function that will process the query log via S.addAnalyzer.
|
Unit | |||||||
| mapFunc.. |
def mapFunc(in : AFuncHolder)
Similar with addFunctionMap but also returns the name
[details]
Use fmapFunc(AFuncHolder)(String => T)
|
String | |||||||
| mapFunc.. |
def mapFunc(name : String, inf : AFuncHolder)
Similar with addFunctionMap but also returns the name
[details]
Use fmapFunc(AFuncHolder)(String => T)
|
String | |||||||
| mapFuncToURI.. |
def mapFuncToURI(uri : String, f : () => Unit)
Attaches to this uri and parameter that has function f associated with
[details]
When
this request is submitted to server the function will be executed and then
it is automatically cleaned up from functions caches.
|
String | |||||||
| mapSnippet.. |
def mapSnippet(name : String, func : (NodeSeq) => NodeSeq)
Associates a name with a snippet function 'func'
[details]
This can be used to change a snippet
mapping on a per-session basis. For example, if we have a page that we want to change
behavior on based on query parameters, we could use mapSnippet to programmatically determine
which snippet function to use for a given snippet in the template. Our code would look like:
import _root_.scala.xml.{ NodeSeq,Text }
class SnipMap {
def topSnippet (xhtml : NodeSeq) : NodeSeq = {
if (S.param("showAll").isDefined) {
S.mapSnippet("listing", listing)
} else {
S.mapSnippet("listing", { ignore => Text("") } )
}
...
}
def listing(xhtml : NodeSeq) : NodeSeq = {
...
}
Then, your template would simply look like:
<lift:surround with="default" at="content"> ... <p><lift:SnipMap.topSnippet /></p> <p><lift:listing /></p> </lift:surround>Snippets are processed in the order that they're defined in the template, so if you want to use this approach make sure that the snippet that defines the mapping comes before the snippet that is being mapped.
|
Unit | |||||||
| mapToAttrs.. |
def mapToAttrs(in : Map[String, String])
Converts a Map[String, String] into a MetaData instance
[details]
This can be used to
add attributes to an XML element based on a map of attribute->value pairs. See
prefixedAttrsToMetaData(String,Map) for an example.
|
MetaData | |||||||
| messages.. |
def messages(f : => List[(NodeSeq, Box[String])])
Returns all messages, associated with any id or not
[details]
|
List[NodeSeq] | |||||||
| messagesById.. |
def messagesById(id : String)(f : => List[(NodeSeq, Box[String])])
Returns the messages provided by list function that are associated with id
[details]
|
List[NodeSeq] | |||||||
| ne.. |
final def ne(arg0 : Object)
|
Boolean | AnyRef | ||||||
| noIdMessages.. |
def noIdMessages(f : => List[(NodeSeq, Box[String])])
Returns the messages that are not associated with any id
[details]
|
List[NodeSeq] | |||||||
| notice.. |
def notice(n : String)
Sets an NOTICE notice as plain text
|
Unit | |||||||
| notice.. |
def notice(id : String, n : NodeSeq)
Sets an NOTICE notice as and XML sequence and associates it with an id
|
Unit | |||||||
| notice.. |
def notice(id : String, n : String)
Sets an NOTICE notice as plai text and associates it with an id
|
Unit | |||||||
| notice.. |
def notice(n : NodeSeq)
Sets an NOTICE notice as an XML sequence
|
Unit | |||||||
| notices.. |
def notices
Returns only NOTICE notices
|
List[(NodeSeq, Box[String])] | |||||||
| notify.. |
final def notify
|
Unit | AnyRef | ||||||
| notifyAll.. |
final def notifyAll
|
Unit | AnyRef | ||||||
| oneShot.. |
def oneShot[T](f : => T)
All functions created inside the oneShot scope
will only be called once and their results will be
cached and served again if the same function is invoked
|
T | |||||||
| overrideSnippetForClass.. |
def overrideSnippetForClass(cls : String, inst : DispatchSnippet)
Register a stateful snippet for a given class name
[details]
The addSnippetForClass
method is preferred
|
Unit | |||||||
| param.. |
def param(n : String)
Returns the HTTP parameter having 'n' name
|
Box[String] | |||||||
| params.. |
def params(n : String)
Returns all the HTTP parameters having 'n' name
|
List[String] | |||||||
| prefixedAttrsToMap.. |
def prefixedAttrsToMap(prefix : String, start : Map[String, String])
Returns the S attributes that are prefixed by 'prefix' parameter as a Map[String, String]
that will be 'merged' with the 'start' Map
[details]
|
Map[String, String] | |||||||
| prefixedAttrsToMap.. |
def prefixedAttrsToMap(prefix : String)
Returns the S attributes that are prefixed by 'prefix' parameter as a Map[String, String]
[details]
|
Map[String, String] | |||||||
| prefixedAttrsToMetaData.. |
def prefixedAttrsToMetaData(prefix : String, start : Map[String, String])
Returns the S attributes that are prefixed by 'prefix' parameter as a MetaData [details]
The start Map will be 'merged' with the Map resulted after prefix matching and
the result Map will be converted to a MetaData. The MetaData can be used to add attributes
back onto XML elements via Scala's '%' method. For example, if we wanted to add
attributes prefixed with "anchor" to any <a> elements we create, we could
do something like:
val myLink = (...) % S.prefixedAttrsToMetaData("anchor", Map("id" -> "myAnchor"))
|
MetaData | |||||||
| prefixedAttrsToMetaData.. |
def prefixedAttrsToMetaData(prefix : String)
Similar with prefixedAttrsToMetaData(prefix: String, start: Map[String, String])
but there is no 'start' Map
|
MetaData | |||||||
| queryLog.. |
def queryLog
Get a list of the logged queries
[details]
These log entries are added via the logQuery method, which
has a more detailed explanation of usage.
|
List[(String, Long)] | |||||||
| redirectTo.. |
def redirectTo[T](where : String, func : () => Unit)
Redirects the browser to a given URL and registers a function that will be executed when the browser
accesses the new URL
[details]
Otherwise the function is exactly the same as S.redirectTo(String), which has
example documentation. Note that if the URL that you redirect to must be part of your web application
or the function won't be executed. This is because the function is only registered locally.
|
T | |||||||
| redirectTo.. |
def redirectTo[T](where : String)
Redirects the browser to a given URL
[details]
Note that the underlying mechanism for redirects is to
throw a ResponseShortcutException, so if you're doing the redirect within a try/catch block,
you need to make sure to either ignore the redirect exception or rethrow it. Two possible
approaches would be:
...
try {
// your code here
S.redirectTo(...)
} catch {
case e: Exception if !e.instanceOf[net.liftweb.http.ResponseShortcutException] => ...
}
or
...
try {
// your code here
S.redirectTo(...)
} catch {
case rse: net.liftweb.http.ResponseShortcutException => throw rse
case e: Exception => ...
}
|
T | |||||||
| removeHighLevelSessionDispatcher.. |
def removeHighLevelSessionDispatcher(name : String)
Removes a custom dispatch function for the current session
[details]
See
addHighLevelSessionDispatcher for an example of usage.
|
Box[Unit] | |||||||
| removeSessionRewriter.. |
def removeSessionRewriter(name : String)
Removes the given per-session rewriter
[details]
See addSessionRewriter for an
example of usage.
|
Box[Unit] | |||||||
| render.. |
def render(xhtml : NodeSeq, httpRequest : HTTPRequest)
|
NodeSeq | |||||||
| respondAsync.. |
def respondAsync(f : => Box[LiftResponse])
Use this in DispatchPF for processing REST requests asynchronously
[details]
Note that
this must be called in a stateful context, therefore the S state must be a valid one.
|
() => Box[LiftResponse] | |||||||
| runTemplate.. |
def runTemplate(path : List[String])
Find and process a template
[details]
This can be used to load a template from within some other Lift processing,
such as a snippet or view. If you just want to retrieve the XML contents of a template, use
TemplateFinder.findAnyTemplate.
|
Box[NodeSeq] | |||||||
| seeOther.. |
def seeOther[T](where : String, func : () => Unit)
Redirects the browser to a given URL and registers a function that will be executed when the browser
accesses the new URL
[details]
Otherwise the function is exactly the same as S.seeOther(String), which has
example documentation. Note that if the URL that you redirect to must be part of your web application
or the function won't be executed. This is because the function is only registered locally.
|
T | |||||||
| seeOther.. |
def seeOther[T](where : String)
Redirects the browser to a given URL
[details]
Note that the underlying mechanism for redirects is to
throw a ResponseShortcutException, so if you're doing the redirect within a try/catch block,
you need to make sure to either ignore the redirect exception or rethrow it. Two possible
approaches would be:
...
try {
// your code here
S.seeOther(...)
} catch {
case e: Exception if !e.instanceOf[net.liftweb.http.ResponseShortcutException] => ...
}
or
...
try {
// your code here
S.seeOther(...)
} catch {
case rse: net.liftweb.http.ResponseShortcutException => throw rse
case e: Exception => ...
}
|
T | |||||||
| set.. |
def set(name : String, value : String)
Sets a LiftSession attribute
[details]
|
Unit | |||||||
| setDocType.. |
def setDocType(what : Box[String])
Sets the document type for the response
[details]
If this is not set, the DocType for Lift responses
defaults to XHTML 1.0 Transitional.
|
Unit | |||||||
| setHeader.. |
def setHeader(name : String, value : String)
Sets a HTTP response header attribute
[details]
For example, you could set a "Warn" header in
your response:
...
S.setHeader("Warn", "The cheese is old and moldy")
...
|
Unit | |||||||
| setSessionAttribute.. |
def setSessionAttribute(name : String, value : String)
Sets a HttpSession attribute
[details]
|
Unit | |||||||
| setVars.. |
def setVars[T](attr : MetaData)(f : => T)
Temporarily adds the given attributes to the current set, then executes the given function
[details]
Note that
this does not modify the current attributes available via S.attr.
|
T | |||||||
| skipDocType_=.. |
def skipDocType_=(skip : Boolean)
Sets Lift's DocType behavior
[details]
If this is set to true, Lift will not emit a DocType definition
at the start of the response content. If you're sending XHTML and this is set to true, you need
to include the DocType in your template.
|
Unit | |||||||
| skipXmlHeader_=.. |
def skipXmlHeader_=(in : Boolean)
Set the skipXmlHeader flag
|
Unit | |||||||
| snippetForClass.. |
def snippetForClass(cls : String)
Given a snippet class name, return the cached or predefined stateful snippet for
that class
|
Box[DispatchSnippet] | |||||||
| stuff2ToUnpref.. |
implicit def stuff2ToUnpref(in : (Symbol, Any))
|
UnprefixedAttribute | |||||||
| synchronizeForSession.. |
def synchronizeForSession[T](f : => T)
Execute code synchronized to the current session object
|
T | |||||||
| synchronized.. |
final def synchronized[T0](arg0 : T0)
|
T0 | AnyRef | ||||||
| toLFunc.. |
implicit def toLFunc(in : (List[String]) => Any)
|
AFuncHolder | |||||||
| toNFunc.. |
implicit def toNFunc(in : () => Any)
|
AFuncHolder | |||||||
| toString.. |
def toString
|
String | AnyRef | ||||||
| tuple2FieldError.. |
implicit def tuple2FieldError(t : (FieldIdentifier, NodeSeq))
|
FieldError | |||||||
| unset.. |
def unset(name : String)
Removes a LiftSession attribute
[details]
|
Unit | |||||||
| unsetSessionAttribute.. |
def unsetSessionAttribute(name : String)
Removes a HttpSession attribute
[details]
|
Unit | |||||||
| wait.. |
final def wait
|
Unit | AnyRef | ||||||
| wait.. |
final def wait(arg0 : Long)
|
Unit | AnyRef | ||||||
| wait.. |
final def wait(arg0 : Long, arg1 : Int)
|
Unit | AnyRef | ||||||
| warning.. |
def warning(n : String)
Sets an WARNING notice as plain text
|
Unit | |||||||
| warning.. |
def warning(id : String, n : NodeSeq)
Sets an WARNING notice as an XML sequence and associates it with an id
|
Unit | |||||||
| warning.. |
def warning(id : String, n : String)
Sets an WARNING notice as plain text and associates it with an id
|
Unit | |||||||
| warning.. |
def warning(n : NodeSeq)
Sets an WARNING notice as an XML sequence
|
Unit | |||||||
| warnings.. |
def warnings
Returns only WARNING notices
|
List[(NodeSeq, Box[String])] | |||||||
| withAttrs.. |
def withAttrs[T](attrs : MetaData)(f : => T)
|
T |
| OVERVIEW | PACKAGE | CONSTR | FIELDS | METHODS | FRAMES NO FRAMES | INHERITED |