Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

lift Session management

Tags:

lift

I am new to lift. I have been working with MVC model so far and using basic session management model i.e. storing a token in the session and check on each request. I am trying to do the same with lift, but my session getting expired abruptly. even some time I just logged in and it logged out. I have analysis that whenever I gets log message like this: INFO - Session ucjrn5flnq9q1ke52z5zixgtt expired

I have searched but I couldn't find any step by step tutor

like image 888
Puneet Jain Avatar asked Jul 07 '11 21:07

Puneet Jain


2 Answers

Sessions are managed by your servlet container. Which one are you using? You should look at the container's documentation.

like image 113
Kim Stebel Avatar answered Nov 11 '22 08:11

Kim Stebel


Do not attempt to use S.get et al to access session bound information. This is just plain dangerous. Do it like this:

class Thing {
  object SessionThing extends SessionVar[Box[String]](Empty)
  ...
  def someMethod = {
    ...
    SessionThing.is // returns you a Box[String].
    // operates on the session variable if it exists, 
    // otherwise provides a sensible default
    SessionThing.is.map(_.toLowerCase).openOr("default") 
    ...
  }
}

You need to understand the snippet and state lifecycles really, as it seems you're not fully understanding how lift's session mechanics work.

like image 29
timothy Avatar answered Nov 11 '22 09:11

timothy