Package com.teamdev.jxbrowser.cookie
Interface Cookie
public interface Cookie
An HTTP cookie.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault Timestamp
Returns the cookie creation time since UNIX epoch.default String
domain()
Returns a string that represents the domain name of this cookie or an empty string if the domain name for this cookie is not specified.default Timestamp
Returns the cookie expiration time since UNIX epoch.default boolean
Returnstrue
if the cookie is considered HTTP only.default boolean
isSecure()
Returnstrue
if the cookie is restricted to a secure protocol (HTTPS or WSS) orfalse
if it can be sent using any protocol.default String
name()
Returns a string that represents the name of this cookie.static Cookie.Builder
newBuilder
(String domain) Creates a newCookie
builder.default String
path()
Returns a string that represents the path that must exist in the URL of a request in order to send this cookie to the server.default SameSite
sameSite()
Returns the SameSite cookie attribute value.default String
value()
Returns a string that represents the value of this cookie or an empty string if the cookie value is not specified.
-
Method Details
-
newBuilder
Creates a newCookie
builder.- Parameters:
domain
- a domain this cookie belongs too. Please note, that the domain is also required for cookies with__Host
prefix.- Returns:
- a new
Cookie.Builder
instance - Throws:
IllegalArgumentException
- if thedomain
is blank or empty
-
name
Returns a string that represents the name of this cookie.- Returns:
- the name of this cookie
-
value
Returns a string that represents the value of this cookie or an empty string if the cookie value is not specified.- Returns:
- the value of this cookie or an empty string
-
domain
Returns a string that represents the domain name of this cookie or an empty string if the domain name for this cookie is not specified.- Returns:
- the domain name of this cookie or an empty string
-
path
Returns a string that represents the path that must exist in the URL of a request in order to send this cookie to the server. -
isSecure
default boolean isSecure()Returnstrue
if the cookie is restricted to a secure protocol (HTTPS or WSS) orfalse
if it can be sent using any protocol. -
isHttpOnly
default boolean isHttpOnly()Returnstrue
if the cookie is considered HTTP only. It means that the cookie contains theHttpOnly
attribute and should not be accessible from JavaScript. -
creationTime
Returns the cookie creation time since UNIX epoch. The returned value equals the number of milliseconds since January 1, 1970. -
expirationTime
Returns the cookie expiration time since UNIX epoch. The returned value equals the number of milliseconds since January 1, 1970. ReturnsTimestamp.NONE
for session cookies. -
sameSite
Returns the SameSite cookie attribute value.
-