KeyValueSessionStore

Defines a mechanism for viewers to store arbitrary key value pairs on a per-session basis. That is usually a javax.servlet.http.HttpSession .

This store is used by the Wicket viewer. For example, the viewer remembers which time-zone the user has logged in. Or when impersonating.

API

KeyValueSessionStore.java
interface KeyValueSessionStore {
  boolean isSessionAvailable()     (1)
  void put(String key, Serializable value)     (2)
  Optional<T> lookupAs(String key, Class<T> requiredType)     (3)
  void clear(String key)     (4)
  Optional<String> lookupAsString(String key)
  boolean getAsBoolean(String key)
}
1 isSessionAvailable()

Whether a session is available, for storing/retrieving key/value pairs.

2 put(String, Serializable)

Puts given value onto the session store, overriding any existing value. If value is null, removes the entry from the store.

3 lookupAs(String, Class)

Optionally returns the value that is stored under given key, based on whether a corresponding entry exists.

4 clear(String)

Removes the entry from the store.

Members

isSessionAvailable()

Whether a session is available, for storing/retrieving key/value pairs.

put(String, Serializable)

Puts given value onto the session store, overriding any existing value. If value is null, removes the entry from the store.

In case there is no session for storing available, acts as a no-op.

lookupAs(String, Class)

Optionally returns the value that is stored under given key, based on whether a corresponding entry exists.

In case there is no session for storing available, will return Optional#empty() .

clear(String)

Removes the entry from the store.

In case there is no session for storing available, acts as a no-op.