Skip to content

Instantly share code, notes, and snippets.

View briannesbitt's full-sized avatar

Brian Nesbitt briannesbitt

View GitHub Profile
@briannesbitt
briannesbitt / ParseSesion
Created September 17, 2011 15:01
Decode the PLAY_SESSION cookie in a functional test
static Pattern sessionParser = Pattern.compile("\u0000([^:]*):([^\u0000]*)\u0000");
static final String TS_KEY = "___TS";
private Scope.Session parseSession(String sessionCookieValue) throws UnsupportedEncodingException
{
Scope.Session session = new Scope.Session();
if (sessionCookieValue != null && !sessionCookieValue.trim().equals(""))
{
String sign = sessionCookieValue.substring(0, sessionCookieValue.indexOf("-"));