public final class ServerCookieEncoder extends CookieEncoder
// ExampleHttpRequest
req = ...; res.setHeader("Cookie",ServerCookieEncoder
.encode("JSESSIONID", "1234"));
ServerCookieDecoder
限定符和类型 | 字段和说明 |
---|---|
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
|
限定符和类型 | 方法和说明 |
---|---|
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.
|
validateCookie
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 cookies