public final class ServerCookieEncoder
extends java.lang.Object
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.
ServerCookieDecoder
Modifier and Type | Field and Description |
---|---|
static ServerCookieEncoder |
LAX
Lax instance that doesn't validate name and value
|
static ServerCookieEncoder |
STRICT
Strict encoder that validates that name and value chars are in the valid scope defined in
RFC6265
|
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
encode(java.util.Collection<? extends Cookie> cookies)
Batch encodes cookies into Set-Cookie header values.
|
java.util.List<java.lang.String> |
encode(Cookie... cookies)
Batch encodes cookies into Set-Cookie header values.
|
java.lang.String |
encode(Cookie cookie)
Encodes the specified cookie into a Set-Cookie header value.
|
java.util.List<java.lang.String> |
encode(java.lang.Iterable<? extends Cookie> cookies)
Batch encodes cookies into Set-Cookie header values.
|
java.lang.String |
encode(java.lang.String name,
java.lang.String value)
Encodes the specified cookie name-value pair into a Set-Cookie header value.
|
protected void |
validateCookie(java.lang.String name,
java.lang.String value) |
public static final ServerCookieEncoder STRICT
public static final ServerCookieEncoder LAX
public java.lang.String encode(java.lang.String name, java.lang.String value)
name
- the cookie namevalue
- the cookie valuepublic java.lang.String encode(Cookie cookie)
cookie
- the cookiepublic java.util.List<java.lang.String> encode(Cookie... cookies)
cookies
- a bunch of cookiespublic java.util.List<java.lang.String> encode(java.util.Collection<? extends Cookie> cookies)
cookies
- a bunch of cookiespublic java.util.List<java.lang.String> encode(java.lang.Iterable<? extends Cookie> cookies)
cookies
- a bunch of cookiesprotected void validateCookie(java.lang.String name, java.lang.String value)