public class CookieUtils extends Object
| Constructor and Description |
|---|
CookieUtils()
Construct.
|
CookieUtils(CookieDefaults settings)
Construct.
|
| Modifier and Type | Method and Description |
|---|---|
javax.servlet.http.Cookie |
getCookie(String name)
Gets the cookie with 'name' attached to the latest WebRequest.
|
protected String |
getKey(FormComponent<?> component)
This method gets used when a cookie key needs to be derived from a form component.
|
protected String |
getSaveKey(String key)
Make sure the 'key' does not contain any illegal chars.
|
CookieDefaults |
getSettings() |
protected void |
initializeCookie(javax.servlet.http.Cookie cookie)
Is called before the Cookie is saved.
|
String |
load(FormComponent<?> formComponent)
Retrieve the cookie value associated with the formComponent and load the model object with
the cookie value.
|
String |
load(String key)
Retrieve the cookie value by means of its key.
|
void |
remove(FormComponent<?> formComponent)
Remove the cookie identified by the form component
|
void |
remove(String key)
Remove the cookie identified by the key
|
void |
save(FormComponent<?> formComponent)
Save the form components model value in a cookie
|
void |
save(String key,
String value)
Create a Cookie with key and value and save it in the browser with the next response
|
public CookieUtils()
public CookieUtils(CookieDefaults settings)
settings - the default settings for the saved cookiespublic final CookieDefaults getSettings()
public final void remove(String key)
key - The cookie namepublic final void remove(FormComponent<?> formComponent)
formComponent - protected String getKey(FormComponent<?> component)
component - public final String load(String key)
key - The cookie namepublic final String load(FormComponent<?> formComponent)
formComponent - public final void save(String key, String value)
key - The cookie namevalue - The cookie valuepublic final void save(FormComponent<?> formComponent)
formComponent - protected String getSaveKey(String key)
key - The key to be validatedpublic javax.servlet.http.Cookie getCookie(String name)
name - The name of the cookie to be looked upprotected void initializeCookie(javax.servlet.http.Cookie cookie)
CookieDefaults.cookie - Copyright © 2006–2021 Apache Software Foundation. All rights reserved.