How to clear the current session on browser exit

225 views
Skip to first unread message

ra...@oddly.co

unread,
Mar 21, 2013, 4:48:24 AM3/21/13
to play-fr...@googlegroups.com

Hi all,

I am creating a project using Play 2.1 framework and used Java in it. 
I am getting my current session using 

Session session = Http.Context.current().session();

I would like to know how to delete or clear the current session on browser exit which leads to block unauthorized users access using URLs.

Thank you.
Rajiv.

Stian Lindhom

unread,
Mar 21, 2013, 6:12:36 AM3/21/13
to play-fr...@googlegroups.com
There are no sessions (at least in the traditional "server side HTTP session"-sense) in Play so there is nothing to clear.
When you are reading Http.Context.current().session() you are in fact reading cookie values. The cookie is set to expire when the browser session ends. Read more about it at http://www.playframework.com/documentation/2.0/ScalaSessionFlash

-- 
Best regards,
Stian Lindhom
Reply all
Reply to author
Forward
0 new messages