PAJES 3.0.21

org.pajes.servlet
Class PajeCookie

java.lang.Object
  extended by javax.servlet.http.Cookie
      extended by org.pajes.servlet.PajeCookie
All Implemented Interfaces:
java.lang.Cloneable

public class PajeCookie
extends javax.servlet.http.Cookie

The PajeCookie class adds to the functionality of the Cookie class by providing the facility to handle "sub-values". Thus, multiple key/value pairs can be safely stored inside the one cookie, removing the necessity to use a whole series of cookies, one for each piece of information to be stored.


Field Summary
static java.lang.String DEFAULT_NAME
          This is the default name assigned to instances created with the null constructor.
 
Constructor Summary
PajeCookie()
          Builds a new cookie with the default name.
PajeCookie(javax.servlet.http.Cookie cookie)
          Builds a PajeCookie from a normal Cookie instance.
PajeCookie(java.lang.String name)
          Builds a new cookie with a specified name.
 
Method Summary
 void deleteSubValue(java.lang.String key)
          This method removes a sub-value associated with a specified key from the cookie's list of sub-values.
 java.lang.String getSubValue(java.lang.String key)
          This method searches the cookie value for a specified key amongst the sub-values, and returns an associated sub-value string value if it is found.
 boolean isNew()
          Determines if this is a new cookie, or if it was created from an existing cookie.
 void setSubValue(java.lang.String key, java.lang.String value)
          This method stores a key/value pair as a sub-value within the cookie's value string.
 java.lang.String toString()
           
 
Methods inherited from class javax.servlet.http.Cookie
clone, getComment, getDomain, getMaxAge, getName, getPath, getSecure, getValue, getVersion, setComment, setDomain, setMaxAge, setPath, setSecure, setValue, setVersion
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_NAME

public static final java.lang.String DEFAULT_NAME
This is the default name assigned to instances created with the null constructor.

See Also:
Constant Field Values
Constructor Detail

PajeCookie

public PajeCookie()
Builds a new cookie with the default name.


PajeCookie

public PajeCookie(javax.servlet.http.Cookie cookie)
Builds a PajeCookie from a normal Cookie instance.

Parameters:
cookie - The Cookie to copy from when instantiating the new PajeCookie.

PajeCookie

public PajeCookie(java.lang.String name)
Builds a new cookie with a specified name.

Parameters:
name - The name to be assigned to the new cookie
Method Detail

deleteSubValue

public void deleteSubValue(java.lang.String key)
This method removes a sub-value associated with a specified key from the cookie's list of sub-values.

Parameters:
key - The key to be removed from the list of sub-values.

getSubValue

public java.lang.String getSubValue(java.lang.String key)
This method searches the cookie value for a specified key amongst the sub-values, and returns an associated sub-value string value if it is found.

Parameters:
key - The key to search for.
Returns:
The string value associated with the key (or null if the key was not present).

isNew

public boolean isNew()
Determines if this is a new cookie, or if it was created from an existing cookie.

Returns:
false if this cookie was created from an existing cookie.

setSubValue

public void setSubValue(java.lang.String key,
                        java.lang.String value)
This method stores a key/value pair as a sub-value within the cookie's value string. If the value to be stored is null then the sub-value with the specified key will be removed.

Parameters:
key - The key to reference the value with.
value - The information to be stored.

toString

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

PAJES 3.0.21

Copyright © 1998-2007 Viridian Pty Limited. All Rights Reserved.