getMaxAge()
:
Number
Returns the maximum age of the cookie, specified in seconds.
getSecure()
:
boolean
Identifies if the cookie is secure.
isHttpOnly()
:
boolean
Identifies if the cookie is http-only.
setComment(comment
:
String)
:
void
Sets the comment associated with the cookie.
setDomain(domain
:
String)
:
void
Sets the domain associated with the cookie.
setHttpOnly(httpOnly
:
boolean)
:
void
Sets the http-only state for the cookie.
setMaxAge(age
:
Number)
:
void
Sets the maximum age of the cookie in seconds.
setSecure(secure
:
boolean)
:
void
Sets the secure state for the cookie.
getComment
Returns the comment associated with the cookie.
Returns:
the comment associated with the cookie.
getDomain
Returns the domain associated with the cookie.
Returns:
the domain associated with the cookie.
getMaxAge
Returns the maximum age of the cookie, specified in seconds.
By default, -1 indicating the cookie will persist until client shutdown.
Returns:
an integer specifying the maximum age of the cookie in seconds; if negative, means the cookie persists until client shutdown
getName
Returns the cookie's name.
Returns:
the cookie's name.
getPath
Returns the path for the cookie.
Returns:
the path for the cookie.
getSecure
getSecure()
:
boolean
Identifies if the cookie is secure.
Returns:
true if the cookie is secure, false otherwise.
getValue
Returns the cookie's value.
Returns:
the cookie's value.
getVersion
Returns the version for the cookie. 0 means original Netscape cookie and
1 means RFC 2109 compliant cookie.
Returns:
the version for the cookie.
isHttpOnly
isHttpOnly()
:
boolean
Identifies if the cookie is http-only.
Returns:
true if the cookie is http-only, false otherwise.
setComment
setComment(comment
:
String)
:
void
Sets the comment associated with the cookie.
Setting a comment automatically changes the cookie to be a RFC 2109
(set-cookie2) compliant cookie, because comments are only supported with
RFC cookies and not with Netscapes original cookie.
Parameters:
comment
-
the comment associated with the cookie.
setDomain
setDomain(domain
:
String)
:
void
Sets the domain associated with the cookie.
Parameters:
domain
-
the comment associated with the cookie.
setHttpOnly
setHttpOnly(httpOnly
:
boolean)
:
void
Sets the http-only state for the cookie.
Parameters:
httpOnly
-
sets http-only state for the cookie.
setMaxAge
setMaxAge(age
:
Number)
:
void
Sets the maximum age of the cookie in seconds.
A positive value indicates that the cookie will expire after that many
seconds have passed. Note that the value is the maximum age when the
cookie will expire, not the cookie's current age.
A negative value means that the cookie is not stored persistently and
will be deleted when the client exits. A zero value causes the
cookie to be deleted.
Parameters:
age
-
an integer specifying the maximum age of the cookie in seconds; if negative, means the cookie is not stored; if zero, deletes the cookie
setPath
Sets the path for the cookie.
Parameters:
path
-
the path for the cookie.
setSecure
setSecure(secure
:
boolean)
:
void
Sets the secure state for the cookie.
Parameters:
secure
-
sets secure state for the cookie.
setValue
setValue(value
:
String)
:
void
Sets the cookie's value.
Parameters:
value
-
the value to set in the cookie.
setVersion
setVersion(version
:
Number)
:
void
Sets the version for the cookie. 0 means original Netscape cookie and
1 means RFC 2109 compliant cookie. The default is 0.
Parameters:
version
-
the version for the cookie.