3 // SessionFilter is a Revel Filter that retrieves and sets the session cookie.
4 // Within Revel, it is available as a Session attribute on Controller instances.
5 // The name of the Session cookie is set as CookiePrefix + "_SESSION".
8 var sessionLog = RevelLog.New("section", "session")
10 func SessionFilter(c *Controller, fc []Filter) {
11 CurrentSessionEngine.Decode(c)
12 sessionWasEmpty := c.Session.Empty()
14 // Make session vars available in templates as {{.session.xyz}}
15 c.ViewArgs["session"] = c.Session
16 c.ViewArgs["_controller"] = c
20 // If session is not empty or if session was not empty then
21 // pass it back to the session engine to be encoded
22 if !c.Session.Empty() || !sessionWasEmpty {
23 CurrentSessionEngine.Encode(c)