|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.session.HttpSessionStore
public class HttpSessionStore
Implementation of ISessionStore
that works with web applications and provides some
specific http servlet/ session related functionality.
Nested Class Summary | |
---|---|
protected static class |
HttpSessionStore.SessionBindingListener
Reacts on unbinding from the session by cleaning up the session related data. |
Nested classes/interfaces inherited from interface org.apache.wicket.session.ISessionStore |
---|
ISessionStore.BindListener, ISessionStore.UnboundListener |
Constructor Summary | |
---|---|
HttpSessionStore()
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()
|
protected javax.servlet.http.HttpServletRequest |
getHttpServletRequest(Request request)
|
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. |
protected void |
onBind(Request request,
Session newSession)
Template method that is called when a session is being bound to the session store. |
protected void |
onUnbind(String sessionId)
Template method that is called when the session is being detached from the store, which typically happens when the HttpSession was invalidated. |
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 HttpSessionStore()
Method Detail |
---|
protected final javax.servlet.http.HttpServletRequest getHttpServletRequest(Request request)
request
-
public final void bind(Request request, Session newSession)
ISessionStore
bind
in interface ISessionStore
request
- The request that triggered making a new sessionnewSession
- The new sessionISessionStore.bind(Request, Session)
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 flushedpublic void destroy()
ISessionStore
destroy
in interface ISessionStore
ISessionStore.destroy()
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
ISessionStore.getSessionId(org.apache.wicket.request.Request,
boolean)
public final void invalidate(Request request)
ISessionStore
invalidate
in interface ISessionStore
request
- the current requestISessionStore.invalidate(Request)
public final 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
ISessionStore.lookup(org.apache.wicket.request.Request)
protected void onBind(Request request, Session newSession)
ISessionStore.setAttribute(Request, String, Serializable)
with key
Session.SESSION_ATTRIBUTE_NAME
.
request
- The requestnewSession
- The new sessionprotected void onUnbind(String sessionId)
HttpSession
was invalidated.
sessionId
- The session id of the session that was invalidated.public final Serializable getAttribute(Request request, String name)
ISessionStore
getAttribute
in interface ISessionStore
request
- the current requestname
- The name of the attribute to store
ISessionStore.getAttribute(org.apache.wicket.request.Request,
java.lang.String)
public final List<String> getAttributeNames(Request request)
getAttributeNames
in interface ISessionStore
request
- the current request
ISessionStore.getAttributeNames(org.apache.wicket.request.Request)
public final void removeAttribute(Request request, String name)
ISessionStore
removeAttribute
in interface ISessionStore
request
- the current requestname
- the name of the attribute to removeISessionStore.removeAttribute(org.apache.wicket.request.Request,
java.lang.String)
public final 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 attributeISessionStore.setAttribute(org.apache.wicket.request.Request,
java.lang.String, java.io.Serializable)
public final void registerUnboundListener(ISessionStore.UnboundListener listener)
ISessionStore
registerUnboundListener
in interface ISessionStore
ISessionStore.registerUnboundListener(org.apache.wicket.session.ISessionStore.UnboundListener)
public final void unregisterUnboundListener(ISessionStore.UnboundListener listener)
ISessionStore
unregisterUnboundListener
in interface ISessionStore
ISessionStore.unregisterUnboundListener(org.apache.wicket.session.ISessionStore.UnboundListener)
public final Set<ISessionStore.UnboundListener> getUnboundListener()
getUnboundListener
in interface ISessionStore
ISessionStore.getUnboundListener()
public void registerBindListener(ISessionStore.BindListener listener)
registerBindListener
in interface ISessionStore
listener
- public void unregisterBindListener(ISessionStore.BindListener listener)
unregisterBindListener
in interface ISessionStore
listener
- public Set<ISessionStore.BindListener> getBindListeners()
getBindListeners
in interface ISessionStore
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |