public class BasicClientCookie extends Object implements SetCookie, ClientCookie, Cloneable, Serializable
SetCookie 。
COMMENT_ATTR, COMMENTURL_ATTR, DISCARD_ATTR, DOMAIN_ATTR, EXPIRES_ATTR, MAX_AGE_ATTR, PATH_ATTR, PORT_ATTR, SECURE_ATTR, VERSION_ATTR| Constructor and Description |
|---|
BasicClientCookie(String name, String value)
默认构造函数取名字和值。
|
| Modifier and Type | Method and Description |
|---|---|
Object |
clone() |
boolean |
containsAttribute(String name) |
String |
getAttribute(String name) |
String |
getComment()
返回描述此cookie的目的的注释,如果没有定义此类注释,
null 。
|
String |
getCommentURL()
返回null。
|
Date |
getCreationDate() |
String |
getDomain()
返回cookie的域属性。
|
Date |
getExpiryDate()
返回cookie的到期 Date ,如果不存在, null 。
|
String |
getName()
返回名称。
|
String |
getPath()
返回cookie的路径属性
|
int[] |
getPorts()
返回null。
|
String |
getValue()
返回值。
|
int |
getVersion()
返回此cookie符合的cookie规范的版本。
|
boolean |
isExpired(Date date)
如果此cookie已过期,则返回true。
|
boolean |
isPersistent()
返回 false如果cookie应该在“会话”结尾处丢弃;
true否则。
|
boolean |
isSecure()
指示此Cookie是否需要安全连接。
|
boolean |
removeAttribute(String name) |
void |
setAttribute(String name, String value) |
void |
setComment(String comment)
如果用户代理(Web浏览器)向用户显示此Cookie,则将使用此注释描述Cookie的用途。
|
void |
setCreationDate(Date creationDate) |
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规范的版本。
|
String |
toString() |
public String getComment()
null 。
getComment在接口
Cookie
setComment(String)
public void setComment(String comment)
setComment在接口
SetCookie
comment -
getComment()
public String getCommentURL()
getCommentURL在接口
Cookie
public Date getExpiryDate()
Date ,如果不存在, null 。
注意:该方法返回的对象被认为是不可变的。 更改它(例如使用setTime())可能会导致未定义的行为。 这样做是为了你的危险。
getExpiryDate在接口
Cookie
Date或null 。
setExpiryDate(java.util.Date)
public void setExpiryDate(Date expiryDate)
注意:该方法返回的对象被认为是不可变的。 更改它(例如使用setTime())可能会导致未定义的行为。 这样做是为了你的危险。
setExpiryDate在接口
SetCookie
expiryDate - Date之后,此Cookie不再有效。
getExpiryDate()
public boolean isPersistent()
false如果cookie应该在“会话”结尾处丢弃;
true否则。
isPersistent在接口
Cookie
false如果cookie应该在“会话”结束时被丢弃;
true否则
public String getDomain()
getDomain在接口
Cookie
setDomain(java.lang.String)
public void setDomain(String domain)
setDomain在接口
SetCookie
domain - 域属性的值
getDomain()
public String getPath()
getPath在接口
Cookie
setPath(java.lang.String)
public void setPath(String path)
public boolean isSecure()
Cookie复制
isSecure在接口
Cookie
true如果这个cookie只能通过安全连接发送。
setSecure(boolean)
public void setSecure(boolean secure)
当true该cookie只应使用安全协议(https)发送。 只有当cookie的始发服务器使用安全协议来设置cookie的值时,才应设置此值。
setSecure在接口
SetCookie
secure - 安全属性的值
isSecure()
public int getVersion()
getVersion在接口
Cookie
setVersion(int)
public void setVersion(int version)
setVersion在接口
SetCookie
version - cookie的版本。
getVersion()
public boolean isExpired(Date date)
public Date getCreationDate()
public void setCreationDate(Date creationDate)
public String getAttribute(String name)
getAttribute在接口
ClientCookie
public boolean containsAttribute(String name)
containsAttribute在接口
ClientCookie
public boolean removeAttribute(String name)
public Object clone() throws CloneNotSupportedException
clone在
Object类
CloneNotSupportedException
Copyright © 1999–2017 The Apache Software Foundation. All rights reserved.