Package org.apache.http.cookie
Interface Cookie
- All Known Subinterfaces:
ClientCookie,SetCookie,SetCookie2
- All Known Implementing Classes:
BasicClientCookie,BasicClientCookie2
public interface Cookie
HTTP "magic-cookie" represents a piece of state information
that the HTTP agent and the target server can exchange to maintain
a session.
- Since:
- 4.0
- Author:
- Oleg Kalnichevski
-
Method Summary
Modifier and Type Method Description StringgetComment()Returns the comment describing the purpose of this cookie, or null if no such comment has been defined.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.StringgetDomain()Returns domain attribute of the cookie.DategetExpiryDate()Returns the expirationDateof the cookie, or null if none exists.StringgetName()Returns the name.StringgetPath()Returns the path attribute of the cookieint[]getPorts()Get the Port attribute.StringgetValue()Returns the value.intgetVersion()Returns the version of the cookie specification to which this cookie conforms.booleanisExpired(Date date)Returns true if this cookie has expired.booleanisPersistent()Returns false if the cookie should be discarded at the end of the "session"; true otherwise.booleanisSecure()Indicates whether this cookie requires a secure connection.
-
Method Details
-
getName
String getName()Returns the name.- Returns:
- String name The name
-
getValue
String getValue()Returns the value.- Returns:
- String value The current value.
-
getComment
String getComment()Returns the comment describing the purpose of this cookie, or null if no such comment has been defined.- Returns:
- comment
-
getCommentURL
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
Date getExpiryDate()Returns the expirationDateof 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.
- Returns:
- Expiration
Date, or null.
-
isPersistent
boolean isPersistent()Returns false if the cookie should be discarded at the end of the "session"; true otherwise.- Returns:
- false if the cookie should be discarded at the end of the "session"; true otherwise
-
getDomain
String getDomain()Returns domain attribute of the cookie.- Returns:
- the value of the domain attribute
-
getPath
String getPath()Returns the path attribute of the cookie- Returns:
- The value of the path attribute.
-
getPorts
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
int getVersion()Returns the version of the cookie specification to which this cookie conforms.- Returns:
- the version of the cookie.
-
isExpired
Returns true if this cookie has expired.- Parameters:
date- Current time- Returns:
- true if the cookie has expired.
-