public final class ServerCookieEncoder extends CookieEncoder
// ExampleHttpRequest
req = ...; res.setHeader("Cookie",ServerCookieEncoder
.encode("JSESSIONID", "1234"));
ServerCookieDecoder
Modifier and Type | Field and Description |
---|---|
static ServerCookieEncoder |
LAX
Lax instance that doesn't validate name and value, and that allows multiple
cookies with the same name.
|
static ServerCookieEncoder |
STRICT
Strict encoder that validates that name and value chars are in the valid scope
defined in RFC6265, and (for methods that accept multiple cookies) that only
one cookie is encoded with any given name.
|
strict
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.
|
validateCookie
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 cookiesCopyright © 2008–2017 The Netty Project. All rights reserved.