Package play.core.cookie.encoding
Class ServerCookieEncoder
java.lang.Object
play.core.cookie.encoding.ServerCookieEncoder
A RFC6265 compliant cookie encoder to be used
server side, so some fields are sent (Version is typically ignored).
As Netty's Cookie merges Expires and MaxAge into one single field, only Max-Age field is sent.
Note that multiple cookies are supposed to be sent at once in a single "Set-Cookie" header.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ServerCookieEncoderLax instance that doesn't validate name and valuestatic final ServerCookieEncoderStrict encoder that validates that name and value chars are in the valid scope defined in RFC6265 -
Method Summary
Modifier and TypeMethodDescriptionBatch encodes cookies into Set-Cookie header values.Encodes the specified cookie name-value pair into a Set-Cookie header value.encode(Collection<? extends Cookie> cookies) Batch encodes cookies into Set-Cookie header values.Encodes the specified cookie into a Set-Cookie header value.Batch encodes cookies into Set-Cookie header values.protected voidvalidateCookie(String name, String value)
-
Field Details
-
STRICT
Strict encoder that validates that name and value chars are in the valid scope defined in RFC6265 -
LAX
Lax instance that doesn't validate name and value
-
-
Method Details
-
encode
Encodes the specified cookie name-value pair into a Set-Cookie header value.- Parameters:
name- the cookie namevalue- the cookie value- Returns:
- a single Set-Cookie header value
-
encode
Encodes the specified cookie into a Set-Cookie header value.- Parameters:
cookie- the cookie- Returns:
- a single Set-Cookie header value
-
encode
Batch encodes cookies into Set-Cookie header values.- Parameters:
cookies- a bunch of cookies- Returns:
- the corresponding bunch of Set-Cookie headers
-
encode
Batch encodes cookies into Set-Cookie header values.- Parameters:
cookies- a bunch of cookies- Returns:
- the corresponding bunch of Set-Cookie headers
-
encode
Batch encodes cookies into Set-Cookie header values.- Parameters:
cookies- a bunch of cookies- Returns:
- the corresponding bunch of Set-Cookie headers
-
validateCookie
-