Package org.restlet.data
Class CookieSetting
java.lang.Object
org.restlet.data.Cookie
org.restlet.data.CookieSetting
- All Implemented Interfaces:
NamedValue<String>
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.
Note that when used with HTTP connectors, this class maps to the "Set-Cookie" and "Set-Cookie2" headers.
- Author:
- Jerome Louvel
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault 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
Modifier and TypeMethodDescriptionbooleanReturns the comment for the user.Returns the description of this REST element.intReturns the maximum age in seconds.inthashCode()booleanIndicates if cookie access is restricted for untrusted parties.booleanisSecure()Indicates if cookie should only be transmitted by secure means.voidsetAccessRestricted(boolean accessRestricted) Indicates whether to restrict cookie access to untrusted parties.voidsetComment(String comment) Sets the comment for the user.voidsetMaxAge(int maxAge) Sets the maximum age in seconds.voidsetSecure(boolean secure) Indicates if cookie should only be transmitted by secure means.toString()
-
Constructor Details
-
CookieSetting
public CookieSetting()Default constructor. -
CookieSetting
Constructor.- Parameters:
version- The cookie's version.name- The cookie's name.value- The cookie's value.
-
CookieSetting
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
Preferred constructor.- Parameters:
name- The cookie's name.value- The cookie's value.
-
-
Method Details
-
equals
-
getComment
Returns the comment for the user.- Returns:
- The comment for the user.
-
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() -
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
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
-