net.sf.ooweb.http
Class Cookie

java.lang.Object
  extended by net.sf.ooweb.http.Cookie

public class Cookie
extends java.lang.Object

Cookie represents an HTTP cookie and specifies all of the mandatory and optional values that a cookie may have,

Since:
0.5
Author:
Darren Davison

Constructor Summary
Cookie(java.lang.String name, java.lang.String value)
          Create a cookie using the minimum required information of name and value.
Cookie(java.lang.String name, java.lang.String value, java.util.Date expires, java.lang.String domain, java.lang.String path, boolean secure)
          Create a cookie supplying all of the required and optional information needed.
 
Method Summary
 java.lang.String getDomain()
           
 java.util.Date getExpires()
           
 java.lang.String getHeaderValue()
           
 java.lang.String getName()
           
 java.lang.String getPath()
           
 java.lang.String getValue()
           
 boolean isSecure()
           
 java.lang.String toString()
          Can be used to write the actual lcookie into an HTTP response stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Cookie

public Cookie(java.lang.String name,
              java.lang.String value)
Create a cookie using the minimum required information of name and value. Values for expires, domain, path and secure are not used which will make this cookie a session cookie (expires at the end of the session).

Parameters:
name - the name of the cookie
value - the value of the cookie

Cookie

public Cookie(java.lang.String name,
              java.lang.String value,
              java.util.Date expires,
              java.lang.String domain,
              java.lang.String path,
              boolean secure)
Create a cookie supplying all of the required and optional information needed. A cookie can be deleted on the client by specifying a value for the expiry date which is in the past.

Parameters:
name - the name of the cookie
value - the value of the cookie
expires - the date after which the cookie should no longer be sent to the server by the client
domain - the domain for which this cookie is valid. User agents should not transmit a cookie to any other domain than that specified.
path - the optional path within the domain that a cookie should be transmitted for,
secure - if true, instructs the user agent to only send the cookie if it believes the link to be secure. In practice, this means over HTTPS.
Method Detail

getDomain

public java.lang.String getDomain()
Returns:
the domain that the cookie belongs to.

getExpires

public java.util.Date getExpires()
Returns:
the expiry date of the cookie.

getName

public java.lang.String getName()
Returns:
the cookie name.

getPath

public java.lang.String getPath()
Returns:
the path the cookie should be associated with.

isSecure

public boolean isSecure()
Returns:
true if the cookie should only be transmitted over a secure link (HTTPS).

getValue

public java.lang.String getValue()
Returns:
the value.

getHeaderValue

public java.lang.String getHeaderValue()
Returns:
the header payload - ie a valid string that can be added as an HTTP header to a response if prefixed with "Set-Cookie: "

toString

public java.lang.String toString()
Can be used to write the actual lcookie into an HTTP response stream.

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright (C) 2005-2007 OOWeb Authors.