Up: Chapter 17

17.2 Solution

If you’ve got a:
object MyService extends RestHelper {
....
}
And:
val ensureSession: PartialFunction[Req, Unit] = {
  case _ if isLoggedIn => 
}
then in Boot:
import net.liftweb.util.Helpers._
‚Äč
LiftRules.dispatch.append(ensureSession guard MyService)
This is a simple way to compose PartialFunctions and put a guard around all the elements of a PartialFunction.
Up: Chapter 17

(C) 2012 David Pollak