com.plumtree.openfoundation.web
Class XPCookie

java.lang.Object
  extended bycom.plumtree.openfoundation.web.XPCookie

public class XPCookie
extends java.lang.Object

XPCookie wraps the Cookie object.


Constructor Summary
XPCookie(Cookie cookie)
          Constructor that wraps the Cookie.
XPCookie(java.lang.String name, java.lang.String _value)
          Constructor that creates a cookie using the name and value.
 
Method Summary
 java.lang.String GetDomain()
          Returns the domain to which the cookie is associated.
 int GetExpires()
          Returns the maximum age of the cookie, specified in seconds.
 java.lang.String GetName()
          Returns the name of the cookie.
 java.lang.String GetPath()
          Returns the path on the server to which the browser returns this cookie.
 boolean GetSecure()
          Returns true if the browser is sending cookies only over a secure protocol, or false if the browser can send cookies using any protocol.
 Cookie GetUnderlyingObject()
          This retunrs underlying Cookie object.
 java.lang.String GetValue()
          Returns the value of the cookie.
 void SetDeleteCookie()
          Deletes the cookie.
 void SetDomain(java.lang.String domain)
          Specifies the domain within which this cookie should be presented.
 void SetExpires(int expiry)
          Deprecated. As of XDK 2.4.5.0. This method has inconsistent behavior in java and .NET Use SetExpireTime(), SetDeleteCookie() and SetExpireWhenBrowserCloses() instead.
 void SetExpireTime(int numSecToExpire)
          Sets the time in seconds that the cookie will expire from the current time.
 void SetExpireWhenBrowserExits()
          Sets the cookie to expire and be deleted when a browser exists.
 void SetPath(java.lang.String path)
          Specifies a path for the cookie to which the client should return the cookie.
 void SetSecure(boolean secure)
          Indicates to the browser whether the cookie should only be sent using a secure protocol, such as HTTPS or SSL.
 void SetValue(java.lang.String _value)
          Assigns a new value to a cookie after the cookie is created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPCookie

public XPCookie(Cookie cookie)
Constructor that wraps the Cookie.

Parameters:
cookie - to wrapped into XPCookie.

XPCookie

public XPCookie(java.lang.String name,
                java.lang.String _value)
Constructor that creates a cookie using the name and value.

Parameters:
name - - Name of the cookie
_value - - Value of the cookie
Method Detail

GetDomain

public java.lang.String GetDomain()
Returns the domain to which the cookie is associated.

Returns:
a String containing the domain name

SetDomain

public void SetDomain(java.lang.String domain)
Specifies the domain within which this cookie should be presented.

Parameters:
domain - - a String containing the domain name within which this cookie is visible

GetName

public java.lang.String GetName()
Returns the name of the cookie.

Returns:
Name of the cookie

GetPath

public java.lang.String GetPath()
Returns the path on the server to which the browser returns this cookie.

Returns:
a String specifying a path that contains a servlet name, for example, /catalog

SetPath

public void SetPath(java.lang.String path)
Specifies a path for the cookie to which the client should return the cookie. Setting it to an empty string will result the same as setting it to null.

Parameters:
path - - a String specifying a path; if empty string or null, will set the value to null. e.g. /portal50

GetSecure

public boolean GetSecure()
Returns true if the browser is sending cookies only over a secure protocol, or false if the browser can send cookies using any protocol.

Returns:
true if the browser uses a secure protocol; otherwise, true

SetSecure

public void SetSecure(boolean secure)
Indicates to the browser whether the cookie should only be sent using a secure protocol, such as HTTPS or SSL. The default value is false.

Parameters:
secure - - if true, sends the cookie from the browser to the server using only when using a secure protocol; if false, sent on any protocol

SetExpires

public void SetExpires(int expiry)
Deprecated. As of XDK 2.4.5.0. This method has inconsistent behavior in java and .NET Use SetExpireTime(), SetDeleteCookie() and SetExpireWhenBrowserCloses() instead.

Sets the maximum age of the cookie in seconds.

Parameters:
expiry - - an integer specifying the maximum age of the cookie in seconds; if negative, means the cookie is not stored; if zero, deletes the cookie

SetExpireTime

public void SetExpireTime(int numSecToExpire)
Sets the time in seconds that the cookie will expire from the current time.

Parameters:
numSecToExpire - - number of seconds that the cookie will expire from the current time; if 0, deletes the cookie
Throws:
XPIllegalArgumentException - if the number of second specified is negative

SetDeleteCookie

public void SetDeleteCookie()
Deletes the cookie.


SetExpireWhenBrowserExits

public void SetExpireWhenBrowserExits()
Sets the cookie to expire and be deleted when a browser exists.


GetExpires

public int GetExpires()
Returns the maximum age of the cookie, specified in seconds. By default, -1 indicating the cookie will persist until browser shutdown, 0 indicating the cookie is deleted.

Returns:
an integer specifying the maximum age of the cookie in seconds; if negative, means the cookie persists until browser shutdown, if zero, means the cookie is deleted

GetValue

public java.lang.String GetValue()
Returns the value of the cookie.

Returns:
a String containing the cookie's present value

SetValue

public void SetValue(java.lang.String _value)
Assigns a new value to a cookie after the cookie is created.

Parameters:
_value - - a String specifying the new value

GetUnderlyingObject

public Cookie GetUnderlyingObject()
This retunrs underlying Cookie object.

Returns:
Cookie object


Copyright 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.