Nope I know and agree. But it's the only solution I could think of, and in my case it's just exploration.

Johan Compagner wrote:
And clustering is a problem. Its not a really good idea to hold on to
session objects outside the request. Even with no clustering but if
the container just flushes you session to disk then after another
request or the timeout you are not working with the same object
anymore

On 10/15/08, Nino Saturnino Martinez Vazquez Wael
<[EMAIL PROTECTED]> wrote:
Hi

I use this approach:

    @Override
    protected ISessionStore newSessionStore() {
        return new SecondLevelCacheSessionStore(this, new DiskPageStore()) {
            @Override
            protected void onBind(Request request, Session newSession) {

                sessionMap.put(newSession.getId(), (ZeuzSession)
newSession);
                super.onBind(request, newSession);
            }

            @Override
            protected void onUnbind(String sessionId) {
                ZeuzSession session = (ZeuzSession)
sessionMap.get(sessionId);
                session.onBeforeDestroy();
                sessionMap.remove(sessionId);
                super.onUnbind(sessionId);
            }

        };
    }

Session.java

    public void onBeforeDestroy() {
        getPerson().setLoggedIn(false);
    }

There are several problems(like what if the application crashes) with
this approach, but in my case it's okay.. I do not have trouble with
hibernate...

Mendeleev wrote:
I need to add functionality to my Wicket application that allows me to
record
in the MySQL database the exact time a user logs out of the application.
This includes recording the time the session is destroyed by the web
container due to user inactivity.

I tried:
1. An implementation of HttpSessionListener
2. Extending the HttpSessionStore class
3. WebApplication.sessionDestroyed(String sessionid)
4. An implementation of HttpSessionBindingListener

All of these do not work in my case, because the methods are called AFTER
the session is already destroyed. At that time, the hibernate session that
connects to the database, does not exist anymore. I cannot reopen it,
because the Application.get() method returns null at this time.

My question is: is there any way that I can record the destruction right
before it happens? Is there some sort of a listener I can implement?

If not, how is the wicket application notified that the user navigates
away
from the page, starting a period of inactivity? If there is a way I can
register that happening, I can solve the problem by adding a timer.

Thanks,
Drago

--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to