wicket.protocol.http
Class AbstractHttpSessionStore

java.lang.Object
  extended by wicket.protocol.http.AbstractHttpSessionStore
All Implemented Interfaces:
ISessionStore
Direct Known Subclasses:
HttpSessionStore

public abstract class AbstractHttpSessionStore
extends java.lang.Object
implements ISessionStore

Abstract implementation of ISessionStore that works with web applications and that provided some speficic http servlet/ session related functionality.

Author:
jcompagner, Eelco Hillenius

Nested Class Summary
protected static class AbstractHttpSessionStore.SessionBindingListener
          Reacts on unbinding from the session by cleaning up the session related application data.
 
Field Summary
protected  WebApplication application
           
protected static org.apache.commons.logging.Log log
          log.
 
Constructor Summary
AbstractHttpSessionStore()
          Construct.
 
Method Summary
 void bind(Request request, Session newSession)
          Adds the provided new session to this facade using the provided request.
protected  javax.servlet.http.HttpSession getHttpSession(WebRequest request)
          Gets the underlying HttpSession object or null.
 java.lang.String getSessionId(Request request)
          Get the session id for the provided request.
 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(java.lang.String sessionId)
          Template method that is called when the session is being detached from the store, which typically happens when the httpsession was invalidated.
protected  WebRequest toWebRequest(Request request)
          Cast Request to WebRequest.
 void unbind(java.lang.String sessionId)
          Adds the provided new session to this facade using the provided request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface wicket.session.ISessionStore
getAttribute, getAttributeNames, removeAttribute, setAttribute
 

Field Detail

log

protected static org.apache.commons.logging.Log log
log.


application

protected final WebApplication application
Constructor Detail

AbstractHttpSessionStore

public AbstractHttpSessionStore()
Construct.

Method Detail

invalidate

public final void invalidate(Request request)
Description copied from interface: ISessionStore
Invalidates the session.

Specified by:
invalidate in interface ISessionStore
Parameters:
request - the current request
See Also:
ISessionStore.invalidate(Request)

getSessionId

public final java.lang.String getSessionId(Request request)
Description copied from interface: ISessionStore
Get the session id for the provided request.

Specified by:
getSessionId in interface ISessionStore
Parameters:
request - The request
Returns:
The session id for the provided request
See Also:
ISessionStore.getSessionId(wicket.Request)

bind

public final void bind(Request request,
                       Session newSession)
Description copied from interface: ISessionStore
Adds the provided new session to this facade using the provided request.

Specified by:
bind in interface ISessionStore
Parameters:
request - The request that triggered making a new sesion
newSession - The new session
See Also:
ISessionStore.bind(wicket.Request, wicket.Session)

unbind

public final void unbind(java.lang.String sessionId)
Description copied from interface: ISessionStore
Adds the provided new session to this facade using the provided request.

Specified by:
unbind in interface ISessionStore
Parameters:
sessionId - The SessionId that must be unbinded.
See Also:
ISessionStore.unbind(java.lang.String)

lookup

public Session lookup(Request request)
Description copied from interface: ISessionStore
Retrieves the session for the provided request from this facade.

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.

Specified by:
lookup in interface ISessionStore
Parameters:
request - The current request
Returns:
The session for the provided request or null if the session was not bound
See Also:
ISessionStore.lookup(wicket.Request)

toWebRequest

protected final WebRequest toWebRequest(Request request)
Cast Request to WebRequest.

Parameters:
request - The request to cast
Returns:
The web request

getHttpSession

protected final javax.servlet.http.HttpSession getHttpSession(WebRequest request)
Gets the underlying HttpSession object or null.

WARNING: it is a bad idea to depend on the http session object directly. Please use the classes and methods that are exposed by Wicket instead. Send an email to the mailing list in case it is not clear how to do things or you think you miss funcionality which causes you to depend on this directly.

Parameters:
request -
Returns:
The underlying HttpSession object.

onBind

protected void onBind(Request request,
                      Session newSession)
Template method that is called when a session is being bound to the session store. It is called before the session object itself is added to this store (which is done by calling ISessionStore.setAttribute(Request, String, Object) with key Session.SESSION_ATTRIBUTE_NAME.

Parameters:
request - The request
newSession - The new session

onUnbind

protected void onUnbind(java.lang.String sessionId)
Template method that is called when the session is being detached from the store, which typically happens when the httpsession was invalidated.

Parameters:
sessionId - The session id of the session that was invalidated.


Copyright © 2004-2007 Wicket developers. All Rights Reserved.