Package play.mvc
Class CookieDataCodec
- java.lang.Object
-
- play.mvc.CookieDataCodec
-
public class CookieDataCodec extends java.lang.Object
Provides operations around the encoding and decoding of Cookie data.
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.regex.Pattern
oldCookieSessionParser
Cookie session parser for cookie created by version 1.2.5 or before.
-
Constructor Summary
Constructors Constructor Description CookieDataCodec()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
decode(java.util.Map<java.lang.String,java.lang.String> map, java.lang.String data)
static java.lang.String
encode(java.util.Map<java.lang.String,java.lang.String> map)
static boolean
safeEquals(java.lang.String a, java.lang.String b)
Constant time for same length String comparison, to prevent timing attacks
-
-
-
Field Detail
-
oldCookieSessionParser
public static java.util.regex.Pattern oldCookieSessionParser
Cookie session parser for cookie created by version 1.2.5 or before.We need it to support old Play 1.2.5 session data encoding so that the cookie data doesn't become invalid when applications are upgraded to a newer version of Play
-
-
Method Detail
-
decode
public static void decode(java.util.Map<java.lang.String,java.lang.String> map, java.lang.String data) throws java.io.UnsupportedEncodingException
- Parameters:
map
- the map to decode data into.data
- the data to decode.- Throws:
java.io.UnsupportedEncodingException
- if the encoding is not supported
-
encode
public static java.lang.String encode(java.util.Map<java.lang.String,java.lang.String> map) throws java.io.UnsupportedEncodingException
- Parameters:
map
- the data to encode.- Returns:
- the encoded data.
- Throws:
java.io.UnsupportedEncodingException
- if the encoding is not supported
-
safeEquals
public static boolean safeEquals(java.lang.String a, java.lang.String b)
Constant time for same length String comparison, to prevent timing attacks- Parameters:
a
- The string ab
- the string b- Returns:
- true is the 2 strings are equals
-
-