Package org.apache.http.cookie
Interface Cookie
- 
- All Known Subinterfaces:
 ClientCookie,SetCookie,SetCookie2
- All Known Implementing Classes:
 BasicClientCookie,BasicClientCookie2
public interface CookieCookie interface represents a token or short packet of state information (also referred to as "magic-cookie") that the HTTP agent and the target server can exchange to maintain a session. In its simples form an HTTP cookie is merely a name / value pair.Please do not use attributes marked as @Obsolete. They have been rendered obsolete by RFC 6265.
- Since:
 - 4.0
 
 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.StringgetComment()Returns the comment describing the purpose of this cookie, ornullif no such comment has been defined.java.lang.StringgetCommentURL()If a user agent (web browser) presents this cookie to a user, the cookie's purpose will be described by the information at this URL.java.lang.StringgetDomain()Returns domain attribute of the cookie.java.util.DategetExpiryDate()Returns the expirationDateof the cookie, ornullif none exists.java.lang.StringgetName()Returns the name.java.lang.StringgetPath()Returns the path attribute of the cookie.int[]getPorts()Get the Port attribute.java.lang.StringgetValue()Returns the value.intgetVersion()Returns the version of the cookie specification to which this cookie conforms.booleanisExpired(java.util.Date date)Returns true if this cookie has expired.booleanisPersistent()Returnsfalseif the cookie should be discarded at the end of the "session";trueotherwise.booleanisSecure()Indicates whether this cookie requires a secure connection. 
 - 
 
- 
- 
Method Detail
- 
getName
java.lang.String getName()
Returns the name.- Returns:
 - String name The name
 
 
- 
getValue
java.lang.String getValue()
Returns the value.- Returns:
 - String value The current value.
 
 
- 
getComment
@Obsolete java.lang.String getComment()
Returns the comment describing the purpose of this cookie, ornullif no such comment has been defined.- Returns:
 - comment
 
 
- 
getCommentURL
@Obsolete java.lang.String getCommentURL()
If a user agent (web browser) presents this cookie to a user, the cookie's purpose will be described by the information at this URL. 
- 
getExpiryDate
java.util.Date getExpiryDate()
Returns the expirationDateof the cookie, ornullif 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.
- Returns:
 - Expiration 
Date, ornull. 
 
- 
isPersistent
boolean isPersistent()
Returnsfalseif the cookie should be discarded at the end of the "session";trueotherwise.- Returns:
 falseif the cookie should be discarded at the end of the "session";trueotherwise
 
- 
getDomain
java.lang.String getDomain()
Returns domain attribute of the cookie. The value of the Domain attribute specifies the domain for which the cookie is valid.- Returns:
 - the value of the domain attribute.
 
 
- 
getPath
java.lang.String getPath()
Returns the path attribute of the cookie. The value of the Path attribute specifies the subset of URLs on the origin server to which this cookie applies.- Returns:
 - The value of the path attribute.
 
 
- 
getPorts
@Obsolete int[] getPorts()
Get the Port attribute. It restricts the ports to which a cookie may be returned in a Cookie request header. 
- 
isSecure
boolean isSecure()
Indicates whether this cookie requires a secure connection.- Returns:
 trueif this cookie should only be sent over secure connections,falseotherwise.
 
- 
getVersion
@Obsolete int getVersion()
Returns the version of the cookie specification to which this cookie conforms.- Returns:
 - the version of the cookie.
 
 
- 
isExpired
boolean isExpired(java.util.Date date)
Returns true if this cookie has expired.- Parameters:
 date- Current time- Returns:
 trueif the cookie has expired.
 
 - 
 
 -