Restlet Framework 2.2 Snapshot
OSGi Environments

org.restlet.data
Class CookieSetting

java.lang.Object
  extended by org.restlet.data.Cookie
      extended by org.restlet.data.CookieSetting
All Implemented Interfaces:
NamedValue<String>

public final class CookieSetting
extends Cookie

Cookie setting provided by a server. This allows a server side application to add, modify or remove a cookie on the client.

Note that when used with HTTP connectors, this class maps to the "Set-Cookie" and "Set-Cookie2" headers.

Author:
Jerome Louvel
See Also:
Response.getCookieSettings()

Constructor Summary
CookieSetting()
          Default constructor.
CookieSetting(int version, String name, String value)
          Constructor.
CookieSetting(int version, String name, String value, String path, String domain)
          Constructor.
CookieSetting(int version, String name, String value, String path, String domain, String comment, int maxAge, boolean secure)
          Constructor.
CookieSetting(int version, String name, String value, String path, String domain, String comment, int maxAge, boolean secure, boolean accessRestricted)
          Constructor.
CookieSetting(String name, String value)
          Preferred constructor.
 
Method Summary
 boolean equals(Object obj)
          
 String getComment()
          Returns the comment for the user.
 String getDescription()
          Returns the description of this REST element.
 int getMaxAge()
          Returns the maximum age in seconds.
 int hashCode()
          
 boolean isAccessRestricted()
          Indicates if cookie access is restricted for untrusted parties.
 boolean isSecure()
          Indicates if cookie should only be transmitted by secure means.
 void setAccessRestricted(boolean accessRestricted)
          Indicates whether to restrict cookie access to untrusted parties.
 void setComment(String comment)
          Sets the comment for the user.
 void setMaxAge(int maxAge)
          Sets the maximum age in seconds.
 void setSecure(boolean secure)
          Indicates if cookie should only be transmitted by secure means.
 String toString()
           
 
Methods inherited from class org.restlet.data.Cookie
getDomain, getName, getPath, getValue, getVersion, setDomain, setName, setPath, setValue, setVersion
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CookieSetting

public CookieSetting()
Default constructor.


CookieSetting

public CookieSetting(int version,
                     String name,
                     String value)
Constructor.

Parameters:
version - The cookie's version.
name - The cookie's name.
value - The cookie's value.

CookieSetting

public CookieSetting(int version,
                     String name,
                     String value,
                     String path,
                     String domain)
Constructor.

Parameters:
version - The cookie's version.
name - The cookie's name.
value - The cookie's value.
path - The cookie's path.
domain - The cookie's domain name.

CookieSetting

public CookieSetting(int version,
                     String name,
                     String value,
                     String path,
                     String domain,
                     String comment,
                     int maxAge,
                     boolean secure)
Constructor.

Parameters:
version - The cookie's version.
name - The cookie's name.
value - The cookie's value.
path - The cookie's path.
domain - The cookie's domain name.
comment - The cookie's comment.
maxAge - Sets the maximum age in seconds.
Use 0 to immediately discard an existing cookie.
Use -1 to discard the cookie at the end of the session (default).
secure - Indicates if cookie should only be transmitted by secure means.

CookieSetting

public CookieSetting(int version,
                     String name,
                     String value,
                     String path,
                     String domain,
                     String comment,
                     int maxAge,
                     boolean secure,
                     boolean accessRestricted)
Constructor.

Parameters:
version - The cookie's version.
name - The cookie's name.
value - The cookie's value.
path - The cookie's path.
domain - The cookie's domain name.
comment - The cookie's comment.
maxAge - Sets the maximum age in seconds.
Use 0 to immediately discard an existing cookie.
Use -1 to discard the cookie at the end of the session (default).
secure - Indicates if cookie should only be transmitted by secure means.
accessRestricted - Indicates whether to restrict cookie access to untrusted parties. Currently this toggles the non-standard but widely supported HttpOnly cookie parameter.

CookieSetting

public CookieSetting(String name,
                     String value)
Preferred constructor.

Parameters:
name - The cookie's name.
value - The cookie's value.
Method Detail

equals

public boolean equals(Object obj)

Overrides:
equals in class Cookie

getComment

public String getComment()
Returns the comment for the user.

Returns:
The comment for the user.

getDescription

public String getDescription()
Returns the description of this REST element.

Returns:
The description of this REST element.

getMaxAge

public int getMaxAge()
Returns the maximum age in seconds. Use 0 to immediately discard an existing cookie. Use -1 to discard the cookie at the end of the session (default).

Returns:
The maximum age in seconds.

hashCode

public int hashCode()

Overrides:
hashCode in class Cookie

isAccessRestricted

public boolean isAccessRestricted()
Indicates if cookie access is restricted for untrusted parties. Currently this toggles the non-standard but widely supported HttpOnly cookie parameter.

Returns:
accessRestricted True if cookie access should be restricted

isSecure

public boolean isSecure()
Indicates if cookie should only be transmitted by secure means.

Returns:
True if cookie should only be transmitted by secure means.

setAccessRestricted

public void setAccessRestricted(boolean accessRestricted)
Indicates whether to restrict cookie access to untrusted parties. Currently this toggles the non-standard but widely supported HttpOnly cookie parameter.

Parameters:
accessRestricted - True if cookie access should be restricted

setComment

public void setComment(String comment)
Sets the comment for the user.

Parameters:
comment - The comment for the user.

setMaxAge

public void setMaxAge(int maxAge)
Sets the maximum age in seconds. Use 0 to immediately discard an existing cookie. Use -1 to discard the cookie at the end of the session (default).

Parameters:
maxAge - The maximum age in seconds.

setSecure

public void setSecure(boolean secure)
Indicates if cookie should only be transmitted by secure means.

Parameters:
secure - True if cookie should only be transmitted by secure means.

toString

public String toString()
Overrides:
toString in class Cookie

Restlet Framework 2.2 Snapshot
OSGi Environments

Copyright © 2005-2014 Restlet.