Cookies

From Lift

Jump to: navigation, search

Get a Cookie

To access the cookies sent with the Request, use S.findCookie which returns a Can[Cookie]

S.findCookie("hello") match {
  case Full(c) => processCookie(c)
  case _ => addHelloCookie()
}

Add a Cookie

You can add a cookie anywhere in the Request/Response cycle.

def addHelloCookie {
  val cookie = new Cookie("hello", "joe")
  S.addCookie(cookie)
}


Delete a Cookie

You can delete a cookie from the User's browser

S.deleteCookie("hello")

or

S.deleteCookie(cookie)
Personal tools