Re: Session destruction due to timeout...

2008-11-02 Thread schapes


Mendeleev wrote:
 
 I passed the application key and it worked. Thanks a lot for the help. 
 
 Would you be able to post your solution.  I am trying to solve the
 same problem.  Right now I am using the solution posted on this thread by
 Nino.  Do you have an alternate way of solving this problem without having
 to worry about issues when clustering?
 
 
 
 
 Johan Compagner wrote:
 
 no you cant and Application.get() will never work then because the auto
 destruct of a container
 doesnt do that in a request ofcourse but just somewhere on some thread.
 
 if you need an application object you could try:
 
 Application.get(String applicationKey)
 
 The session object is gone so you cant access it anymore.
 
 On Wed, Oct 15, 2008 at 10:40 AM, Mendeleev [EMAIL PROTECTED] 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
 --
 View this message in context:
 http://www.nabble.com/Session-destruction-due-to-timeout...-tp19989230p19989230.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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


 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Session-destruction-due-to-timeout...-tp19989230p20296278.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Session destruction due to timeout...

2008-10-21 Thread Mendeleev

I passed the application key and it worked. Thanks a lot for the help. 

Johan Compagner wrote:
 
 no you cant and Application.get() will never work then because the auto
 destruct of a container
 doesnt do that in a request ofcourse but just somewhere on some thread.
 
 if you need an application object you could try:
 
 Application.get(String applicationKey)
 
 The session object is gone so you cant access it anymore.
 
 On Wed, Oct 15, 2008 at 10:40 AM, Mendeleev [EMAIL PROTECTED] 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
 --
 View this message in context:
 http://www.nabble.com/Session-destruction-due-to-timeout...-tp19989230p19989230.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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


 
 

-- 
View this message in context: 
http://www.nabble.com/Session-destruction-due-to-timeout...-tp19989230p20088819.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Session destruction due to timeout...

2008-10-16 Thread Johan Compagner
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]



Re: Session destruction due to timeout...

2008-10-16 Thread Nino Saturnino Martinez Vazquez Wael
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]



Re: Session destruction due to timeout...

2008-10-15 Thread Nino Saturnino Martinez Vazquez Wael

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]



Session destruction due to timeout...

2008-10-15 Thread Mendeleev

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
-- 
View this message in context: 
http://www.nabble.com/Session-destruction-due-to-timeout...-tp19989230p19989230.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Session destruction due to timeout...

2008-10-15 Thread Johan Compagner
no you cant and Application.get() will never work then because the auto
destruct of a container
doesnt do that in a request ofcourse but just somewhere on some thread.

if you need an application object you could try:

Application.get(String applicationKey)

The session object is gone so you cant access it anymore.

On Wed, Oct 15, 2008 at 10:40 AM, Mendeleev [EMAIL PROTECTED] 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
 --
 View this message in context:
 http://www.nabble.com/Session-destruction-due-to-timeout...-tp19989230p19989230.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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