public interface SetCookie extends Cookie
Set-Cookie响应头,以保持会话状态。
请不要使用标记为@Obsolete的方法。 它们被RFC 6265废弃了
| Modifier and Type | Method and Description |
|---|---|
void |
setComment(String comment)
如果用户代理(Web浏览器)向用户显示此Cookie,则将使用此注释描述Cookie的用途。
|
void |
setDomain(String domain)
设置域属性。
|
void |
setExpiryDate(Date expiryDate)
设置到期日。
|
void |
setPath(String path)
设置路径属性。
|
void |
setSecure(boolean secure)
设置cookie的安全属性。
|
void |
setValue(String value) |
void |
setVersion(int version)
设置该cookie符合的cookie规范的版本。
|
getComment, getCommentURL, getDomain, getExpiryDate, getName, getPath, getPorts, getValue, getVersion, isExpired, isPersistent, isSecurevoid setValue(String value)
@Obsolete void setComment(String comment)
comment -
Cookie.getComment()
void setExpiryDate(Date expiryDate)
注意:该方法返回的对象被认为是不可变的。 更改它(例如使用setTime())可能会导致未定义的行为。 这样做是为了你的危险。
expiryDate - Date之后,此Cookie不再有效。
Cookie.getExpiryDate()
void setDomain(String domain)
domain - 域属性的值
Cookie.getDomain()
void setPath(String path)
path - path属性的值
Cookie.getPath()
void setSecure(boolean secure)
当true该cookie只应使用安全协议(https)发送。 只有当cookie的始发服务器使用安全协议来设置cookie的值时,才应设置此值。
secure - 安全属性的值
Cookie.isSecure()
@Obsolete void setVersion(int version)
version - cookie的版本。
Cookie.getVersion()
Copyright © 1999–2017 The Apache Software Foundation. All rights reserved.