@Internal public final class ServerCookieEncoder extends CookieEncoder
// Example
HttpResponse res = ...;
res.setHeader("Set-Cookie", ServerCookieEncoder
.encode("JSESSIONID", "1234"));
Note: Forked from Netty `io.netty.handler.codec.http.cookie.ServerCookieEncoder`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 |
---|---|
java.util.List<java.lang.String> |
encode(java.util.Collection<? extends io.micronaut.http.cookie.Cookie> cookies)
Batch encodes cookies into Set-Cookie header values.
|
java.util.List<java.lang.String> |
encode(io.micronaut.http.cookie.Cookie... cookies)
Batch encodes cookies into Set-Cookie header values.
|
java.lang.String |
encode(io.micronaut.http.cookie.Cookie cookie)
Encodes the specified cookie into a Set-Cookie header value.
|
java.util.List<java.lang.String> |
encode(java.lang.Iterable<? extends io.micronaut.http.cookie.Cookie> cookies)
Batch encodes cookies into Set-Cookie header values.
|
validateCookie
public static final ServerCookieEncoder STRICT
public static final ServerCookieEncoder LAX
public java.lang.String encode(io.micronaut.http.cookie.Cookie cookie)
cookie
- the cookiepublic java.util.List<java.lang.String> encode(io.micronaut.http.cookie.Cookie... cookies)
cookies
- a bunch of cookiespublic java.util.List<java.lang.String> encode(java.util.Collection<? extends io.micronaut.http.cookie.Cookie> cookies)
cookies
- a bunch of cookiespublic java.util.List<java.lang.String> encode(java.lang.Iterable<? extends io.micronaut.http.cookie.Cookie> cookies)
cookies
- a bunch of cookies