public class MockSessionStore extends Object implements ISessionStore
ISessionStore.BindListener, ISessionStore.UnboundListener| Constructor and Description |
|---|
MockSessionStore()
Construct.
|
| Modifier and Type | Method and Description |
|---|---|
void |
bind(org.apache.wicket.request.Request request,
Session newSession)
Adds the provided new session to this facade using the provided request.
|
void |
destroy()
Called when the WebApplication is destroyed.
|
void |
flushSession(org.apache.wicket.request.Request request,
Session session)
Flushes the session.
|
Serializable |
getAttribute(org.apache.wicket.request.Request request,
String name)
Gets the attribute value with the given name
|
List<String> |
getAttributeNames(org.apache.wicket.request.Request request) |
Set<ISessionStore.BindListener> |
getBindListeners() |
String |
getSessionId(org.apache.wicket.request.Request request,
boolean create)
Get the session id for the provided request.
|
Set<ISessionStore.UnboundListener> |
getUnboundListener() |
void |
invalidate(org.apache.wicket.request.Request request)
Invalidates the session.
|
Session |
lookup(org.apache.wicket.request.Request request)
Retrieves the session for the provided request from this facade.
|
void |
registerBindListener(ISessionStore.BindListener listener)
Registers listener invoked when session is bound.
|
void |
registerUnboundListener(ISessionStore.UnboundListener listener)
Registers listener invoked when session is unbound.
|
void |
removeAttribute(org.apache.wicket.request.Request request,
String name)
Removes the attribute with the given name.
|
void |
setAttribute(org.apache.wicket.request.Request request,
String name,
Serializable value)
Adds or replaces the attribute with the given name and value.
|
void |
unregisterBindListener(ISessionStore.BindListener listener)
Unregisters listener invoked when session is bound.
|
void |
unregisterUnboundListener(ISessionStore.UnboundListener listener)
Unregisters listener invoked when session is unbound.
|
public void bind(org.apache.wicket.request.Request request,
Session newSession)
ISessionStorebind in interface ISessionStorerequest - The request that triggered making a new sessionnewSession - The new sessionpublic void destroy()
ISessionStoredestroy in interface ISessionStorepublic Serializable getAttribute(org.apache.wicket.request.Request request, String name)
ISessionStoregetAttribute in interface ISessionStorerequest - the current requestname - The name of the attribute to storepublic List<String> getAttributeNames(org.apache.wicket.request.Request request)
getAttributeNames in interface ISessionStorerequest - the current requestpublic String getSessionId(org.apache.wicket.request.Request request, boolean create)
ISessionStoregetSessionId in interface ISessionStorerequest - The requestcreate - Whether to create an actual session (typically an instance of HttpSession)
when not already done sopublic void invalidate(org.apache.wicket.request.Request request)
ISessionStoreinvalidate in interface ISessionStorerequest - the current requestpublic Session lookup(org.apache.wicket.request.Request request)
ISessionStore
This method should return null if it is not bound yet, so that Wicket can recognize that it
should create a session and call ISessionStore.bind(Request, Session) right after that.
lookup in interface ISessionStorerequest - The current requestpublic void registerUnboundListener(ISessionStore.UnboundListener listener)
ISessionStoreregisterUnboundListener in interface ISessionStorepublic void removeAttribute(org.apache.wicket.request.Request request,
String name)
ISessionStoreremoveAttribute in interface ISessionStorerequest - the current requestname - the name of the attribute to removepublic final Set<ISessionStore.UnboundListener> getUnboundListener()
getUnboundListener in interface ISessionStorepublic void setAttribute(org.apache.wicket.request.Request request,
String name,
Serializable value)
ISessionStoresetAttribute in interface ISessionStorerequest - the current requestname - the name of the attributevalue - the value of the attributepublic void unregisterUnboundListener(ISessionStore.UnboundListener listener)
ISessionStoreunregisterUnboundListener in interface ISessionStorepublic void registerBindListener(ISessionStore.BindListener listener)
ISessionStoreregisterBindListener in interface ISessionStorepublic void unregisterBindListener(ISessionStore.BindListener listener)
ISessionStoreunregisterBindListener in interface ISessionStorepublic Set<ISessionStore.BindListener> getBindListeners()
getBindListeners in interface ISessionStorepublic void flushSession(org.apache.wicket.request.Request request,
Session session)
ISessionStore
String attr=getSessionAttributeName();
Session session=getAttribute(attr);
setAttribute(attr, session);
If the session is not yet bound it will be.flushSession in interface ISessionStorerequest - current requestsession - session to be flushedCopyright © 2006–2018 Apache Software Foundation. All rights reserved.