public final class Cookies extends Object
| Modifier and Type | Method and Description |
|---|---|
static Cookie |
cookie(String name,
String value)
Create cookie with a name and a value, all other parameters will
use the default values:
The webapp path is initialized with
"src/main/webapp"
The path is initialized with "/"
The port is initialized with zero.
The cookie is not secured.
The cookie is not http-only.
The cookie max-age is null.
. |
static Cookie |
cookie(String name,
String value,
String domain,
String path,
Long expires,
Long maxAge,
boolean secure,
boolean httpOnly)
Create cookie.
|
static Cookie |
read(String rawValue)
Create a cookie from header value.
|
static Cookie |
secureCookie(String name,
String value,
String domain,
String path,
Long expires,
Long maxAge)
Create a secured cookie, it means that cookie will have
secure flag and http only flag set to true.
|
static String |
serialize(Iterable<Cookie> cookies)
Serialize cookies as a string that is ready to be sent to a server over an HTTP
request (a.k.a value of
Cookie header). |
static Cookie |
sessionCookie(String name,
String value,
String domain,
String path)
Create a session cookie, it means that cookie will have
secure flag and http only flag set to true and expires / max age values
are set to zero.
|
public static Cookie cookie(String name, String value)
"src/main/webapp""/"null.name - Cookie name.value - Cookie value.NullPointerException - if name or value is null.IllegalArgumentException - if name is empty or blank.public static Cookie cookie(String name, String value, String domain, String path, Long expires, Long maxAge, boolean secure, boolean httpOnly)
name - Cookie name.value - Cookie value.domain - Cookie domain.path - Cookie path.expires - Cookie expires value.maxAge - Cookie max age value.secure - Secure flag.httpOnly - Http flag.NullPointerException - if name or value is null.IllegalArgumentException - if name is empty or blank.public static Cookie secureCookie(String name, String value, String domain, String path, Long expires, Long maxAge)
name - Cookie name.value - Cookie value.domain - Cookie domain.path - Cookie path.expires - Cookie expires value.maxAge - Cookie max age.NullPointerException - if name or value is null.IllegalArgumentException - if name is empty or blank.public static Cookie sessionCookie(String name, String value, String domain, String path)
name - Cookie name.value - Cookie value.domain - Cookie domain.path - Cookie path.NullPointerException - if name or value is null.IllegalArgumentException - if name is empty or blank.public static Cookie read(String rawValue)
rawValue - Header value.Copyright © 2019. All rights reserved.