public class CookieUtils extends Object
| Constructor and Description |
|---|
CookieUtils()
Construct.
|
CookieUtils(CookieDefaults settings)
Construct.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
protected String |
joinValues(String... values)
Join all fragments into one Cookie value
|
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... values)
Create a Cookie with key and value and save it in the browser with the next response
|
protected String[] |
splitValue(String value)
Split the loaded Cookie value
|
public CookieUtils()
public CookieUtils(CookieDefaults settings)
settings - public final CookieDefaults getSettings()
public final void remove(String key)
key - public final void remove(FormComponent<?> formComponent)
formComponent - protected String getKey(FormComponent<?> component)
component - public final String load(String key)
key - public final String load(FormComponent<?> formComponent)
formComponent - protected String[] splitValue(String value)
value - protected String joinValues(String... values)
values - public final void save(String key, String... values)
key - values - public final void save(FormComponent<?> formComponent)
formComponent - protected String getSaveKey(String key)
key - The key to be validatedprotected void initializeCookie(javax.servlet.http.Cookie cookie)
CookieDefaults.cookie - Copyright © 2006–2014 Apache Software Foundation. All rights reserved.