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
`static java.util.regex.Pattern` `oldCookieSessionParser` Cookie session parser for cookie created by version 1.2.5 or before.

### Constructor Summary

Constructors
Constructor and Description
`CookieDataCodec()`

### Method Summary

All Methods Static Methods Concrete Methods
`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

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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

### Constructor Detail

#### CookieDataCodec

    public CookieDataCodec()

### 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 a
  `b` - the string b
Returns:
  true is the 2 strings are equals