|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.http.cookie.Cookie
public class Cookie
HTTP "magic-cookie" represents a piece of state information that the HTTP agent and the target server can exchange to maintain a session.
Constructor Summary | |
---|---|
Cookie(java.lang.String name,
java.lang.String value)
Default Constructor taking a name and a value. |
Method Summary | |
---|---|
java.lang.String |
getComment()
Returns the comment describing the purpose of this cookie, or null if no such comment has been defined. |
java.lang.String |
getDomain()
Returns domain attribute of the cookie. |
java.util.Date |
getExpiryDate()
Returns the expiration Date of the cookie, or null
if none exists. |
java.lang.String |
getName()
Returns the name. |
java.lang.String |
getPath()
Returns the path attribute of the cookie |
java.lang.String |
getValue()
Returns the value. |
int |
getVersion()
Returns the version of the cookie specification to which this cookie conforms. |
boolean |
isDomainAttributeSpecified()
Returns true if cookie's domain was set via a domain attribute in the Set-Cookie header. |
boolean |
isExpired(java.util.Date date)
Returns true if this cookie has expired. |
boolean |
isPathAttributeSpecified()
Returns true if cookie's path was set via a path attribute in the Set-Cookie header. |
boolean |
isPersistent()
Returns false if the cookie should be discarded at the end of the "session"; true otherwise. |
boolean |
isSecure()
|
void |
setComment(java.lang.String comment)
If a user agent (web browser) presents this cookie to a user, the cookie's purpose will be described using this comment. |
void |
setDomain(java.lang.String domain)
Sets the domain attribute. |
void |
setDomainAttributeSpecified(boolean value)
Indicates whether the cookie had a domain specified in a domain attribute of the Set-Cookie header. |
void |
setExpiryDate(java.util.Date expiryDate)
Sets expiration date. |
void |
setPath(java.lang.String path)
Sets the path attribute. |
void |
setPathAttributeSpecified(boolean value)
Indicates whether the cookie had a path specified in a path attribute of the Set-Cookie header. |
void |
setSecure(boolean secure)
Sets the secure attribute of the cookie. |
void |
setVersion(int version)
Sets the version of the cookie specification to which this cookie conforms. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Cookie(java.lang.String name, java.lang.String value)
name
- The name.value
- The value.Method Detail |
---|
public java.lang.String getName()
public java.lang.String getValue()
public java.lang.String getComment()
setComment(String)
public void setComment(java.lang.String comment)
comment
- getComment()
public java.util.Date getExpiryDate()
Date
of the cookie, or null
if none exists.
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.
Date
, or null.setExpiryDate(java.util.Date)
public void setExpiryDate(java.util.Date 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 Date
after which this cookie is no longer valid.getExpiryDate()
public boolean isPersistent()
public java.lang.String getDomain()
setDomain(java.lang.String)
public void setDomain(java.lang.String domain)
domain
- The value of the domain attributegetDomain()
public java.lang.String getPath()
setPath(java.lang.String)
public void setPath(java.lang.String path)
path
- The value of the path attributegetPath()
public boolean isSecure()
true
if this cookie should only be sent over secure connections.setSecure(boolean)
public 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 attributeisSecure()
public int getVersion()
setVersion(int)
public void setVersion(int version)
version
- the version of the cookie.getVersion()
public boolean isExpired(java.util.Date date)
date
- Current time
public void setPathAttributeSpecified(boolean value)
value
- true if the cookie's path was explicitly
set, false otherwise.isPathAttributeSpecified()
public boolean isPathAttributeSpecified()
setPathAttributeSpecified(boolean)
public void setDomainAttributeSpecified(boolean value)
value
- true if the cookie's domain was explicitly
set, false otherwise.isDomainAttributeSpecified()
public boolean isDomainAttributeSpecified()
setDomainAttributeSpecified(boolean)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |