Class Cookie
java.lang.Object
com.github.mjeanroy.junit.servers.client.Cookie
Default implementation for cookie object.
To build a cookie, use:
Using the builder is easy:
To build a cookie, use:
- The
Cookie.Builder
API - Or one of the static factories in
Cookies
class
Using the builder is easy:
Cookie cookie = new Cookie.Builder("name", "value")
.domain("domain")
.path("path")
.secure(true) // Defaults to false.
.httpOnly(true) // Defaults to false.
.maxAge(3600)
.expires(tt.getTime())
.build();
You can also use one of the static factories:
Cookie c1 = Cookies.cookie("name", "value");
Cookie c2 = Cookies.cookie("name", "value", "domain", "path", maxAge, expires, true, true);
-
Nested Class Summary
Nested Classes -
Method Summary
-
Method Details
-
getName
Get cookie name.- Returns:
- Cookie name.
-
getValue
Get cookie value.- Returns:
- Cookie value.
-
getDomain
Get cookie domain.- Returns:
- Cookie domain.
-
getPath
Get cookie path.- Returns:
- Cookie path.
-
getExpires
Get cookie expires value. The value is a timestamp. If value is lower than zero, it means that expires value has not been set on cookie.- Returns:
- Expires value.
-
getMaxAge
Cookie max age. This is the max validity time in seconds.- Returns:
- Max age value.
-
isSecure
public boolean isSecure()Cookie secure flag.- Returns:
- Secure flag.
-
isHttpOnly
public boolean isHttpOnly()Cookie http-only flag.- Returns:
- Http-Only flag.
-
equals
-
hashCode
public int hashCode() -
toString
-