to top
Android APIs
Since: API Level 1
public interface

Cookie

org.apache.http.cookie.Cookie
Known Indirect Subclasses

Class Overview

HTTP "magic-cookie" represents a piece of state information that the HTTP agent and the target server can exchange to maintain a session.

Summary

Public Methods
abstract String getComment()
Returns the comment describing the purpose of this cookie, or null if no such comment has been defined.
abstract 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.
abstract String getDomain()
Returns domain attribute of the cookie.
abstract Date getExpiryDate()
Returns the expiration Date of the cookie, or null if none exists.
abstract String getName()
Returns the name.
abstract String getPath()
Returns the path attribute of the cookie
abstract int[] getPorts()
Get the Port attribute.
abstract String getValue()
Returns the value.
abstract int getVersion()
Returns the version of the cookie specification to which this cookie conforms.
abstract boolean isExpired(Date date)
Returns true if this cookie has expired.
abstract boolean isPersistent()
Returns false if the cookie should be discarded at the end of the "session"; true otherwise.
abstract boolean isSecure()
Indicates whether this cookie requires a secure connection.

Public Methods

public abstract String getComment ()

Since: API Level 1

Returns the comment describing the purpose of this cookie, or null if no such comment has been defined.

Returns
  • comment

public abstract String getCommentURL ()

Since: API Level 1

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.

public abstract String getDomain ()

Since: API Level 1

Returns domain attribute of the cookie.

Returns
  • the value of the domain attribute

public abstract Date getExpiryDate ()

Since: API Level 1

Returns the expiration Date of 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.

public abstract String getName ()

Since: API Level 1

Returns the name.

Returns
  • String name The name

public abstract String getPath ()

Since: API Level 1

Returns the path attribute of the cookie

Returns
  • The value of the path attribute.

public abstract int[] getPorts ()

Since: API Level 1

Get the Port attribute. It restricts the ports to which a cookie may be returned in a Cookie request header.

public abstract String getValue ()

Since: API Level 1

Returns the value.

Returns
  • String value The current value.

public abstract int getVersion ()

Since: API Level 1

Returns the version of the cookie specification to which this cookie conforms.

Returns
  • the version of the cookie.

public abstract boolean isExpired (Date date)

Since: API Level 1

Returns true if this cookie has expired.

Parameters
date Current time
Returns
  • true if the cookie has expired.

public abstract boolean isPersistent ()

Since: API Level 1

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

public abstract boolean isSecure ()

Since: API Level 1

Indicates whether this cookie requires a secure connection.

Returns
  • true if this cookie should only be sent over secure connections, false otherwise.