|
Agent System POND 1.2 (28.2.2002) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--FIM.Util.WWW.Cookies.Cookie
A single cookie. It can be stored to a stream and supports matching the domain and path. Additionally stores also when the cookie was last sent (to allow deleting the least recently used cookie).
Field Summary | |
static int |
COOKIE_SIZE
The maximum size of the name and the value of a cookie together. |
protected String |
domain
The domain of the cookie (from where it was sent; hostname). |
protected Date |
expires
The date when to cookie expires (will be deleted after this time). |
protected Date |
lastSent
The time this cookie was last handed out. |
protected String |
name
The name of the cookie. |
protected String |
path
The path of the cookie (the subset of URLs for which this cookie is valid). |
protected boolean |
secure
Flag to indicate whether the cookie is secure or not (if true it will
only be sent when using a secure communications channel). |
protected boolean |
strict
Whether checking should be done strict (e. g. domain). |
protected String |
value
The value of the cookie. |
Constructor Summary | |
Cookie(String name,
String value,
String path,
String domain,
String expires,
boolean secure)
Creates a new cookie with loose checking. |
|
Cookie(String name,
String value,
String path,
String domain,
String expireString,
boolean secure,
boolean strict)
Creates a new cookie. |
Method Summary | |
protected void |
checkDomainValidity()
Checks whther the domain provided is valid according to the specification or not. |
protected void |
checkString(String str)
Checks wether the string contains ";", "," or a whitespace (" ", \r, \n, \t, \f). |
boolean |
equals(Object obj)
Compares two cookies for equality. |
String |
getDomain()
Retrieve the domain for this cookie. |
Date |
getExpiryDate()
Retrieve the expiry date of the cookie. |
Date |
getLastSent()
Retrieve the date this cookie was last sent. |
String |
getName()
Retrieve the name of this cookie. |
String |
getPath()
Retrieve the path for this cookie. |
String |
getValue()
Retrieve the value of this cookie. |
boolean |
hasExpired()
Retrieve whether this cookie has expired or not. |
int |
hashCode()
Returns a hash code value for the object. |
boolean |
isSecure()
Retrieve whther this cookie is secure (if yes, it will only be handed out over secure connections). |
boolean |
isSessionOnly()
Retrieve whether this is a session-only cookie or not. |
boolean |
matchDomain(String dom)
Checks whether this cookie matches a certain domain. |
boolean |
matchPath(String p)
Checks whether this cookie matches a certain path. |
void |
sentNow()
Update the time this cookie was last sent: It is set to the current time. |
String |
toString()
Returns a string representation of the cookie. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int COOKIE_SIZE
protected String name
protected String value
protected String path
protected String domain
protected Date expires
protected boolean secure
true
it will
only be sent when using a secure communications channel).protected boolean strict
protected Date lastSent
null
it was never sent.Constructor Detail |
public Cookie(String name, String value, String path, String domain, String expireString, boolean secure, boolean strict) throws IllegalArgumentException
name
- the name of the cookie (may not contain ";", "," or whitespace)value
- the value of the cookie (may not contain ";", "," or whitespace)path
- the path of the cookie (null
or "" is changed to "/")domain
- the domain of the cookie (must not be null
or "")expires
- the date the cookie expires (in string form as defined in the cookie definition)secure
- whether it is a secure cookie or notstrict
- if true
checking will be done strict (currently only for checking the domain).IllegalArgumentException
- if the domain is null
or not valid according to the specificationpublic Cookie(String name, String value, String path, String domain, String expires, boolean secure) throws IllegalArgumentException
name
- the name of the cookievalue
- the value of the cookiepath
- the path of the cookiedomain
- the domain of the cookieexpires
- the date the cookie expires (in string form as defined in the cookie definition)secure
- whether it is a secure cookie or notIllegalArgumentException
- if the domain is null
or not valid according to the specificationMethod Detail |
public String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
obj
- the reference object with which to comparetrue
if this object is the same as the obj argumentpublic boolean matchDomain(String dom)
dom
- the domain to matchtrue
if the domain of the cookie matches the parameterpublic boolean matchPath(String p)
p
- the path to match (null
or "" is interpreted as "/" )true
if the path of the cookie matches the parameterprotected void checkString(String str) throws IllegalArgumentException
str
- the string to checkIllegalArgumentException
- if an unallowed character is in the stringprotected void checkDomainValidity() throws IllegalArgumentException
true
if the domain in validCookie(String,String,String,String,String,boolean,boolean)
,
Cookie(String,String,String,String,String,boolean)
public boolean hasExpired()
true
if the cookie has expiredpublic boolean isSessionOnly()
true
if the cookie expires with the sessionpublic String getName()
public String getValue()
public String getPath()
public String getDomain()
public Date getExpiryDate()
null
if it is a session cookiepublic boolean isSecure()
true
if the cookie is marked as securepublic Date getLastSent()
null
if never sent)public void sentNow()
|
Agent System POND 1.2 (28.2.2002) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |