public interface SetCookie extends Cookie
Set-Cookie
response header sent by the
origin server to the HTTP agent in order to maintain a conversational state.DOMAIN_ATTR, EXPIRES_ATTR, HTTP_ONLY_ATTR, MAX_AGE_ATTR, PATH_ATTR, SECURE_ATTR
Modifier and Type | Method and Description |
---|---|
void |
setDomain(String domain)
Sets the domain attribute.
|
void |
setExpiryDate(Date expiryDate)
Deprecated.
Use {
setExpiryDate(Instant) } |
default void |
setExpiryDate(Instant expiryDate)
Sets expiration date.
|
default void |
setHttpOnly(boolean httpOnly)
Marks or unmarks this Cookie as
httpOnly . |
void |
setPath(String path)
Sets the path attribute.
|
void |
setSecure(boolean secure)
Sets the secure attribute of the cookie.
|
void |
setValue(String value) |
containsAttribute, getAttribute, getCreationDate, getCreationInstant, getDomain, getExpiryDate, getExpiryInstant, getName, getPath, getValue, isExpired, isExpired, isHttpOnly, isPersistent, isSecure
void setValue(String value)
@Deprecated void setExpiryDate(Date expiryDate)
setExpiryDate(Instant)
}Note: the object returned by this method is considered immutable. Changing it (e.g. using setTime()) could result in undefined behaviour. Do so at your peril.
expiryDate
- the Date
after which this cookie is no longer valid.Cookie.getExpiryDate()
default void setExpiryDate(Instant expiryDate)
Note: the object returned by this method is considered immutable. Changing it (e.g. using setTime()) could result in undefined behaviour. Do so at your peril.
expiryDate
- the Instant
after which this cookie is no longer valid.Cookie.getExpiryInstant()
void setDomain(String domain)
domain
- The value of the domain attributeCookie.getDomain()
void setPath(String path)
path
- The value of the path attributeCookie.getPath()
void setSecure(boolean secure)
When true
the cookie should only be sent
using a secure protocol (https). This should only be set when
the cookie's originating server used a secure protocol to set the
cookie's value.
secure
- The value of the secure attributeCookie.isSecure()
default void setHttpOnly(boolean httpOnly)
httpOnly
.httpOnly
- true if this cookie is to be marked as
httpOnly
, false otherwiseCopyright © 1999–2021 The Apache Software Foundation. All rights reserved.