> Eelco Hillenius schrieb:
> > That won't solve your problem though. You'd get the same kind of call
> > back as you would get by overriding onUnbind in a custom session
> > store. It won't do anything for catching the event that a user closes
> > a browser without properly logging out.
>
> those methods are called either when the session timeout occurs in the app 
> server (and the user
> closed the browser long before) or the session gets invalidated manually.
> at least my experience...

Yes, and the same happens for AbstractHttpSessionStore#onUnbind

What that class does on #bind is this:

                // register an unbinding listener for cleaning up
                String applicationKey = application.getApplicationKey();
                httpSession.setAttribute("Wicket:SessionUnbindingListener-" + 
applicationKey,
                                new SessionBindingListener(applicationKey, 
httpSession.getId()));

where SessionBindingListener is this:

        /**
         * Reacts on unbinding from the session by cleaning up the session 
related
         * application data.
         */
        protected static final class SessionBindingListener
                        implements
                                HttpSessionBindingListener,
                                Serializable
        {
                private static final long serialVersionUID = 1L;

                /** Session id. */
                private final String sessionId;

                /** The unique key of the application within this web 
application. */
                private final String applicationKey;

                /** Whether it is already unbound. */
                private boolean unbound = false;

                /**
                 * Construct.
                 *
                 * @param applicationKey
                 *            The unique key of the application within this web
                 *            application
                 * @param sessionId
                 *            The session's id
                 */
                public SessionBindingListener(String applicationKey, String 
sessionId)
                {
                        this.applicationKey = applicationKey;
                        this.sessionId = sessionId;
                }

                /**
                 * @see 
javax.servlet.http.HttpSessionBindingListener#valueBound(javax.servlet.http.HttpSessionBindingEvent)
                 */
                public void valueBound(HttpSessionBindingEvent evg)
                {
                }

                /**
                 * @see 
javax.servlet.http.HttpSessionBindingListener#valueUnbound(javax.servlet.http.HttpSessionBindingEvent)
                 */
                public void valueUnbound(HttpSessionBindingEvent evt)
                {
                        if (!unbound)
                        {
                                unbound = true;
                                Application application = 
Application.get(applicationKey);
                                if (application != null)
                                {
                                        
application.getSessionStore().unbind(sessionId);
                                }
                        }
                }
        }

Eelco

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to