Class ClientCookieEncoder
java.lang.Object
io.netty.handler.codec.http.cookie.CookieEncoder
io.netty.handler.codec.http.cookie.ClientCookieEncoder
A RFC6265 compliant cookie encoder to be used client side, so
only name=value pairs are sent.
Note that multiple cookies are supposed to be sent at once in a single "Cookie" header.
// ExampleHttpRequest
req = ...; res.setHeader("Cookie",ClientCookieEncoder
.encode("JSESSIONID", "1234"));
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final Comparator
<Cookie> Sort cookies into decreasing order of path length, breaking ties by sorting into increasing chronological order of creation time, as recommended by RFC 6265.static final ClientCookieEncoder
Lax instance that doesn't validate name and value, and (for methods that accept multiple cookies) keeps cookies in the order in which they were given.static final ClientCookieEncoder
Strict encoder that validates that name and value chars are in the valid scope and (for methods that accept multiple cookies) sorts cookies into order of decreasing path length, as specified in RFC6265.Fields inherited from class io.netty.handler.codec.http.cookie.CookieEncoder
strict
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEncodes the specified cookie into a Cookie header value.Encodes the specified cookies into a single Cookie header value.Encodes the specified cookies into a single Cookie header value.private void
encode
(StringBuilder buf, Cookie c) Encodes the specified cookie into a Cookie header value.encode
(Collection<? extends Cookie> cookies) Encodes the specified cookies into a single Cookie header value.Methods inherited from class io.netty.handler.codec.http.cookie.CookieEncoder
validateCookie
-
Field Details
-
STRICT
Strict encoder that validates that name and value chars are in the valid scope and (for methods that accept multiple cookies) sorts cookies into order of decreasing path length, as specified in RFC6265. -
LAX
Lax instance that doesn't validate name and value, and (for methods that accept multiple cookies) keeps cookies in the order in which they were given. -
COOKIE_COMPARATOR
Sort cookies into decreasing order of path length, breaking ties by sorting into increasing chronological order of creation time, as recommended by RFC 6265.
-
-
Constructor Details
-
ClientCookieEncoder
private ClientCookieEncoder(boolean strict)
-
-
Method Details
-
encode
Encodes the specified cookie into a Cookie header value.- Parameters:
name
- the cookie namevalue
- the cookie value- Returns:
- a Rfc6265 style Cookie header value
-
encode
Encodes the specified cookie into a Cookie header value.- Parameters:
cookie
- the specified cookie- Returns:
- a Rfc6265 style Cookie header value
-
encode
Encodes the specified cookies into a single Cookie header value.- Parameters:
cookies
- some cookies- Returns:
- a Rfc6265 style Cookie header value, null if no cookies are passed.
-
encode
Encodes the specified cookies into a single Cookie header value.- Parameters:
cookies
- some cookies- Returns:
- a Rfc6265 style Cookie header value, null if no cookies are passed.
-
encode
Encodes the specified cookies into a single Cookie header value.- Parameters:
cookies
- some cookies- Returns:
- a Rfc6265 style Cookie header value, null if no cookies are passed.
-
encode
-