Cannot set SessionVar in RewritePF
This is a regression and works in 2.3-M1 for instance.
An exception is thrown when trying to set the SessionVar stating that no stateful session exists.
def rewrites: LiftRules.RewritePF = {
case RewriteRequest(ParsePath("user" :: "logout" :: _, _, _, _), _, _) =>
RewriteResponse("user" :: "byebye" :: Nil, Map("logout" -> Backend.logout().toString))
}
LiftRules.statefulRewrite.append(rewrites)
object Backend {
object theSession extends SessionVar[Box[String]](Empty)
def logout() =
theSession.is match {
case Full(session) =>
theSession(Empty)//exception is thrown here
case _ => false
}
}
An exception is thrown when trying to set the SessionVar stating that no stateful session exists.
Leave a comment