Package play.core.cookie.encoding
Class ClientCookieEncoder
- Object
-
- play.core.cookie.encoding.ClientCookieEncoder
-
public final class ClientCookieEncoder extends Object
A RFC6265 compliant cookie encoder to be used client side, so only name=value pairs are sent.Note that multiple cookies are supposed to be sent at once in a single "Cookie" header.
- See Also:
ClientCookieDecoder
-
-
Field Summary
Fields Modifier and Type Field Description static ClientCookieEncoder
LAX
Lax instance that doesn't validate name and valuestatic ClientCookieEncoder
STRICT
Strict encoder that validates that name and value chars are in the valid scope defined in RFC6265
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
encode(Iterable<? extends Cookie> cookies)
Encodes the specified cookies into a single Cookie header value.String
encode(String name, String value)
Encodes the specified cookie into a Cookie header value.String
encode(Cookie cookie)
Encodes the specified cookie into a Cookie header value.String
encode(Cookie... cookies)
Encodes the specified cookies into a single Cookie header value.protected void
validateCookie(String name, String value)
-
-
-
Field Detail
-
STRICT
public static final ClientCookieEncoder STRICT
Strict encoder that validates that name and value chars are in the valid scope defined in RFC6265
-
LAX
public static final ClientCookieEncoder LAX
Lax instance that doesn't validate name and value
-
-
Method Detail
-
encode
public String encode(String name, String value)
Encodes the specified cookie into a Cookie header value.- Parameters:
name
- the cookie namevalue
- the cookie value- Returns:
- a Rfc6265 style Cookie header value
-
encode
public String encode(Cookie cookie)
Encodes the specified cookie into a Cookie header value.- Parameters:
cookie
- specified the cookie- Returns:
- a Rfc6265 style Cookie header value
-
encode
public String encode(Cookie... cookies)
Encodes the specified cookies into a single Cookie header value.- Parameters:
cookies
- some cookies- Returns:
- a Rfc6265 style Cookie header value, null if no cookies are passed.
-
encode
public String encode(Iterable<? extends Cookie> cookies)
Encodes the specified cookies into a single Cookie header value.- Parameters:
cookies
- some cookies- Returns:
- a Rfc6265 style Cookie header value, null if no cookies are passed.
-
-