|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sonalb.net.http.cookie.Cookie
public class Cookie
The data structure representing a cookie. Supports both Netscape (Version 0) and RFC2965 (Version 1) cookies. The fields common to both these versions are listed below:
Constructor Summary | |
---|---|
Cookie(java.lang.String name,
java.lang.String value,
java.lang.String domain,
java.lang.String path)
Creates cookie instance. |
|
Cookie(java.lang.String name,
java.lang.String value,
java.net.URL requestURL)
Creates cookie instance. |
Method Summary | |
---|---|
java.lang.Object |
clone()
|
int |
compareTo(java.lang.Object o)
Compares one Cookie with another. |
boolean |
equals(java.lang.Object obj)
Checks whether two cookies are equal. |
java.lang.String |
getComment()
Gets the comment for this cookie. |
java.net.URL |
getCommentURL()
Gets the comment URL for this cookie. |
java.lang.String |
getDomain()
Gets the domain in which this cookie is valid. |
java.util.Date |
getExpires()
Gets the date-time when this cookie expires. |
int |
getMaxAge()
Gets the amount of time this Cookie is valid, measured in seconds from the time the value was set. |
java.lang.String |
getName()
Gets the name of this cookie. |
java.lang.String |
getPath()
Gets the path for this cookie. |
java.lang.String |
getPortList()
Gets the list of ports to which this cookie can be sent. |
java.lang.String |
getValue()
Gets the value of this cookie. |
java.lang.String |
getVersion()
Gets the version of this Cookie. |
boolean |
hasExpired()
Checks whether this cookie's lifetime has expired or not. |
boolean |
hasExpired(java.util.Date d)
Checks whether this cookie's lifetime has expired or not. |
boolean |
isDiscardable()
Checks whether this cookie can be discarded once the session is over. |
boolean |
isSecure()
Checks whether this cookie will be sent over secure channels only. |
void |
setComment(java.lang.String comment)
Sets the comment for this cookie. |
void |
setCommentURL(java.net.URL url)
Sets the comment URL for this cookie. |
void |
setDiscard(boolean bDiscard)
Sets the discard status of this cookie. |
void |
setDomain(java.lang.String domain)
Sets the domain for this Cookie. |
void |
setDomain(java.net.URL requestURL)
Sets the domain for this Cookie. |
void |
setExpires(java.util.Date expires)
Sets the date-time when this cookie expires. |
void |
setMaxAge(int maxage)
Sets the lifetime of this Cookie. |
void |
setMaxAge(int maxage,
java.util.Date base)
Sets the lifetime of this Cookie. |
void |
setName(java.lang.String name)
Sets the Cookie name. |
void |
setPath(java.lang.String path)
Sets the path for this Cookie. |
void |
setPath(java.net.URL requestURL)
Sets the path for this Cookie. |
void |
setPort(int p)
Sets the port to which this cookie can be sent. |
void |
setPort(java.net.URL url)
Sets the port to which this cookie can be sent. |
void |
setPortList(int[] ports)
Sets the list of ports to which this Cookie can be sent. |
void |
setSecure(boolean bSecure)
Sets whether this cookie should be sent only over secure channels. |
void |
setValue(java.lang.String value)
Sets the Cookie value. |
void |
setVersion(java.lang.String version)
Sets the Cookie version. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Cookie(java.lang.String name, java.lang.String value, java.lang.String domain, java.lang.String path)
name
- the Cookie namevalue
- the Cookie valuedomain
- the domain in which this Cookie is validpath
- the path for this Cookiepublic Cookie(java.lang.String name, java.lang.String value, java.net.URL requestURL)
name
- the Cookie namevalue
- the Cookie valuerequestURL
- the request URL which resulted in this cookie being receivedMethod Detail |
---|
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
public void setName(java.lang.String name)
name
- the Cookie namepublic void setValue(java.lang.String value)
value
- the Cookie valuepublic void setMaxAge(int maxage)
maxage
- the number of seconds from now that this Cookie is valid (delta-t)
java.lang.UnsupportedOperationException
- when called on a Version 0 cookiepublic void setMaxAge(int maxage, java.util.Date base)
maxage
- the number of seconds from base that this Cookie is valid (delta-t)base
- the Date from which the delta-t should be counted
java.lang.UnsupportedOperationException
- when called on a Version 0 cookiepublic int getMaxAge()
java.lang.UnsupportedOperationException
- if this method is called on a Version 0 cookiepublic void setExpires(java.util.Date expires)
expires
- the Date when this cookie expires
java.lang.UnsupportedOperationException
- when called on a Version 1 cookiepublic void setVersion(java.lang.String version)
version
- the Cookie version. Either "0" or "1"public java.lang.String getVersion()
public void setPath(java.lang.String path)
path
- the Path for this Cookiepublic void setPath(java.net.URL requestURL)
requestURL
- the request URL which caused this Cookie to be sent.public void setDomain(java.lang.String domain)
domain
- the Cookie domainpublic void setDomain(java.net.URL requestURL)
requestURL
- the request URL which caused this cookie to be sentpublic void setPortList(int[] ports)
ports
- the valid ports as array of int; non-positive values ignored
UnsupportedException
- when called on a Version 0 cookiepublic void setPort(int p)
p
- the Port
java.lang.UnsupportedOperationException
- when called on a Version 0 cookiepublic void setPort(java.net.URL url)
url
- the request URL
java.lang.UnsupportedOperationException
- when called on a Version 0 cookiepublic java.lang.String getPortList()
java.lang.UnsupportedOperationException
- when called on a Version 0 cookiepublic void setSecure(boolean bSecure)
bSecure
- secure or not ?public java.lang.String getName()
public java.lang.String getValue()
public java.lang.String getComment()
public void setComment(java.lang.String comment)
comment
- the commentpublic void setCommentURL(java.net.URL url)
url
- the URLpublic java.net.URL getCommentURL()
public java.util.Date getExpires()
public boolean isDiscardable()
public void setDiscard(boolean bDiscard)
bDiscard
- discardable or not ?
java.lang.UnsupportedOperationException
- when called on a Version 0 cookiepublic java.lang.String getDomain()
public java.lang.String getPath()
public boolean isSecure()
public boolean hasExpired()
public boolean hasExpired(java.util.Date d)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
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 |