public class ConversationCookie extends Cookie
Cookie
. Tracks modifications, and
upon calling save()
stores them as a CookieSetting
, likely
in the Response
. Also supports cookie deletion via remove()
.Constructor and Description |
---|
ConversationCookie(Cookie cookie,
Series<CookieSetting> cookieSettings)
Construction based on existing cookie.
|
ConversationCookie(String name,
Series<CookieSetting> cookieSettings)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static ConversationCookie |
createCookie(String name,
Series<CookieSetting> cookieSettings,
Collection<ConversationCookie> conversationCookies)
Returns a new conversation cookie instance if the cookie doesn't exist
yet, or the existing cookie if it does.
|
String |
getComment()
The comment.
|
boolean |
getIsAccessRestricted()
Whether access is restricted.
|
boolean |
getIsSecure()
Whether the cookie is secure.
|
int |
getMaxAge()
Max age.
|
Cookie |
getOriginalCookie()
The original cookie, if there was one.
|
boolean |
isAccessRestricted()
Whether access is restricted.
|
boolean |
isSecure()
Whether the cookie is secure.
|
void |
remove()
Sets the cookie for deletion if it already exists (equivalent to saving
with maxAge=0), or cancels a new cookie.
|
boolean |
save()
Saves changes, if any were made, as a unique cookie setting.
|
void |
setAccessRestricted(boolean accessRestricted)
Whether access is restricted.
|
void |
setComment(String comment)
The comment.
|
void |
setDomain(String domain) |
void |
setMaxAge(int maxAge)
Max age.
|
void |
setName(String name) |
void |
setPath(String path) |
void |
setSecure(boolean secure)
Whether the cookie is secure.
|
void |
setValue(String value) |
void |
setVersion(int version) |
static Collection<ConversationCookie> |
wrapCookies(Series<Cookie> cookies,
Series<CookieSetting> cookieSettings)
Creates a collection of conversation cookies based on existing cookies
and settings.
|
static Collection<ConversationCookie> |
wrapCookies(ServerResource resource)
Creates a collection of conversation cookies based on a resource.
|
public ConversationCookie(Cookie cookie, Series<CookieSetting> cookieSettings)
cookie
- The cookiescookieSettings
- The cookie settings (might be altered as we change our
conversation cookie)public ConversationCookie(String name, Series<CookieSetting> cookieSettings)
name
- The cookie namecookieSettings
- The cookie settings (might be altered as we change our
conversation cookie)public static ConversationCookie createCookie(String name, Series<CookieSetting> cookieSettings, Collection<ConversationCookie> conversationCookies)
name
- The cookie namecookieSettings
- The cookie settings (will be used only if we need to create a new
cookie)conversationCookies
- The conversation cookiespublic static Collection<ConversationCookie> wrapCookies(ServerResource resource)
resource
- The resource (response might be altered as we change our
conversation cookies)public static Collection<ConversationCookie> wrapCookies(Series<Cookie> cookies, Series<CookieSetting> cookieSettings)
cookies
- The cookiescookieSettings
- The cookie settings (might be altered as we change our
conversation cookies)public String getComment()
public void setComment(String comment)
comment
- The commentpublic int getMaxAge()
public void setMaxAge(int maxAge)
maxAge
- The max age in secondspublic boolean isSecure()
public boolean getIsSecure()
public void setSecure(boolean secure)
secure
- Whether the cookie is securepublic boolean isAccessRestricted()
public boolean getIsAccessRestricted()
public void setAccessRestricted(boolean accessRestricted)
accessRestricted
- Whether access is restrictedpublic Cookie getOriginalCookie()
public boolean save()
public void remove()
public void setVersion(int version)
setVersion
in class Cookie
public void setValue(String value)
setValue
in interface NamedValue<String>
setValue
in class Cookie
Copyright © 2009-2016 Three Crickets LLC.