public class Cookie

  1. Object
  2. Cookie

ImplementsExternalizable

A cookie for an HTTP request

Fields

public static final String STORAGE_NAME = "Cookies"

Constructors

public Cookie()

Methods

public static boolean isAutoStored()Returns true if the Cookies are auto stored to storage
public static void setAutoStored(boolean autoStored)This method configures the auto storage of cookies
public static void clearCookiesFromStorage()Clears all cookies history from storage
public String getName()
public void setName(String name)
public boolean isSecure()
public void setSecure(boolean secure)
public boolean isHttpOnly()
public void setHttpOnly(boolean httpOnly)
public String getPath()
public void setPath(String path)
public String getValue()
public void setValue(String value)
public String getDomain()
public void setDomain(String domain)
public long getExpires()
public void setExpires(long expires)
public int getVersion()Returns the version for the current persistance code, the version will be pased to internalized thus allowing the internalize method to recognize classes persisted in older revisions
public void externalize(DataOutputStream out) throws IOExceptionAllows us to store an object state, this method must be implemented in order to save the state of an object
public void internalize(int version, DataInputStream in) throws IOExceptionLoads the object from the input stream and allows deserialization
public String getObjectId()The object id must be unique, it is used to identify the object when loaded even when it is obfuscated.
public String toString()Returns a string representation of the object.

Inherited methods

Field details

STORAGE_NAME

public static final String STORAGE_NAME = "Cookies"

Constructor details

Cookie

public Cookie()

Method details

isAutoStored

public static boolean isAutoStored()
Returns true if the Cookies are auto stored to storage

Returns

autoStored

setAutoStored

public static void setAutoStored(boolean autoStored)
This method configures the auto storage of cookies

clearCookiesFromStorage

public static void clearCookiesFromStorage()
Clears all cookies history from storage

getName

public String getName()

Returns

the name

setName

public void setName(String name)

Parameters

name String
the name to set

isSecure

public boolean isSecure()

setSecure

public void setSecure(boolean secure)

isHttpOnly

public boolean isHttpOnly()

setHttpOnly

public void setHttpOnly(boolean httpOnly)

getPath

public String getPath()

setPath

public void setPath(String path)

getValue

public String getValue()

Returns

the value

setValue

public void setValue(String value)

Parameters

value String
the value to set

getDomain

public String getDomain()

Returns

the domain

setDomain

public void setDomain(String domain)

Parameters

domain String
the domain to set

getExpires

public long getExpires()

Returns

the expires

setExpires

public void setExpires(long expires)

Parameters

expires long
the expires to set

getVersion

public int getVersion()
Returns the version for the current persistance code, the version will be pased to internalized thus allowing the internalize method to recognize classes persisted in older revisions

Returns

version number for the persistant code

externalize

public void externalize(DataOutputStream out) throws IOException
Allows us to store an object state, this method must be implemented in order to save the state of an object

Parameters

out DataOutputStream
the stream into which the object must be serialized

Throws

java.io.IOException
the method may throw an exception

internalize

public void internalize(int version, DataInputStream in) throws IOException
Loads the object from the input stream and allows deserialization

Parameters

version int
the version the class returned during the externalization processs
in DataInputStream
the input stream used to load the class

Throws

java.io.IOException
the method may throw an exception

getObjectId

public String getObjectId()
The object id must be unique, it is used to identify the object when loaded even when it is obfuscated.

Returns

a unique id

toString

public String toString()
Returns a string representation of the object. In general, the toString method returns a string that “textually represents” this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@’, and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + ‘@’ + Integer.toHexString(hashCode())