|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.mock.MockSessionStore
public class MockSessionStore
Session store that holds one session.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.wicket.session.ISessionStore |
---|
ISessionStore.BindListener, ISessionStore.UnboundListener |
Constructor Summary | |
---|---|
MockSessionStore()
Construct. |
Method Summary | |
---|---|
void |
bind(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(Request request,
Session session)
Flushes the session. |
Serializable |
getAttribute(Request request,
String name)
Gets the attribute value with the given name |
List<String> |
getAttributeNames(Request request)
|
Set<ISessionStore.BindListener> |
getBindListeners()
|
String |
getSessionId(Request request,
boolean create)
Get the session id for the provided request. |
Set<ISessionStore.UnboundListener> |
getUnboundListener()
|
void |
invalidate(Request request)
Invalidates the session. |
Session |
lookup(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(Request request,
String name)
Removes the attribute with the given name. |
void |
setAttribute(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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MockSessionStore()
Method Detail |
---|
public void bind(Request request, Session newSession)
ISessionStore
bind
in interface ISessionStore
request
- The request that triggered making a new sessionnewSession
- The new sessionpublic void destroy()
ISessionStore
destroy
in interface ISessionStore
public Serializable getAttribute(Request request, String name)
ISessionStore
getAttribute
in interface ISessionStore
request
- the current requestname
- The name of the attribute to store
public List<String> getAttributeNames(Request request)
getAttributeNames
in interface ISessionStore
request
- the current request
public String getSessionId(Request request, boolean create)
ISessionStore
getSessionId
in interface ISessionStore
request
- The requestcreate
- Whether to create an actual session (typically an instance of HttpSession
)
when not already done so
public void invalidate(Request request)
ISessionStore
invalidate
in interface ISessionStore
request
- the current requestpublic Session lookup(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 ISessionStore
request
- The current request
public void registerUnboundListener(ISessionStore.UnboundListener listener)
ISessionStore
registerUnboundListener
in interface ISessionStore
public void removeAttribute(Request request, String name)
ISessionStore
removeAttribute
in interface ISessionStore
request
- the current requestname
- the name of the attribute to removepublic final Set<ISessionStore.UnboundListener> getUnboundListener()
getUnboundListener
in interface ISessionStore
public void setAttribute(Request request, String name, Serializable value)
ISessionStore
setAttribute
in interface ISessionStore
request
- the current requestname
- the name of the attributevalue
- the value of the attributepublic void unregisterUnboundListener(ISessionStore.UnboundListener listener)
ISessionStore
unregisterUnboundListener
in interface ISessionStore
public void registerBindListener(ISessionStore.BindListener listener)
ISessionStore
registerBindListener
in interface ISessionStore
public void unregisterBindListener(ISessionStore.BindListener listener)
ISessionStore
unregisterBindListener
in interface ISessionStore
public Set<ISessionStore.BindListener> getBindListeners()
getBindListeners
in interface ISessionStore
public void flushSession(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 ISessionStore
request
- current requestsession
- session to be flushed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |