public final class ServerCookieEncoder extends 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 |
---|---|
List<String> |
encode(Collection<? extends Cookie> cookies)
Batch encodes cookies into Set-Cookie header values.
|
List<String> |
encode(Cookie... cookies)
Batch encodes cookies into Set-Cookie header values.
|
String |
encode(Cookie cookie)
Encodes the specified cookie into a Set-Cookie header value.
|
List<String> |
encode(Iterable<? extends Cookie> cookies)
Batch encodes cookies into Set-Cookie header values.
|
String |
encode(String name,
String value)
Encodes the specified cookie name-value pair into a Set-Cookie header value.
|
protected void |
validateCookie(String name,
String value) |
public static final ServerCookieEncoder STRICT
public static final ServerCookieEncoder LAX
public String encode(String name, String value)
name
- the cookie namevalue
- the cookie valuepublic String encode(Cookie cookie)
cookie
- the cookiepublic List<String> encode(Cookie... cookies)
cookies
- a bunch of cookiespublic List<String> encode(Collection<? extends Cookie> cookies)
cookies
- a bunch of cookiespublic List<String> encode(Iterable<? extends Cookie> cookies)
cookies
- a bunch of cookies