public class Cookie
extends java.lang.Object
implements java.io.Serializable
beginXXX()
(to send cookies) or in
endXXX()
methods (to assert returned cookies).Constructor and Description |
---|
Cookie(java.lang.String theDomain,
java.lang.String theName,
java.lang.String theValue)
Create a cookie.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object theObject)
Two cookies match if the name, path and domain match.
|
java.lang.String |
getComment()
Returns the comment describing the purpose of this cookie, or
null if no such comment has been defined.
|
static java.lang.String |
getCookieDomain(WebRequest theRequest,
java.lang.String theRealHost)
Deprecated.
|
static java.lang.String |
getCookiePath(WebRequest theRequest,
java.lang.String theRealPath)
Deprecated.
|
static int |
getCookiePort(WebRequest theRequest,
int theRealPort)
Deprecated.
|
java.lang.String |
getDomain()
Returns the domain of this cookie.
|
java.util.Date |
getExpiryDate()
Return the expiry date.
|
java.lang.String |
getName() |
java.lang.String |
getPath()
Return the path this cookie is associated with.
|
java.lang.String |
getValue() |
int |
hashCode()
Hash up name, value and domain into new hash.
|
boolean |
isExpired() |
boolean |
isSecure() |
boolean |
isToBeDiscarded() |
void |
setComment(java.lang.String theComment)
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 theDomain)
Sets the cookie domain.
|
void |
setExpiryDate(java.util.Date theExpiryDate)
Set the cookie expires date.
|
void |
setName(java.lang.String theName)
Sets the cookie name
|
void |
setPath(java.lang.String thePath)
Sets the cookie path.
|
void |
setSecure(boolean isSecure)
Indicates to the user agent that the cookie should only be sent
using a secure protocol (https).
|
void |
setValue(java.lang.String theValue)
Sets the cookie value
|
java.lang.String |
toString() |
public Cookie(java.lang.String theDomain, java.lang.String theName, java.lang.String theValue)
theDomain
- the cookie domaintheName
- the cookie nametheValue
- the cookie valuepublic void setName(java.lang.String theName)
theName
- the cookie namepublic java.lang.String getName()
public void setValue(java.lang.String theValue)
theValue
- the cookie valuepublic java.lang.String getValue()
public java.lang.String getComment()
public void setComment(java.lang.String theComment)
theComment
- the cookie's text commentpublic java.util.Date getExpiryDate()
public void setExpiryDate(java.util.Date theExpiryDate)
Netscape's original proposal defined an Expires header that took a date value in a fixed-length variant format in place of Max-Age: Wdy, DD-Mon-YY HH:MM:SS GMT Note that the Expires date format contains embedded spaces, and that "old" cookies did not have quotes around values. Clients that implement to this specification should be aware of "old" cookies and Expires.
theExpiryDate
- the expires date.public boolean isToBeDiscarded()
public java.lang.String getDomain()
public void setDomain(java.lang.String theDomain)
theDomain
- the cookie domainpublic java.lang.String getPath()
public void setPath(java.lang.String thePath)
thePath
- the cookie pathpublic boolean isSecure()
public void setSecure(boolean isSecure)
isSecure
- true if the cookie should be sent over secure
connections onlypublic boolean isExpired()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object theObject)
equals
in class java.lang.Object
theObject
- the cookie object to matchpublic java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String getCookieDomain(WebRequest theRequest, java.lang.String theRealHost)
CookieUtil.getCookieDomain(WebRequest, String)
public static int getCookiePort(WebRequest theRequest, int theRealPort)
CookieUtil.getCookiePort(WebRequest, int)
public static java.lang.String getCookiePath(WebRequest theRequest, java.lang.String theRealPath)
CookieUtil.getCookiePath(WebRequest, String)
Copyright © 2000-2004 Apache Software Foundation. All Rights Reserved.