org.abstracthorizon.danube.http.cookie
Class Cookie

java.lang.Object
  extended by org.abstracthorizon.danube.http.cookie.Cookie

public class Cookie
extends Object

Definition of a cookie

Author:
Daniel Sendula

Field Summary
static SimpleDateFormat cookieFormat
          Format of the cookie date
protected  String domain
          Cookie domain
protected  Date expires
          Date cookie is going expire
protected  String name
          Cookie name
protected  String path
          Cookie path
protected  boolean secure
          Is cookie secure
protected  String value
          Cookie value
 
Constructor Summary
Cookie()
          Creates new cookie to be sent to the browser
Cookie(String header)
          Creates cooke from the request headers
 
Method Summary
 String getDomain()
          Returns cookie's domain
 Date getExpires()
          Returns expire date of the cookie
 String getName()
          Returns cookie name
 String getPath()
          Return cookie's path
 String getValue()
          Returns cookie value
 boolean isSecure()
          Returns is cookie is secured
protected  void parseCookie(String header)
          Parses cookie definition (in format <name>=<value>) and stores name and value to this cookie.
 void setDomain(String domain)
          Sets cookie's domain
 void setExpires(Date expires)
          Sets expire date of the cookie
 void setName(String name)
          Sets cookie name
 void setPath(String path)
          Sets cookie's path
 void setSecure(boolean secure)
          Sets is cookie secure
 void setValue(String value)
          Sets cookie value
 String toString()
          Returns cookie as string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cookieFormat

public static final SimpleDateFormat cookieFormat
Format of the cookie date


name

protected String name
Cookie name


value

protected String value
Cookie value


expires

protected Date expires
Date cookie is going expire


domain

protected String domain
Cookie domain


path

protected String path
Cookie path


secure

protected boolean secure
Is cookie secure

Constructor Detail

Cookie

public Cookie()
Creates new cookie to be sent to the browser


Cookie

public Cookie(String header)
       throws ParseException
Creates cooke from the request headers

Parameters:
header - request header
Throws:
ParseException - thrown if "=" is missing
Method Detail

getDomain

public String getDomain()
Returns cookie's domain

Returns:
the domain

setDomain

public void setDomain(String domain)
Sets cookie's domain

Parameters:
domain - the domain to set

getExpires

public Date getExpires()
Returns expire date of the cookie

Returns:
the expires

setExpires

public void setExpires(Date expires)
Sets expire date of the cookie

Parameters:
expires - the expires to set

getName

public String getName()
Returns cookie name

Returns:
the name

setName

public void setName(String name)
Sets cookie name

Parameters:
name - the name to set

getPath

public String getPath()
Return cookie's path

Returns:
the path

setPath

public void setPath(String path)
Sets cookie's path

Parameters:
path - the path to set

isSecure

public boolean isSecure()
Returns is cookie is secured

Returns:
the secure

setSecure

public void setSecure(boolean secure)
Sets is cookie secure

Parameters:
secure - the secure to set

getValue

public String getValue()
Returns cookie value

Returns:
the value

setValue

public void setValue(String value)
Sets cookie value

Parameters:
value - the value to set

toString

public String toString()
Returns cookie as string

Overrides:
toString in class Object
Returns:
cookie as string

parseCookie

protected void parseCookie(String header)
                    throws ParseException
Parses cookie definition (in format <name>=<value>) and stores name and value to this cookie.

Parameters:
header - cookie as given in a header
Throws:
ParseException - thrown if "=" is missing


Copyright © 2005-2009 Abstract Horizon. All Rights Reserved.