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
|
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.
|
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-2016 The Netty Project. All Rights Reserved.