org.apache.wicket.markup.html.form.persistence
Class CookieValuePersister

java.lang.Object
  extended by org.apache.wicket.markup.html.form.persistence.CookieValuePersister
All Implemented Interfaces:
Serializable, IClusterable, IValuePersister

public class CookieValuePersister
extends Object
implements IValuePersister

Helper class to simplify Cookie handling in combination with Wicket

Author:
Juergen Donnerstag, Jonathan Locke
See Also:
Serialized Form

Constructor Summary
CookieValuePersister()
          Construct.
CookieValuePersister(CookieValuePersisterSettings settings)
          Construct.
 
Method Summary
 void clear(FormComponent<?> formComponent)
          Remove the key/value associated witht the formComponent
 void clear(String key)
          Remove the key/value pair
protected  String getSaveKey(String key)
          Make sure the 'key' does not contain any illegal chars.
 void load(FormComponent<?> formComponent)
          Retrieve the persisted value and if found update the form components model
 String load(String key)
          Retrieve the key from the persistence store
 void save(FormComponent<?> formComponent)
          Convenience method for FormComponent.
 void save(String key, String value)
          Saves the key/value pair
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CookieValuePersister

public CookieValuePersister()
Construct.


CookieValuePersister

public CookieValuePersister(CookieValuePersisterSettings settings)
Construct.

Parameters:
settings -
Method Detail

clear

public void clear(String key)
Description copied from interface: IValuePersister
Remove the key/value pair

Specified by:
clear in interface IValuePersister
Parameters:
key - The key to identify the entry
See Also:
IValuePersister.clear(String)

clear

public void clear(FormComponent<?> formComponent)
Description copied from interface: IValuePersister
Remove the key/value associated witht the formComponent

Specified by:
clear in interface IValuePersister
See Also:
IValuePersister.clear(org.apache.wicket.markup.html.form.FormComponent)

load

public String load(String key)
Description copied from interface: IValuePersister
Retrieve the key from the persistence store

Specified by:
load in interface IValuePersister
Parameters:
key - The key to identify the entry
Returns:
The loaded value
See Also:
IValuePersister.load(String)

load

public void load(FormComponent<?> formComponent)
Description copied from interface: IValuePersister
Retrieve the persisted value and if found update the form components model

Specified by:
load in interface IValuePersister
See Also:
IValuePersister.load(org.apache.wicket.markup.html.form.FormComponent)

save

public void save(String key,
                 String value)
Description copied from interface: IValuePersister
Saves the key/value pair

Specified by:
save in interface IValuePersister
Parameters:
key - The key to identify the entry
value - The value
See Also:
IValuePersister.save(String, String)

save

public void save(FormComponent<?> formComponent)
Description copied from interface: IValuePersister
Convenience method for FormComponent. key defaults to formComponent.getPageRelativePath() and value to formComponent.getDefaultModelAsString()

Specified by:
save in interface IValuePersister
See Also:
IValuePersister.save(org.apache.wicket.markup.html.form.FormComponent)

getSaveKey

protected String getSaveKey(String key)
Make sure the 'key' does not contain any illegal chars. For cookies ':' is not allowed.

Parameters:
key - The key to be validated
Returns:
The save key


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.