You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Andreas Lüdtke <sa...@t-online.de> on 2010/02/13 17:38:10 UTC

best way to detect session termination

I would like to detect the termination of the session to set the
"lastAccesTime" in the user profile. This should also happen if the session
times out.

I read in archive about a HttpSessionListener that should do the trick.
Unfortunately I can't find a place to install it.

Thanks

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: best way to detect session termination

Posted by Ilja Pavkovic <il...@binaere-bauten.de>.
Hi,

_userDao shouldn't be null if you annotate it in your applicationContext.xml 
and grep it out of the ApplicationContext, e.g.

applicationContext.getBean("sessionDestroyedService");

otherwise spring would have already failed as it was not able to autowire 
_userDao.

Best Regards,
	Ilja Pavkovic

Am Donnerstag, 18. Februar 2010 12:52:46 schrieb Andreas Lüdtke:
> Ilja,
> 
> thanks for your reply. If I create a service class like the one below, my
> _userDao object is always null. This _userDao works perfectly in other
> parts of my app. Do I need to inject the dao in a special way? I think the
> integration into spring is the problem, because I don't know where to
> place the corresponding part in the config/xml files. As I said, my
> knowledge of spring is limited.
> 
> My class looks like this:
> 
> @Service
> @Transactional
> public class SessionDestroyedService
> {
>   @ Autowired
>   private UserDao _userDao;
> 
>   public void forceLogout(String sessionId)
>   {
>     if (_userDao == null)
>       System.out.println("SessionDestroyedService.forceLogout(): _userDao
> is NULL");
>     else
>     {
>       System.out.println("SessionDestroyedService.forceLogout(): _userDao
> is OK");
>       User user = _userDao.getBySessionId(sessionId);
>       if (user != null)
>       {
> 	  // do the work here...
>       }
>     }
>   }
> }
> 
> Andreas
> 
> > -----Original Message-----
> > From: Ilja Pavkovic [mailto:ilja.pavkovic@binaere-bauten.de]
> > Sent: Wednesday, February 17, 2010 5:38 PM
> > To: users@wicket.apache.org
> > Subject: Re: best way to detect session termination
> > 
> > Hi,
> > 
> > create a service class marked with Annotation @Transactional
> > and manage it
> > with spring. Calls to this function will have get a session
> > from the spring
> > context.
> > 
> > Spring will open a session before calling any function on
> > this service and
> > close the session afterwards.
> > 
> > @Service
> > @Transactional
> > public class MyService {
> > 
> > 	@Autowired
> > 	private MyDao dao;
> > 	
> > 	public destroySession(String sessionId) {
> > 	
> > 		myDao.deleteMySessionById(sessionId);
> > 	
> > 	}
> > 
> > }
> > 
> > Best Regards,
> > 
> > 	Ilja Pavkovic
> > 
> > Am Mittwoch, 17. Februar 2010 13:24:11 schrieb Andreas Lüdtke:
> > > Vineet,
> > > 
> > > I'm now storing the session id in the user record. But now
> > 
> > I have another
> > 
> > > problem, because hibernate tells me now in sessionDestroy():
> > > 
> > > org.hibernate.HibernateException: No Hibernate Session
> > 
> > bound to thread, and
> > 
> > > configuration does not allow creation of non-transactional one here
> > > 
> > > I'm using spring to inject my dao. I also tried to use the dao in my
> > > HttpSessionListener which is configured in web.xml, but
> > 
> > that prevents my
> > 
> > > app from being started by Tomcat.
> > > Next I did was to create a manual created hibernate
> > 
> > session, but that
> > 
> > > raised other problems like a missing hibernate.hbm.xml file
> > 
> > and I don't
> > 
> > > want to configure that manually...
> > > 
> > > Does somebody see another way to access my user data, or am I doing
> > > something stupid?
> > > 
> > > Andreas
> > > 
> > > > -----Original Message-----
> > > > From: vineet semwal [mailto:vineetsemwal1982@gmail.com]
> > > > Sent: Tuesday, February 16, 2010 2:15 PM
> > > > To: users@wicket.apache.org; sam.luedtke@t-online.de
> > > > Subject: Re: best way to detect session termination
> > > > 
> > > > can't you simply do that in
> > > > webapplication.sessiondestroy(String sessionid),
> > > > 
> > > >  you can store the sessionid when user logs in and on
> > 
> > sessiondestroyed
> > 
> > > > ,search the user by this sessionid ,
> > > > and change whatever in user object and then persist it..
> > > > 
> > > > On Tue, Feb 16, 2010 at 6:23 PM, Andreas Lüdtke
> > > > 
> > > > <sa...@t-online.de>wrote:
> > > > > I studied the classes HttpSessionBindingListener and
> > > > > AbstractHttpSessionStore
> > > > > as you noted, but I think I'll still have no link between
> > > > 
> > > > the SessionId
> > > > 
> > > > > from
> > > > > the HTTPSession and my own Session. Maybe I'm missing
> > > > 
> > > > something or "I don't
> > > > 
> > > > > see the wood among all the trees" as we say in Germany...
> > > > > 
> > > > > Andreas
> > > > > 
> > > > > > -----Original Message-----
> > > > > > From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
> > > > > > Sent: Monday, February 15, 2010 7:08 PM
> > > > > > To: sam.luedtke@t-online.de
> > > > > > Cc: users@wicket.apache.org
> > > > > > Subject: Re: best way to detect session termination
> > > > > > 
> > > > > > You could use a HttpSessionBindingListener like Wicket
> > > > 
> > > > does internally
> > > > 
> > > > > > (see AbstractHttpSessionStore). Or as a hack store
> > > > 
> > > > references to the
> > > > 
> > > > > > session objects in the session listener. That's the
> > 
> > easy fix, but
> > 
> > > > > > doesn't scale if you need session replication (unless
> > > > 
> > > > maybe you use
> > > > 
> > > > > > e.g. Terracotta).
> > > > > > 
> > > > > > Eelco
> > > > > > 
> > > > > > On Sun, Feb 14, 2010 at 4:36 AM, Andreas Lüdtke
> > > > > > 
> > > > > > <sa...@t-online.de> wrote:
> > > > > > > Hi Eelco,
> > > > > > > 
> > > > > > > thanks for the hint. Now I can detect the end of a session.
> > > > > > 
> > > > > > Unfortunately I
> > > > > > 
> > > > > > > can't access my own wicket session in that
> > > > > > 
> > > > > > sessionDestroyed() method in order
> > > > > > 
> > > > > > > to get the info about the connected user. I've got ther
> > > > > > 
> > > > > > error message
> > > > > > 
> > > > > > > "java.lang.IllegalStateException: you can only locate or
> > > > > > 
> > > > > > create sessions in
> > > > > > 
> > > > > > > the context of a request cycle".
> > > > > > > 
> > > > > > > Do you know how I can achieve this?
> > > > > > > 
> > > > > > > Andreas
> > > > > > > 
> > > > > > >> -----Original Message-----
> > > > > > >> From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
> > > > > > >> Sent: Saturday, February 13, 2010 7:02 PM
> > > > > > >> To: users@wicket.apache.org; sam.luedtke@t-online.de
> > > > > > >> Subject: Re: best way to detect session termination
> > 
> > http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7
> > 
> > > > > > >> Eelco
> > > > > > >> 
> > > > > > >> On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke
> > > > > > >> 
> > > > > > >> <sa...@t-online.de> wrote:
> > > > > > >> > I would like to detect the termination of the
> > > > 
> > > > session to set the
> > > > 
> > > > > > >> > "lastAccesTime" in the user profile. This should also
> > > > > > >> 
> > > > > > >> happen if the session
> > > > > > >> 
> > > > > > >> > times out.
> > > > > > >> > 
> > > > > > >> > I read in archive about a HttpSessionListener that should
> > > > > > >> 
> > > > > > >> do the trick.
> > > > > > >> 
> > > > > > >> > Unfortunately I can't find a place to install it.
> > > > > > >> > 
> > > > > > >> > Thanks
> > > > > > >> > 
> > > > > > >> > Andreas
> > 
> > ---------------------------------------------------------------------
> > 
> > > > > > >> > To unsubscribe, e-mail:
> > users-unsubscribe@wicket.apache.org
> > 
> > > > > > >> > For additional commands, e-mail:
> > users-help@wicket.apache.org
> > 
> > 
> > ---------------------------------------------------------------------
> > 
> > > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > 
> > ---------------------------------------------------------------------
> > 
> > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > 
> > ---------------------------------------------------------------------
> > 
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org


-- 
binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin

   +49 · 171 · 9342 465

Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. Jost Becker

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: best way to detect session termination

Posted by Andreas Lüdtke <sa...@t-online.de>.
Ilja,

thanks for your reply. If I create a service class like the one below, my
_userDao object is always null. This _userDao works perfectly in other parts
of my app. Do I need to inject the dao in a special way? I think the
integration into spring is the problem, because I don't know where to place
the corresponding part in the config/xml files. As I said, my knowledge of
spring is limited.

My class looks like this:

@Service
@Transactional
public class SessionDestroyedService
{
  @ Autowired
  private UserDao _userDao;

  public void forceLogout(String sessionId)
  {
    if (_userDao == null)
      System.out.println("SessionDestroyedService.forceLogout(): _userDao is
NULL");
    else
    {
      System.out.println("SessionDestroyedService.forceLogout(): _userDao is
OK");
      User user = _userDao.getBySessionId(sessionId);
      if (user != null)
      {
	  // do the work here...
      }
    }
  }
} 

Andreas


> -----Original Message-----
> From: Ilja Pavkovic [mailto:ilja.pavkovic@binaere-bauten.de] 
> Sent: Wednesday, February 17, 2010 5:38 PM
> To: users@wicket.apache.org
> Subject: Re: best way to detect session termination
> 
> Hi,
> 
> create a service class marked with Annotation @Transactional 
> and manage it 
> with spring. Calls to this function will have get a session 
> from the spring 
> context. 
> 
> Spring will open a session before calling any function on 
> this service and 
> close the session afterwards. 
> 
> @Service
> @Transactional
> public class MyService {
> 	@Autowired 
> 	private MyDao dao;
> 
> 	public destroySession(String sessionId) {
> 		myDao.deleteMySessionById(sessionId);
> 	}
> }
> 
> Best Regards,
> 	Ilja Pavkovic
> 
> Am Mittwoch, 17. Februar 2010 13:24:11 schrieb Andreas Lüdtke:
> > Vineet,
> > 
> > I'm now storing the session id in the user record. But now 
> I have another
> > problem, because hibernate tells me now in sessionDestroy():
> > 
> > org.hibernate.HibernateException: No Hibernate Session 
> bound to thread, and
> > configuration does not allow creation of non-transactional one here
> > 
> > I'm using spring to inject my dao. I also tried to use the dao in my
> > HttpSessionListener which is configured in web.xml, but 
> that prevents my
> > app from being started by Tomcat.
> > Next I did was to create a manual created hibernate 
> session, but that
> > raised other problems like a missing hibernate.hbm.xml file 
> and I don't
> > want to configure that manually...
> > 
> > Does somebody see another way to access my user data, or am I doing
> > something stupid?
> > 
> > Andreas
> > 
> > > -----Original Message-----
> > > From: vineet semwal [mailto:vineetsemwal1982@gmail.com]
> > > Sent: Tuesday, February 16, 2010 2:15 PM
> > > To: users@wicket.apache.org; sam.luedtke@t-online.de
> > > Subject: Re: best way to detect session termination
> > > 
> > > can't you simply do that in
> > > webapplication.sessiondestroy(String sessionid),
> > > 
> > >  you can store the sessionid when user logs in and on 
> sessiondestroyed
> > > 
> > > ,search the user by this sessionid ,
> > > and change whatever in user object and then persist it..
> > > 
> > > On Tue, Feb 16, 2010 at 6:23 PM, Andreas Lüdtke
> > > 
> > > <sa...@t-online.de>wrote:
> > > > I studied the classes HttpSessionBindingListener and
> > > > AbstractHttpSessionStore
> > > > as you noted, but I think I'll still have no link between
> > > 
> > > the SessionId
> > > 
> > > > from
> > > > the HTTPSession and my own Session. Maybe I'm missing
> > > 
> > > something or "I don't
> > > 
> > > > see the wood among all the trees" as we say in Germany...
> > > > 
> > > > Andreas
> > > > 
> > > > > -----Original Message-----
> > > > > From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
> > > > > Sent: Monday, February 15, 2010 7:08 PM
> > > > > To: sam.luedtke@t-online.de
> > > > > Cc: users@wicket.apache.org
> > > > > Subject: Re: best way to detect session termination
> > > > > 
> > > > > You could use a HttpSessionBindingListener like Wicket
> > > 
> > > does internally
> > > 
> > > > > (see AbstractHttpSessionStore). Or as a hack store
> > > 
> > > references to the
> > > 
> > > > > session objects in the session listener. That's the 
> easy fix, but
> > > > > doesn't scale if you need session replication (unless
> > > 
> > > maybe you use
> > > 
> > > > > e.g. Terracotta).
> > > > > 
> > > > > Eelco
> > > > > 
> > > > > On Sun, Feb 14, 2010 at 4:36 AM, Andreas Lüdtke
> > > > > 
> > > > > <sa...@t-online.de> wrote:
> > > > > > Hi Eelco,
> > > > > > 
> > > > > > thanks for the hint. Now I can detect the end of a session.
> > > > > 
> > > > > Unfortunately I
> > > > > 
> > > > > > can't access my own wicket session in that
> > > > > 
> > > > > sessionDestroyed() method in order
> > > > > 
> > > > > > to get the info about the connected user. I've got ther
> > > > > 
> > > > > error message
> > > > > 
> > > > > > "java.lang.IllegalStateException: you can only locate or
> > > > > 
> > > > > create sessions in
> > > > > 
> > > > > > the context of a request cycle".
> > > > > > 
> > > > > > Do you know how I can achieve this?
> > > > > > 
> > > > > > Andreas
> > > > > > 
> > > > > >> -----Original Message-----
> > > > > >> From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
> > > > > >> Sent: Saturday, February 13, 2010 7:02 PM
> > > > > >> To: users@wicket.apache.org; sam.luedtke@t-online.de
> > > > > >> Subject: Re: best way to detect session termination
> > > 
> > > 
> http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7
> > > 
> > > > > >> Eelco
> > > > > >> 
> > > > > >> On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke
> > > > > >> 
> > > > > >> <sa...@t-online.de> wrote:
> > > > > >> > I would like to detect the termination of the
> > > 
> > > session to set the
> > > 
> > > > > >> > "lastAccesTime" in the user profile. This should also
> > > > > >> 
> > > > > >> happen if the session
> > > > > >> 
> > > > > >> > times out.
> > > > > >> > 
> > > > > >> > I read in archive about a HttpSessionListener that should
> > > > > >> 
> > > > > >> do the trick.
> > > > > >> 
> > > > > >> > Unfortunately I can't find a place to install it.
> > > > > >> > 
> > > > > >> > Thanks
> > > > > >> > 
> > > > > >> > Andreas
> > > 
> > > 
> ---------------------------------------------------------------------
> > > 
> > > > > >> > To unsubscribe, e-mail: 
> users-unsubscribe@wicket.apache.org
> > > > > >> > For additional commands, e-mail: 
> users-help@wicket.apache.org
> > > 
> > > 
> ---------------------------------------------------------------------
> > > 
> > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > 
> > > 
> ---------------------------------------------------------------------
> > > 
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> -- 
> binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin
> 
>    +49 · 171 · 9342 465
> 
> Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
> Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. 
> Jost Becker
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: best way to detect session termination

Posted by Ilja Pavkovic <il...@binaere-bauten.de>.
Hi,

create a service class marked with Annotation @Transactional and manage it 
with spring. Calls to this function will have get a session from the spring 
context. 

Spring will open a session before calling any function on this service and 
close the session afterwards. 

@Service
@Transactional
public class MyService {
	@Autowired 
	private MyDao dao;

	public destroySession(String sessionId) {
		myDao.deleteMySessionById(sessionId);
	}
}

Best Regards,
	Ilja Pavkovic

Am Mittwoch, 17. Februar 2010 13:24:11 schrieb Andreas Lüdtke:
> Vineet,
> 
> I'm now storing the session id in the user record. But now I have another
> problem, because hibernate tells me now in sessionDestroy():
> 
> org.hibernate.HibernateException: No Hibernate Session bound to thread, and
> configuration does not allow creation of non-transactional one here
> 
> I'm using spring to inject my dao. I also tried to use the dao in my
> HttpSessionListener which is configured in web.xml, but that prevents my
> app from being started by Tomcat.
> Next I did was to create a manual created hibernate session, but that
> raised other problems like a missing hibernate.hbm.xml file and I don't
> want to configure that manually...
> 
> Does somebody see another way to access my user data, or am I doing
> something stupid?
> 
> Andreas
> 
> > -----Original Message-----
> > From: vineet semwal [mailto:vineetsemwal1982@gmail.com]
> > Sent: Tuesday, February 16, 2010 2:15 PM
> > To: users@wicket.apache.org; sam.luedtke@t-online.de
> > Subject: Re: best way to detect session termination
> > 
> > can't you simply do that in
> > webapplication.sessiondestroy(String sessionid),
> > 
> >  you can store the sessionid when user logs in and on sessiondestroyed
> > 
> > ,search the user by this sessionid ,
> > and change whatever in user object and then persist it..
> > 
> > On Tue, Feb 16, 2010 at 6:23 PM, Andreas Lüdtke
> > 
> > <sa...@t-online.de>wrote:
> > > I studied the classes HttpSessionBindingListener and
> > > AbstractHttpSessionStore
> > > as you noted, but I think I'll still have no link between
> > 
> > the SessionId
> > 
> > > from
> > > the HTTPSession and my own Session. Maybe I'm missing
> > 
> > something or "I don't
> > 
> > > see the wood among all the trees" as we say in Germany...
> > > 
> > > Andreas
> > > 
> > > > -----Original Message-----
> > > > From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
> > > > Sent: Monday, February 15, 2010 7:08 PM
> > > > To: sam.luedtke@t-online.de
> > > > Cc: users@wicket.apache.org
> > > > Subject: Re: best way to detect session termination
> > > > 
> > > > You could use a HttpSessionBindingListener like Wicket
> > 
> > does internally
> > 
> > > > (see AbstractHttpSessionStore). Or as a hack store
> > 
> > references to the
> > 
> > > > session objects in the session listener. That's the easy fix, but
> > > > doesn't scale if you need session replication (unless
> > 
> > maybe you use
> > 
> > > > e.g. Terracotta).
> > > > 
> > > > Eelco
> > > > 
> > > > On Sun, Feb 14, 2010 at 4:36 AM, Andreas Lüdtke
> > > > 
> > > > <sa...@t-online.de> wrote:
> > > > > Hi Eelco,
> > > > > 
> > > > > thanks for the hint. Now I can detect the end of a session.
> > > > 
> > > > Unfortunately I
> > > > 
> > > > > can't access my own wicket session in that
> > > > 
> > > > sessionDestroyed() method in order
> > > > 
> > > > > to get the info about the connected user. I've got ther
> > > > 
> > > > error message
> > > > 
> > > > > "java.lang.IllegalStateException: you can only locate or
> > > > 
> > > > create sessions in
> > > > 
> > > > > the context of a request cycle".
> > > > > 
> > > > > Do you know how I can achieve this?
> > > > > 
> > > > > Andreas
> > > > > 
> > > > >> -----Original Message-----
> > > > >> From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
> > > > >> Sent: Saturday, February 13, 2010 7:02 PM
> > > > >> To: users@wicket.apache.org; sam.luedtke@t-online.de
> > > > >> Subject: Re: best way to detect session termination
> > 
> > http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7
> > 
> > > > >> Eelco
> > > > >> 
> > > > >> On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke
> > > > >> 
> > > > >> <sa...@t-online.de> wrote:
> > > > >> > I would like to detect the termination of the
> > 
> > session to set the
> > 
> > > > >> > "lastAccesTime" in the user profile. This should also
> > > > >> 
> > > > >> happen if the session
> > > > >> 
> > > > >> > times out.
> > > > >> > 
> > > > >> > I read in archive about a HttpSessionListener that should
> > > > >> 
> > > > >> do the trick.
> > > > >> 
> > > > >> > Unfortunately I can't find a place to install it.
> > > > >> > 
> > > > >> > Thanks
> > > > >> > 
> > > > >> > Andreas
> > 
> > ---------------------------------------------------------------------
> > 
> > > > >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > >> > For additional commands, e-mail: users-help@wicket.apache.org
> > 
> > ---------------------------------------------------------------------
> > 
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > 
> > ---------------------------------------------------------------------
> > 
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org


-- 
binaere bauten gmbh · tempelhofer ufer 1a · 10961 berlin

   +49 · 171 · 9342 465

Handelsregister: HRB 115854 - Amtsgericht Charlottenburg
Geschäftsführer: Dipl.-Inform. Ilja Pavkovic, Dipl.-Inform. Jost Becker

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: best way to detect session termination

Posted by vineet semwal <vi...@gmail.com>.
i think i didn't use my words correctly :(
with  "you can store the sessionid when user logs in" i mean persist user
object  with sessionid when
the user signed in ...


On Tue, Feb 16, 2010 at 6:45 PM, vineet semwal
<vi...@gmail.com>wrote:

> can't you simply do that in webapplication.sessiondestroy(String
> sessionid),
>  you can store the sessionid when user logs in and on sessiondestroyed
> ,search the user by this sessionid ,
> and change whatever in user object and then persist it..
>
>
> On Tue, Feb 16, 2010 at 6:23 PM, Andreas Lüdtke <sa...@t-online.de>wrote:
>
>> I studied the classes HttpSessionBindingListener and
>> AbstractHttpSessionStore
>> as you noted, but I think I'll still have no link between the SessionId
>> from
>> the HTTPSession and my own Session. Maybe I'm missing something or "I
>> don't
>> see the wood among all the trees" as we say in Germany...
>>
>> Andreas
>>
>> > -----Original Message-----
>> > From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
>> > Sent: Monday, February 15, 2010 7:08 PM
>> > To: sam.luedtke@t-online.de
>> > Cc: users@wicket.apache.org
>> > Subject: Re: best way to detect session termination
>> >
>> > You could use a HttpSessionBindingListener like Wicket does internally
>> > (see AbstractHttpSessionStore). Or as a hack store references to the
>> > session objects in the session listener. That's the easy fix, but
>> > doesn't scale if you need session replication (unless maybe you use
>> > e.g. Terracotta).
>> >
>> > Eelco
>> >
>> > On Sun, Feb 14, 2010 at 4:36 AM, Andreas Lüdtke
>> > <sa...@t-online.de> wrote:
>> > > Hi Eelco,
>> > >
>> > > thanks for the hint. Now I can detect the end of a session.
>> > Unfortunately I
>> > > can't access my own wicket session in that
>> > sessionDestroyed() method in order
>> > > to get the info about the connected user. I've got ther
>> > error message
>> > > "java.lang.IllegalStateException: you can only locate or
>> > create sessions in
>> > > the context of a request cycle".
>> > >
>> > > Do you know how I can achieve this?
>> > >
>> > > Andreas
>> > >
>> > >> -----Original Message-----
>> > >> From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
>> > >> Sent: Saturday, February 13, 2010 7:02 PM
>> > >> To: users@wicket.apache.org; sam.luedtke@t-online.de
>> > >> Subject: Re: best way to detect session termination
>> > >>
>> > >> http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7
>> > >>
>> > >> Eelco
>> > >>
>> > >> On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke
>> > >> <sa...@t-online.de> wrote:
>> > >> > I would like to detect the termination of the session to set the
>> > >> > "lastAccesTime" in the user profile. This should also
>> > >> happen if the session
>> > >> > times out.
>> > >> >
>> > >> > I read in archive about a HttpSessionListener that should
>> > >> do the trick.
>> > >> > Unfortunately I can't find a place to install it.
>> > >> >
>> > >> > Thanks
>> > >> >
>> > >> > Andreas
>> > >> >
>> > >> >
>> > >> >
>> > >>
>> > ---------------------------------------------------------------------
>> > >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > >> > For additional commands, e-mail: users-help@wicket.apache.org
>> > >> >
>> > >> >
>> > >>
>> > >
>> > >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
> regards,
> Vineet Semwal
>



-- 
regards,
Vineet Semwal

RE: best way to detect session termination

Posted by Andreas Lüdtke <sa...@t-online.de>.
Vineet,

thanks for the snippet. When I try your code, I get again an error message
saying:

org.hibernate.HibernateException: No Hibernate Session bound to thread, and
configuration does not allow creation of non-transactional one here

So, how can I bind the hibernate session to my thread? Or do I need to change
the configuration?

Andreas 

> -----Original Message-----
> From: vineet semwal [mailto:vineetsemwal1982@gmail.com] 
> Sent: Wednesday, February 17, 2010 5:02 PM
> To: users@wicket.apache.org; sam.luedtke@t-online.de
> Subject: Re: best way to detect session termination
> 
> a small example,
> WebApplicationContextUtils.getRequiredWebApplicationContext(ge
> tServletContext()).getBean("name")
> 
> On Wed, Feb 17, 2010 at 8:50 PM, vineet semwal
> <vi...@gmail.com>wrote:
> 
> >
> > quick solution to do by retrieving the bean from spring 
> applicationcontext
> > in your webapplication,
> > it will work but i am not sure how good the solution is .
> >
> >
> >
> > On Wed, Feb 17, 2010 at 5:54 PM, Andreas Lüdtke 
> <sa...@t-online.de>wrote:
> >
> >> Vineet,
> >>
> >> I'm now storing the session id in the user record. But now 
> I have another
> >> problem, because hibernate tells me now in sessionDestroy():
> >>
> >> org.hibernate.HibernateException: No Hibernate Session 
> bound to thread,
> >> and
> >> configuration does not allow creation of non-transactional one here
> >>
> >> I'm using spring to inject my dao. I also tried to use the 
> dao in my
> >> HttpSessionListener which is configured in web.xml, but 
> that prevents my
> >> app
> >> from being started by Tomcat.
> >> Next I did was to create a manual created hibernate 
> session, but that
> >> raised
> >> other problems like a missing hibernate.hbm.xml file and I 
> don't want to
> >> configure that manually...
> >>
> >> Does somebody see another way to access my user data, or am I doing
> >> something
> >> stupid?
> >>
> >> Andreas
> >>
> >>
> >> > -----Original Message-----
> >> > From: vineet semwal [mailto:vineetsemwal1982@gmail.com]
> >> > Sent: Tuesday, February 16, 2010 2:15 PM
> >> > To: users@wicket.apache.org; sam.luedtke@t-online.de
> >> > Subject: Re: best way to detect session termination
> >> >
> >> > can't you simply do that in
> >> > webapplication.sessiondestroy(String sessionid),
> >> >  you can store the sessionid when user logs in and on 
> sessiondestroyed
> >> > ,search the user by this sessionid ,
> >> > and change whatever in user object and then persist it..
> >> >
> >> > On Tue, Feb 16, 2010 at 6:23 PM, Andreas Lüdtke
> >> > <sa...@t-online.de>wrote:
> >> >
> >> > > I studied the classes HttpSessionBindingListener and
> >> > > AbstractHttpSessionStore
> >> > > as you noted, but I think I'll still have no link between
> >> > the SessionId
> >> > > from
> >> > > the HTTPSession and my own Session. Maybe I'm missing
> >> > something or "I don't
> >> > > see the wood among all the trees" as we say in Germany...
> >> > >
> >> > > Andreas
> >> > >
> >> > > > -----Original Message-----
> >> > > > From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
> >> > > > Sent: Monday, February 15, 2010 7:08 PM
> >> > > > To: sam.luedtke@t-online.de
> >> > > > Cc: users@wicket.apache.org
> >> > > > Subject: Re: best way to detect session termination
> >> > > >
> >> > > > You could use a HttpSessionBindingListener like Wicket
> >> > does internally
> >> > > > (see AbstractHttpSessionStore). Or as a hack store
> >> > references to the
> >> > > > session objects in the session listener. That's the 
> easy fix, but
> >> > > > doesn't scale if you need session replication (unless
> >> > maybe you use
> >> > > > e.g. Terracotta).
> >> > > >
> >> > > > Eelco
> >> > > >
> >> > > > On Sun, Feb 14, 2010 at 4:36 AM, Andreas Lüdtke
> >> > > > <sa...@t-online.de> wrote:
> >> > > > > Hi Eelco,
> >> > > > >
> >> > > > > thanks for the hint. Now I can detect the end of a session.
> >> > > > Unfortunately I
> >> > > > > can't access my own wicket session in that
> >> > > > sessionDestroyed() method in order
> >> > > > > to get the info about the connected user. I've got ther
> >> > > > error message
> >> > > > > "java.lang.IllegalStateException: you can only locate or
> >> > > > create sessions in
> >> > > > > the context of a request cycle".
> >> > > > >
> >> > > > > Do you know how I can achieve this?
> >> > > > >
> >> > > > > Andreas
> >> > > > >
> >> > > > >> -----Original Message-----
> >> > > > >> From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
> >> > > > >> Sent: Saturday, February 13, 2010 7:02 PM
> >> > > > >> To: users@wicket.apache.org; sam.luedtke@t-online.de
> >> > > > >> Subject: Re: best way to detect session termination
> >> > > > >>
> >> > > > >>
> >> > 
> http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7
> >> > > > >>
> >> > > > >> Eelco
> >> > > > >>
> >> > > > >> On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke
> >> > > > >> <sa...@t-online.de> wrote:
> >> > > > >> > I would like to detect the termination of the
> >> > session to set the
> >> > > > >> > "lastAccesTime" in the user profile. This should also
> >> > > > >> happen if the session
> >> > > > >> > times out.
> >> > > > >> >
> >> > > > >> > I read in archive about a HttpSessionListener 
> that should
> >> > > > >> do the trick.
> >> > > > >> > Unfortunately I can't find a place to install it.
> >> > > > >> >
> >> > > > >> > Thanks
> >> > > > >> >
> >> > > > >> > Andreas
> >> > > > >> >
> >> > > > >> >
> >> > > > >> >
> >> > > > >>
> >> > > >
> >> > 
> ---------------------------------------------------------------------
> >> > > > >> > To unsubscribe, e-mail: 
> users-unsubscribe@wicket.apache.org
> >> > > > >> > For additional commands, e-mail: 
> users-help@wicket.apache.org
> >> > > > >> >
> >> > > > >> >
> >> > > > >>
> >> > > > >
> >> > > > >
> >> > > >
> >> > > >
> >> > 
> ---------------------------------------------------------------------
> >> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> > > > For additional commands, e-mail: users-help@wicket.apache.org
> >> > > >
> >> > > >
> >> > >
> >> > >
> >> > >
> >> > 
> ---------------------------------------------------------------------
> >> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> > > For additional commands, e-mail: users-help@wicket.apache.org
> >> > >
> >> > >
> >> >
> >> >
> >> > --
> >> > regards,
> >> > Vineet Semwal
> >> >
> >>
> >>
> >> 
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> >
> > --
> > regards,
> > Vineet Semwal
> >
> 
> 
> 
> -- 
> regards,
> Vineet Semwal
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: (Form) Use two TextFields for one object property?

Posted by srm <sr...@schokokeks.org>.
Am 18.02.2010 um 23:08 schrieb Igor Vaynberg:

> <snip...snap>
> -igor
> 

Thank you,

I have to look into this as I have never directly worked with the
FormComponentModel.
Every day something new :)

Regards,
Stephan

> On Thu, Feb 18, 2010 at 2:02 PM, srm <sr...@schokokeks.org> wrote:
>> 
>> Am 18.02.2010 um 22:56 schrieb Andrew Lombardi:
>> 
>>> It depends what your domain object looks like, if it's just a simple string you'll have to save the results of those two textfield's in their own model, and then merge them in the onSubmit method.
>>> 
>> 
>> It's a int property. I was thinking about using the onSubmit method but
>> how will this interfere with the PropertyModel setting the value according to
>> TextField's value? Does this happen before onSubmit or after onSubmit?
>> 
>> If that happens before, I surely can overwrite the DO's property (set via the
>> PropertyModel) in the onSubmit().
>> 
>> Regards,
>> Stephan
>> 
>>> On Feb 18, 2010, at 1:41 PM, srm wrote:
>>> 
>>>> Hi List,
>>>> 
>>>> the following may looked flawed, so I'm happy to hear your suggestions: I have a RegisterNewItem Form where a user can add new Items to a shop/database. I have items of type CD (audiocd) with an attribute PlayTime. I store this value as seconds and calculate the minutes to display at runtime. For adding a new CD, I thought that it would be inconvenient to have the user entering either seconds only, or how to agree on a format like Min:Sec OR Min.Sec etc. My idea now is to provide two textFields, one for the minutes and one for the additional seconds. Now I have no idea how to properly use the model of the textfields and the item-object, to calculate the seconds from both fields at submit time. Any help appreciated.
>>>> 
>>>> Please see the code from the Panel below (currently without a textfield for the playtime).
>>>> 
>>>> Regards,
>>>> Stephan
>>>> 
>>>> 
>>>> public class AddCDPanel extends AddItemPanel {
>>>> 
>>>> 
>>>>      /**
>>>>       * auto-generated UID
>>>>       */
>>>>      private static final long serialVersionUID = 5390579612171776545L;
>>>> 
>>>>      public AddCDPanel(String id) {
>>>>              super(id, new CD());
>>>> 
>>>>              TextField labelTextField = new TextField("label", new PropertyModel(itemToInsert,"label"));
>>>>              FeedbackLabel labelFeedback = new FeedbackLabel("label.feedback", labelTextField);
>>>>              addItemForm.add(labelTextField.setRequired(true));
>>>>              addItemForm.add(labelFeedback);
>>>> 
>>>>              TextField artistTextField = new TextField("artist", new PropertyModel(itemToInsert,"artist"));
>>>>              FeedbackLabel artistFeedback = new FeedbackLabel("artist.feedback", artistTextField);
>>>>              addItemForm.add(artistTextField.setRequired(true));
>>>>              addItemForm.add(artistFeedback);
>>>> 
>>>>      }
>>>> }
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>> 
>>> 
>>> 
>>> To our success!
>>> 
>>> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
>>> 
>>> ANDREW LOMBARDI | andrew@mysticcoders.com
>>> 2321 E 4th St. Ste C-128, Santa Ana CA 92705
>>> ofc: 714-816-4488
>>> fax: 714-782-6024
>>> cell: 714-697-8046
>>> linked-in: http://www.linkedin.com/in/andrewlombardi
>>> twitter: http://www.twitter.com/kinabalu
>>> 
>>> Eco-Tip: Printing e-mails is usually a waste.
>>> 
>>> ========================================================
>>> This message is for the named person's use only. You must not, directly or indirectly, use,
>>> disclose, distribute, print, or copy any part of this message if you are not the intended recipient.
>>> ========================================================
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: (Form) Use two TextFields for one object property? (SOLVED)

Posted by Eelco Hillenius <ee...@gmail.com>.
> A thousand thanks. Works like a charm.
> Though I don't fully understand how the values are
> passed through the components/models.

It's three components, one parent (that holds the ultimate value) and
two children (that both hold values used to calculate the parent
value.

> convertinput() {
>    int mins=minutes.getconvertedinput();
>    int secs=seconds.getconvertedinput();
>    setconvertedinput(mins*60+secs);
> }

updates the parent (setConvertedInput) with one value that comes from
the minutes and seconds fields.

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: (Form) Use two TextFields for one object property? (SOLVED)

Posted by srm <sr...@schokokeks.org>.
> class lengthtextfield extends formcomponentpanel {
> private final textfield minutes;
> private final textfield seconds;
> 
> public lengthtextfield(string id, imodel<integer> model) {
>  super(id, model);
>  minutes=new textfield("min",new model(model.getobject()/60),integer.class);
>  seconds=new textfield("min",new model(model.getobject()%60),integer.class);
> }
> 
> convertinput() {
>    int mins=minutes.getconvertedinput();
>    int secs=seconds.getconvertedinput();
>    setconvertedinput(mins*60+secs);
> }
> }
> 
> <wicket:panel><input type="text" wicket:id="minutes"/>:<input
> type="text" wicket:id="seconds"/></wicket:panel>
> 
> -igor
> 

A thousand thanks. Works like a charm.
Though I don't fully understand how the values are
passed through the components/models.

Regards,
Stephan

> On Thu, Feb 18, 2010 at 2:02 PM, srm <sr...@schokokeks.org> wrote:
>> 
>> Am 18.02.2010 um 22:56 schrieb Andrew Lombardi:
>> 
>>> It depends what your domain object looks like, if it's just a simple string you'll have to save the results of those two textfield's in their own model, and then merge them in the onSubmit method.
>>> 
>> 
>> It's a int property. I was thinking about using the onSubmit method but
>> how will this interfere with the PropertyModel setting the value according to
>> TextField's value? Does this happen before onSubmit or after onSubmit?
>> 
>> If that happens before, I surely can overwrite the DO's property (set via the
>> PropertyModel) in the onSubmit().
>> 
>> Regards,
>> Stephan
>> 
>>> On Feb 18, 2010, at 1:41 PM, srm wrote:
>>> 
>>>> Hi List,
>>>> 
>>>> the following may looked flawed, so I'm happy to hear your suggestions: I have a RegisterNewItem Form where a user can add new Items to a shop/database. I have items of type CD (audiocd) with an attribute PlayTime. I store this value as seconds and calculate the minutes to display at runtime. For adding a new CD, I thought that it would be inconvenient to have the user entering either seconds only, or how to agree on a format like Min:Sec OR Min.Sec etc. My idea now is to provide two textFields, one for the minutes and one for the additional seconds. Now I have no idea how to properly use the model of the textfields and the item-object, to calculate the seconds from both fields at submit time. Any help appreciated.
>>>> 
>>>> Please see the code from the Panel below (currently without a textfield for the playtime).
>>>> 
>>>> Regards,
>>>> Stephan
>>>> 
>>>> 
>>>> public class AddCDPanel extends AddItemPanel {
>>>> 
>>>> 
>>>>      /**
>>>>       * auto-generated UID
>>>>       */
>>>>      private static final long serialVersionUID = 5390579612171776545L;
>>>> 
>>>>      public AddCDPanel(String id) {
>>>>              super(id, new CD());
>>>> 
>>>>              TextField labelTextField = new TextField("label", new PropertyModel(itemToInsert,"label"));
>>>>              FeedbackLabel labelFeedback = new FeedbackLabel("label.feedback", labelTextField);
>>>>              addItemForm.add(labelTextField.setRequired(true));
>>>>              addItemForm.add(labelFeedback);
>>>> 
>>>>              TextField artistTextField = new TextField("artist", new PropertyModel(itemToInsert,"artist"));
>>>>              FeedbackLabel artistFeedback = new FeedbackLabel("artist.feedback", artistTextField);
>>>>              addItemForm.add(artistTextField.setRequired(true));
>>>>              addItemForm.add(artistFeedback);
>>>> 
>>>>      }
>>>> }
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>> 
>>> 
>>> 
>>> To our success!
>>> 
>>> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
>>> 
>>> ANDREW LOMBARDI | andrew@mysticcoders.com
>>> 2321 E 4th St. Ste C-128, Santa Ana CA 92705
>>> ofc: 714-816-4488
>>> fax: 714-782-6024
>>> cell: 714-697-8046
>>> linked-in: http://www.linkedin.com/in/andrewlombardi
>>> twitter: http://www.twitter.com/kinabalu
>>> 
>>> Eco-Tip: Printing e-mails is usually a waste.
>>> 
>>> ========================================================
>>> This message is for the named person's use only. You must not, directly or indirectly, use,
>>> disclose, distribute, print, or copy any part of this message if you are not the intended recipient.
>>> ========================================================
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: (Form) Use two TextFields for one object property?

Posted by Igor Vaynberg <ig...@gmail.com>.
class lengthtextfield extends formcomponentpanel {
private final textfield minutes;
private final textfield seconds;

public lengthtextfield(string id, imodel<integer> model) {
  super(id, model);
  minutes=new textfield("min",new model(model.getobject()/60),integer.class);
  seconds=new textfield("min",new model(model.getobject()%60),integer.class);
}

convertinput() {
    int mins=minutes.getconvertedinput();
    int secs=seconds.getconvertedinput();
    setconvertedinput(mins*60+secs);
}
}

<wicket:panel><input type="text" wicket:id="minutes"/>:<input
type="text" wicket:id="seconds"/></wicket:panel>

-igor

On Thu, Feb 18, 2010 at 2:02 PM, srm <sr...@schokokeks.org> wrote:
>
> Am 18.02.2010 um 22:56 schrieb Andrew Lombardi:
>
>> It depends what your domain object looks like, if it's just a simple string you'll have to save the results of those two textfield's in their own model, and then merge them in the onSubmit method.
>>
>
> It's a int property. I was thinking about using the onSubmit method but
> how will this interfere with the PropertyModel setting the value according to
> TextField's value? Does this happen before onSubmit or after onSubmit?
>
> If that happens before, I surely can overwrite the DO's property (set via the
> PropertyModel) in the onSubmit().
>
> Regards,
> Stephan
>
>> On Feb 18, 2010, at 1:41 PM, srm wrote:
>>
>>> Hi List,
>>>
>>> the following may looked flawed, so I'm happy to hear your suggestions: I have a RegisterNewItem Form where a user can add new Items to a shop/database. I have items of type CD (audiocd) with an attribute PlayTime. I store this value as seconds and calculate the minutes to display at runtime. For adding a new CD, I thought that it would be inconvenient to have the user entering either seconds only, or how to agree on a format like Min:Sec OR Min.Sec etc. My idea now is to provide two textFields, one for the minutes and one for the additional seconds. Now I have no idea how to properly use the model of the textfields and the item-object, to calculate the seconds from both fields at submit time. Any help appreciated.
>>>
>>> Please see the code from the Panel below (currently without a textfield for the playtime).
>>>
>>> Regards,
>>> Stephan
>>>
>>>
>>> public class AddCDPanel extends AddItemPanel {
>>>
>>>
>>>      /**
>>>       * auto-generated UID
>>>       */
>>>      private static final long serialVersionUID = 5390579612171776545L;
>>>
>>>      public AddCDPanel(String id) {
>>>              super(id, new CD());
>>>
>>>              TextField labelTextField = new TextField("label", new PropertyModel(itemToInsert,"label"));
>>>              FeedbackLabel labelFeedback = new FeedbackLabel("label.feedback", labelTextField);
>>>              addItemForm.add(labelTextField.setRequired(true));
>>>              addItemForm.add(labelFeedback);
>>>
>>>              TextField artistTextField = new TextField("artist", new PropertyModel(itemToInsert,"artist"));
>>>              FeedbackLabel artistFeedback = new FeedbackLabel("artist.feedback", artistTextField);
>>>              addItemForm.add(artistTextField.setRequired(true));
>>>              addItemForm.add(artistFeedback);
>>>
>>>      }
>>> }
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>> To our success!
>>
>> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
>>
>> ANDREW LOMBARDI | andrew@mysticcoders.com
>> 2321 E 4th St. Ste C-128, Santa Ana CA 92705
>> ofc: 714-816-4488
>> fax: 714-782-6024
>> cell: 714-697-8046
>> linked-in: http://www.linkedin.com/in/andrewlombardi
>> twitter: http://www.twitter.com/kinabalu
>>
>> Eco-Tip: Printing e-mails is usually a waste.
>>
>> ========================================================
>> This message is for the named person's use only. You must not, directly or indirectly, use,
>> disclose, distribute, print, or copy any part of this message if you are not the intended recipient.
>> ========================================================
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: (Form) Use two TextFields for one object property?

Posted by Andrew Lombardi <an...@mysticcoders.com>.
class MyForm extends Form {
  private int hour;
  private int second;

  public Form {
 	add(new TextField("hour", new PropertyModel(MyForm.class, "hour")));
 	add(new TextField("second", new PropertyModel(MyForm.class, "second")));
  }

  public void onSubmit() {
	if(!validTime(hour, second)) error("uhh ... hello?");
        
 	// do more stuff
  }

On Feb 18, 2010, at 2:02 PM, srm wrote:

> 
> Am 18.02.2010 um 22:56 schrieb Andrew Lombardi:
> 
>> It depends what your domain object looks like, if it's just a simple string you'll have to save the results of those two textfield's in their own model, and then merge them in the onSubmit method.
>> 
> 
> It's a int property. I was thinking about using the onSubmit method but
> how will this interfere with the PropertyModel setting the value according to
> TextField's value? Does this happen before onSubmit or after onSubmit?
> 
> If that happens before, I surely can overwrite the DO's property (set via the
> PropertyModel) in the onSubmit().
> 
> Regards,
> Stephan
> 
>> On Feb 18, 2010, at 1:41 PM, srm wrote:
>> 
>>> Hi List,
>>> 
>>> the following may looked flawed, so I'm happy to hear your suggestions: I have a RegisterNewItem Form where a user can add new Items to a shop/database. I have items of type CD (audiocd) with an attribute PlayTime. I store this value as seconds and calculate the minutes to display at runtime. For adding a new CD, I thought that it would be inconvenient to have the user entering either seconds only, or how to agree on a format like Min:Sec OR Min.Sec etc. My idea now is to provide two textFields, one for the minutes and one for the additional seconds. Now I have no idea how to properly use the model of the textfields and the item-object, to calculate the seconds from both fields at submit time. Any help appreciated.
>>> 
>>> Please see the code from the Panel below (currently without a textfield for the playtime).
>>> 
>>> Regards,
>>> Stephan
>>> 
>>> 
>>> public class AddCDPanel extends AddItemPanel {
>>> 	
>>> 	
>>> 	/**
>>> 	 * auto-generated UID
>>> 	 */
>>> 	private static final long serialVersionUID = 5390579612171776545L;
>>> 
>>> 	public AddCDPanel(String id) {
>>> 		super(id, new CD());
>>> 
>>> 		TextField labelTextField = new TextField("label", new PropertyModel(itemToInsert,"label"));
>>> 		FeedbackLabel labelFeedback = new FeedbackLabel("label.feedback", labelTextField);
>>> 		addItemForm.add(labelTextField.setRequired(true));
>>> 		addItemForm.add(labelFeedback);
>>> 		
>>> 		TextField artistTextField = new TextField("artist", new PropertyModel(itemToInsert,"artist"));
>>> 		FeedbackLabel artistFeedback = new FeedbackLabel("artist.feedback", artistTextField);
>>> 		addItemForm.add(artistTextField.setRequired(true));
>>> 		addItemForm.add(artistFeedback);
>>> 		
>>> 	}
>>> }
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>> 
>> 
>> 
>> To our success!
>> 
>> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
>> 
>> ANDREW LOMBARDI | andrew@mysticcoders.com
>> 2321 E 4th St. Ste C-128, Santa Ana CA 92705
>> ofc: 714-816-4488
>> fax: 714-782-6024
>> cell: 714-697-8046
>> linked-in: http://www.linkedin.com/in/andrewlombardi
>> twitter: http://www.twitter.com/kinabalu
>> 
>> Eco-Tip: Printing e-mails is usually a waste.
>> 
>> ========================================================
>> This message is for the named person's use only. You must not, directly or indirectly, use,
>> disclose, distribute, print, or copy any part of this message if you are not the intended recipient.
>> ========================================================
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


To our success!

Mystic Coders, LLC | Code Magic | www.mysticcoders.com

ANDREW LOMBARDI | andrew@mysticcoders.com
2321 E 4th St. Ste C-128, Santa Ana CA 92705
ofc: 714-816-4488
fax: 714-782-6024
cell: 714-697-8046
linked-in: http://www.linkedin.com/in/andrewlombardi
twitter: http://www.twitter.com/kinabalu

Eco-Tip: Printing e-mails is usually a waste.

========================================================
This message is for the named person's use only. You must not, directly or indirectly, use,
 disclose, distribute, print, or copy any part of this message if you are not the intended recipient.
========================================================


Re: (Form) Use two TextFields for one object property?

Posted by srm <sr...@schokokeks.org>.
Am 18.02.2010 um 22:56 schrieb Andrew Lombardi:

> It depends what your domain object looks like, if it's just a simple string you'll have to save the results of those two textfield's in their own model, and then merge them in the onSubmit method.
> 

It's a int property. I was thinking about using the onSubmit method but
how will this interfere with the PropertyModel setting the value according to
TextField's value? Does this happen before onSubmit or after onSubmit?

If that happens before, I surely can overwrite the DO's property (set via the
PropertyModel) in the onSubmit().

Regards,
Stephan

> On Feb 18, 2010, at 1:41 PM, srm wrote:
> 
>> Hi List,
>> 
>> the following may looked flawed, so I'm happy to hear your suggestions: I have a RegisterNewItem Form where a user can add new Items to a shop/database. I have items of type CD (audiocd) with an attribute PlayTime. I store this value as seconds and calculate the minutes to display at runtime. For adding a new CD, I thought that it would be inconvenient to have the user entering either seconds only, or how to agree on a format like Min:Sec OR Min.Sec etc. My idea now is to provide two textFields, one for the minutes and one for the additional seconds. Now I have no idea how to properly use the model of the textfields and the item-object, to calculate the seconds from both fields at submit time. Any help appreciated.
>> 
>> Please see the code from the Panel below (currently without a textfield for the playtime).
>> 
>> Regards,
>> Stephan
>> 
>> 
>> public class AddCDPanel extends AddItemPanel {
>> 	
>> 	
>> 	/**
>> 	 * auto-generated UID
>> 	 */
>> 	private static final long serialVersionUID = 5390579612171776545L;
>> 
>> 	public AddCDPanel(String id) {
>> 		super(id, new CD());
>> 
>> 		TextField labelTextField = new TextField("label", new PropertyModel(itemToInsert,"label"));
>> 		FeedbackLabel labelFeedback = new FeedbackLabel("label.feedback", labelTextField);
>> 		addItemForm.add(labelTextField.setRequired(true));
>> 		addItemForm.add(labelFeedback);
>> 		
>> 		TextField artistTextField = new TextField("artist", new PropertyModel(itemToInsert,"artist"));
>> 		FeedbackLabel artistFeedback = new FeedbackLabel("artist.feedback", artistTextField);
>> 		addItemForm.add(artistTextField.setRequired(true));
>> 		addItemForm.add(artistFeedback);
>> 		
>> 	}
>> }
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
> 
> 
> To our success!
> 
> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
> 
> ANDREW LOMBARDI | andrew@mysticcoders.com
> 2321 E 4th St. Ste C-128, Santa Ana CA 92705
> ofc: 714-816-4488
> fax: 714-782-6024
> cell: 714-697-8046
> linked-in: http://www.linkedin.com/in/andrewlombardi
> twitter: http://www.twitter.com/kinabalu
> 
> Eco-Tip: Printing e-mails is usually a waste.
> 
> ========================================================
> This message is for the named person's use only. You must not, directly or indirectly, use,
> disclose, distribute, print, or copy any part of this message if you are not the intended recipient.
> ========================================================
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: (Form) Use two TextFields for one object property?

Posted by Andrew Lombardi <an...@mysticcoders.com>.
It depends what your domain object looks like, if it's just a simple string you'll have to save the results of those two textfield's in their own model, and then merge them in the onSubmit method.

On Feb 18, 2010, at 1:41 PM, srm wrote:

> Hi List,
> 
> the following may looked flawed, so I'm happy to hear your suggestions: I have a RegisterNewItem Form where a user can add new Items to a shop/database. I have items of type CD (audiocd) with an attribute PlayTime. I store this value as seconds and calculate the minutes to display at runtime. For adding a new CD, I thought that it would be inconvenient to have the user entering either seconds only, or how to agree on a format like Min:Sec OR Min.Sec etc. My idea now is to provide two textFields, one for the minutes and one for the additional seconds. Now I have no idea how to properly use the model of the textfields and the item-object, to calculate the seconds from both fields at submit time. Any help appreciated.
> 
> Please see the code from the Panel below (currently without a textfield for the playtime).
> 
> Regards,
> Stephan
> 
> 
> public class AddCDPanel extends AddItemPanel {
> 	
> 	
> 	/**
> 	 * auto-generated UID
> 	 */
> 	private static final long serialVersionUID = 5390579612171776545L;
> 
> 	public AddCDPanel(String id) {
> 		super(id, new CD());
> 
> 		TextField labelTextField = new TextField("label", new PropertyModel(itemToInsert,"label"));
> 		FeedbackLabel labelFeedback = new FeedbackLabel("label.feedback", labelTextField);
> 		addItemForm.add(labelTextField.setRequired(true));
> 		addItemForm.add(labelFeedback);
> 		
> 		TextField artistTextField = new TextField("artist", new PropertyModel(itemToInsert,"artist"));
> 		FeedbackLabel artistFeedback = new FeedbackLabel("artist.feedback", artistTextField);
> 		addItemForm.add(artistTextField.setRequired(true));
> 		addItemForm.add(artistFeedback);
> 		
> 	}
> }
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


To our success!

Mystic Coders, LLC | Code Magic | www.mysticcoders.com

ANDREW LOMBARDI | andrew@mysticcoders.com
2321 E 4th St. Ste C-128, Santa Ana CA 92705
ofc: 714-816-4488
fax: 714-782-6024
cell: 714-697-8046
linked-in: http://www.linkedin.com/in/andrewlombardi
twitter: http://www.twitter.com/kinabalu

Eco-Tip: Printing e-mails is usually a waste.

========================================================
This message is for the named person's use only. You must not, directly or indirectly, use,
 disclose, distribute, print, or copy any part of this message if you are not the intended recipient.
========================================================


(Form) Use two TextFields for one object property?

Posted by srm <sr...@schokokeks.org>.
Hi List,

the following may looked flawed, so I'm happy to hear your suggestions: I have a RegisterNewItem Form where a user can add new Items to a shop/database. I have items of type CD (audiocd) with an attribute PlayTime. I store this value as seconds and calculate the minutes to display at runtime. For adding a new CD, I thought that it would be inconvenient to have the user entering either seconds only, or how to agree on a format like Min:Sec OR Min.Sec etc. My idea now is to provide two textFields, one for the minutes and one for the additional seconds. Now I have no idea how to properly use the model of the textfields and the item-object, to calculate the seconds from both fields at submit time. Any help appreciated.

Please see the code from the Panel below (currently without a textfield for the playtime).

Regards,
Stephan


public class AddCDPanel extends AddItemPanel {
	
	
	/**
	 * auto-generated UID
	 */
	private static final long serialVersionUID = 5390579612171776545L;

	public AddCDPanel(String id) {
		super(id, new CD());

		TextField labelTextField = new TextField("label", new PropertyModel(itemToInsert,"label"));
		FeedbackLabel labelFeedback = new FeedbackLabel("label.feedback", labelTextField);
		addItemForm.add(labelTextField.setRequired(true));
		addItemForm.add(labelFeedback);
		
		TextField artistTextField = new TextField("artist", new PropertyModel(itemToInsert,"artist"));
		FeedbackLabel artistFeedback = new FeedbackLabel("artist.feedback", artistTextField);
		addItemForm.add(artistTextField.setRequired(true));
		addItemForm.add(artistFeedback);
		
	}
}


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: best way to detect session termination

Posted by vineet semwal <vi...@gmail.com>.
a small example,
WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext()).getBean("name")

On Wed, Feb 17, 2010 at 8:50 PM, vineet semwal
<vi...@gmail.com>wrote:

>
> quick solution to do by retrieving the bean from spring applicationcontext
> in your webapplication,
> it will work but i am not sure how good the solution is .
>
>
>
> On Wed, Feb 17, 2010 at 5:54 PM, Andreas Lüdtke <sa...@t-online.de>wrote:
>
>> Vineet,
>>
>> I'm now storing the session id in the user record. But now I have another
>> problem, because hibernate tells me now in sessionDestroy():
>>
>> org.hibernate.HibernateException: No Hibernate Session bound to thread,
>> and
>> configuration does not allow creation of non-transactional one here
>>
>> I'm using spring to inject my dao. I also tried to use the dao in my
>> HttpSessionListener which is configured in web.xml, but that prevents my
>> app
>> from being started by Tomcat.
>> Next I did was to create a manual created hibernate session, but that
>> raised
>> other problems like a missing hibernate.hbm.xml file and I don't want to
>> configure that manually...
>>
>> Does somebody see another way to access my user data, or am I doing
>> something
>> stupid?
>>
>> Andreas
>>
>>
>> > -----Original Message-----
>> > From: vineet semwal [mailto:vineetsemwal1982@gmail.com]
>> > Sent: Tuesday, February 16, 2010 2:15 PM
>> > To: users@wicket.apache.org; sam.luedtke@t-online.de
>> > Subject: Re: best way to detect session termination
>> >
>> > can't you simply do that in
>> > webapplication.sessiondestroy(String sessionid),
>> >  you can store the sessionid when user logs in and on sessiondestroyed
>> > ,search the user by this sessionid ,
>> > and change whatever in user object and then persist it..
>> >
>> > On Tue, Feb 16, 2010 at 6:23 PM, Andreas Lüdtke
>> > <sa...@t-online.de>wrote:
>> >
>> > > I studied the classes HttpSessionBindingListener and
>> > > AbstractHttpSessionStore
>> > > as you noted, but I think I'll still have no link between
>> > the SessionId
>> > > from
>> > > the HTTPSession and my own Session. Maybe I'm missing
>> > something or "I don't
>> > > see the wood among all the trees" as we say in Germany...
>> > >
>> > > Andreas
>> > >
>> > > > -----Original Message-----
>> > > > From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
>> > > > Sent: Monday, February 15, 2010 7:08 PM
>> > > > To: sam.luedtke@t-online.de
>> > > > Cc: users@wicket.apache.org
>> > > > Subject: Re: best way to detect session termination
>> > > >
>> > > > You could use a HttpSessionBindingListener like Wicket
>> > does internally
>> > > > (see AbstractHttpSessionStore). Or as a hack store
>> > references to the
>> > > > session objects in the session listener. That's the easy fix, but
>> > > > doesn't scale if you need session replication (unless
>> > maybe you use
>> > > > e.g. Terracotta).
>> > > >
>> > > > Eelco
>> > > >
>> > > > On Sun, Feb 14, 2010 at 4:36 AM, Andreas Lüdtke
>> > > > <sa...@t-online.de> wrote:
>> > > > > Hi Eelco,
>> > > > >
>> > > > > thanks for the hint. Now I can detect the end of a session.
>> > > > Unfortunately I
>> > > > > can't access my own wicket session in that
>> > > > sessionDestroyed() method in order
>> > > > > to get the info about the connected user. I've got ther
>> > > > error message
>> > > > > "java.lang.IllegalStateException: you can only locate or
>> > > > create sessions in
>> > > > > the context of a request cycle".
>> > > > >
>> > > > > Do you know how I can achieve this?
>> > > > >
>> > > > > Andreas
>> > > > >
>> > > > >> -----Original Message-----
>> > > > >> From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
>> > > > >> Sent: Saturday, February 13, 2010 7:02 PM
>> > > > >> To: users@wicket.apache.org; sam.luedtke@t-online.de
>> > > > >> Subject: Re: best way to detect session termination
>> > > > >>
>> > > > >>
>> > http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7
>> > > > >>
>> > > > >> Eelco
>> > > > >>
>> > > > >> On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke
>> > > > >> <sa...@t-online.de> wrote:
>> > > > >> > I would like to detect the termination of the
>> > session to set the
>> > > > >> > "lastAccesTime" in the user profile. This should also
>> > > > >> happen if the session
>> > > > >> > times out.
>> > > > >> >
>> > > > >> > I read in archive about a HttpSessionListener that should
>> > > > >> do the trick.
>> > > > >> > Unfortunately I can't find a place to install it.
>> > > > >> >
>> > > > >> > Thanks
>> > > > >> >
>> > > > >> > Andreas
>> > > > >> >
>> > > > >> >
>> > > > >> >
>> > > > >>
>> > > >
>> > ---------------------------------------------------------------------
>> > > > >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > > > >> > For additional commands, e-mail: users-help@wicket.apache.org
>> > > > >> >
>> > > > >> >
>> > > > >>
>> > > > >
>> > > > >
>> > > >
>> > > >
>> > ---------------------------------------------------------------------
>> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > > > For additional commands, e-mail: users-help@wicket.apache.org
>> > > >
>> > > >
>> > >
>> > >
>> > >
>> > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > > For additional commands, e-mail: users-help@wicket.apache.org
>> > >
>> > >
>> >
>> >
>> > --
>> > regards,
>> > Vineet Semwal
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
> regards,
> Vineet Semwal
>



-- 
regards,
Vineet Semwal

RE: best way to detect session termination

Posted by Andreas Lüdtke <sa...@t-online.de>.
Vineet,

could you please give me a hint or a code snippet how to access that
interface? I'm a spring beginner and a little bit lost at the moment.
As I said, in my app the dao is injected and when the session is destroyed,
the link to hibernate is lost.

Andreas

> -----Original Message-----
> From: vineet semwal [mailto:vineetsemwal1982@gmail.com] 
> Sent: Wednesday, February 17, 2010 4:20 PM
> To: users@wicket.apache.org; sam.luedtke@t-online.de
> Subject: Re: best way to detect session termination
> 
> quick solution to do by retrieving the bean from spring 
> applicationcontext
> in your webapplication,
> it will work but i am not sure how good the solution is .
> 
> 
> On Wed, Feb 17, 2010 at 5:54 PM, Andreas Lüdtke 
> <sa...@t-online.de>wrote:
> 
> > Vineet,
> >
> > I'm now storing the session id in the user record. But now 
> I have another
> > problem, because hibernate tells me now in sessionDestroy():
> >
> > org.hibernate.HibernateException: No Hibernate Session 
> bound to thread, and
> > configuration does not allow creation of non-transactional one here
> >
> > I'm using spring to inject my dao. I also tried to use the dao in my
> > HttpSessionListener which is configured in web.xml, but 
> that prevents my
> > app
> > from being started by Tomcat.
> > Next I did was to create a manual created hibernate 
> session, but that
> > raised
> > other problems like a missing hibernate.hbm.xml file and I 
> don't want to
> > configure that manually...
> >
> > Does somebody see another way to access my user data, or am I doing
> > something
> > stupid?
> >
> > Andreas
> >
> >
> > > -----Original Message-----
> > > From: vineet semwal [mailto:vineetsemwal1982@gmail.com]
> > > Sent: Tuesday, February 16, 2010 2:15 PM
> > > To: users@wicket.apache.org; sam.luedtke@t-online.de
> > > Subject: Re: best way to detect session termination
> > >
> > > can't you simply do that in
> > > webapplication.sessiondestroy(String sessionid),
> > >  you can store the sessionid when user logs in and on 
> sessiondestroyed
> > > ,search the user by this sessionid ,
> > > and change whatever in user object and then persist it..
> > >
> > > On Tue, Feb 16, 2010 at 6:23 PM, Andreas Lüdtke
> > > <sa...@t-online.de>wrote:
> > >
> > > > I studied the classes HttpSessionBindingListener and
> > > > AbstractHttpSessionStore
> > > > as you noted, but I think I'll still have no link between
> > > the SessionId
> > > > from
> > > > the HTTPSession and my own Session. Maybe I'm missing
> > > something or "I don't
> > > > see the wood among all the trees" as we say in Germany...
> > > >
> > > > Andreas
> > > >
> > > > > -----Original Message-----
> > > > > From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
> > > > > Sent: Monday, February 15, 2010 7:08 PM
> > > > > To: sam.luedtke@t-online.de
> > > > > Cc: users@wicket.apache.org
> > > > > Subject: Re: best way to detect session termination
> > > > >
> > > > > You could use a HttpSessionBindingListener like Wicket
> > > does internally
> > > > > (see AbstractHttpSessionStore). Or as a hack store
> > > references to the
> > > > > session objects in the session listener. That's the 
> easy fix, but
> > > > > doesn't scale if you need session replication (unless
> > > maybe you use
> > > > > e.g. Terracotta).
> > > > >
> > > > > Eelco
> > > > >
> > > > > On Sun, Feb 14, 2010 at 4:36 AM, Andreas Lüdtke
> > > > > <sa...@t-online.de> wrote:
> > > > > > Hi Eelco,
> > > > > >
> > > > > > thanks for the hint. Now I can detect the end of a session.
> > > > > Unfortunately I
> > > > > > can't access my own wicket session in that
> > > > > sessionDestroyed() method in order
> > > > > > to get the info about the connected user. I've got ther
> > > > > error message
> > > > > > "java.lang.IllegalStateException: you can only locate or
> > > > > create sessions in
> > > > > > the context of a request cycle".
> > > > > >
> > > > > > Do you know how I can achieve this?
> > > > > >
> > > > > > Andreas
> > > > > >
> > > > > >> -----Original Message-----
> > > > > >> From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
> > > > > >> Sent: Saturday, February 13, 2010 7:02 PM
> > > > > >> To: users@wicket.apache.org; sam.luedtke@t-online.de
> > > > > >> Subject: Re: best way to detect session termination
> > > > > >>
> > > > > >>
> > > 
> http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7
> > > > > >>
> > > > > >> Eelco
> > > > > >>
> > > > > >> On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke
> > > > > >> <sa...@t-online.de> wrote:
> > > > > >> > I would like to detect the termination of the
> > > session to set the
> > > > > >> > "lastAccesTime" in the user profile. This should also
> > > > > >> happen if the session
> > > > > >> > times out.
> > > > > >> >
> > > > > >> > I read in archive about a HttpSessionListener that should
> > > > > >> do the trick.
> > > > > >> > Unfortunately I can't find a place to install it.
> > > > > >> >
> > > > > >> > Thanks
> > > > > >> >
> > > > > >> > Andreas
> > > > > >> >
> > > > > >> >
> > > > > >> >
> > > > > >>
> > > > >
> > > 
> ---------------------------------------------------------------------
> > > > > >> > To unsubscribe, e-mail: 
> users-unsubscribe@wicket.apache.org
> > > > > >> > For additional commands, e-mail: 
> users-help@wicket.apache.org
> > > > > >> >
> > > > > >> >
> > > > > >>
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > 
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > 
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > regards,
> > > Vineet Semwal
> > >
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> 
> -- 
> regards,
> Vineet Semwal
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: best way to detect session termination

Posted by vineet semwal <vi...@gmail.com>.
quick solution to do by retrieving the bean from spring applicationcontext
in your webapplication,
it will work but i am not sure how good the solution is .


On Wed, Feb 17, 2010 at 5:54 PM, Andreas Lüdtke <sa...@t-online.de>wrote:

> Vineet,
>
> I'm now storing the session id in the user record. But now I have another
> problem, because hibernate tells me now in sessionDestroy():
>
> org.hibernate.HibernateException: No Hibernate Session bound to thread, and
> configuration does not allow creation of non-transactional one here
>
> I'm using spring to inject my dao. I also tried to use the dao in my
> HttpSessionListener which is configured in web.xml, but that prevents my
> app
> from being started by Tomcat.
> Next I did was to create a manual created hibernate session, but that
> raised
> other problems like a missing hibernate.hbm.xml file and I don't want to
> configure that manually...
>
> Does somebody see another way to access my user data, or am I doing
> something
> stupid?
>
> Andreas
>
>
> > -----Original Message-----
> > From: vineet semwal [mailto:vineetsemwal1982@gmail.com]
> > Sent: Tuesday, February 16, 2010 2:15 PM
> > To: users@wicket.apache.org; sam.luedtke@t-online.de
> > Subject: Re: best way to detect session termination
> >
> > can't you simply do that in
> > webapplication.sessiondestroy(String sessionid),
> >  you can store the sessionid when user logs in and on sessiondestroyed
> > ,search the user by this sessionid ,
> > and change whatever in user object and then persist it..
> >
> > On Tue, Feb 16, 2010 at 6:23 PM, Andreas Lüdtke
> > <sa...@t-online.de>wrote:
> >
> > > I studied the classes HttpSessionBindingListener and
> > > AbstractHttpSessionStore
> > > as you noted, but I think I'll still have no link between
> > the SessionId
> > > from
> > > the HTTPSession and my own Session. Maybe I'm missing
> > something or "I don't
> > > see the wood among all the trees" as we say in Germany...
> > >
> > > Andreas
> > >
> > > > -----Original Message-----
> > > > From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
> > > > Sent: Monday, February 15, 2010 7:08 PM
> > > > To: sam.luedtke@t-online.de
> > > > Cc: users@wicket.apache.org
> > > > Subject: Re: best way to detect session termination
> > > >
> > > > You could use a HttpSessionBindingListener like Wicket
> > does internally
> > > > (see AbstractHttpSessionStore). Or as a hack store
> > references to the
> > > > session objects in the session listener. That's the easy fix, but
> > > > doesn't scale if you need session replication (unless
> > maybe you use
> > > > e.g. Terracotta).
> > > >
> > > > Eelco
> > > >
> > > > On Sun, Feb 14, 2010 at 4:36 AM, Andreas Lüdtke
> > > > <sa...@t-online.de> wrote:
> > > > > Hi Eelco,
> > > > >
> > > > > thanks for the hint. Now I can detect the end of a session.
> > > > Unfortunately I
> > > > > can't access my own wicket session in that
> > > > sessionDestroyed() method in order
> > > > > to get the info about the connected user. I've got ther
> > > > error message
> > > > > "java.lang.IllegalStateException: you can only locate or
> > > > create sessions in
> > > > > the context of a request cycle".
> > > > >
> > > > > Do you know how I can achieve this?
> > > > >
> > > > > Andreas
> > > > >
> > > > >> -----Original Message-----
> > > > >> From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
> > > > >> Sent: Saturday, February 13, 2010 7:02 PM
> > > > >> To: users@wicket.apache.org; sam.luedtke@t-online.de
> > > > >> Subject: Re: best way to detect session termination
> > > > >>
> > > > >>
> > http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7
> > > > >>
> > > > >> Eelco
> > > > >>
> > > > >> On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke
> > > > >> <sa...@t-online.de> wrote:
> > > > >> > I would like to detect the termination of the
> > session to set the
> > > > >> > "lastAccesTime" in the user profile. This should also
> > > > >> happen if the session
> > > > >> > times out.
> > > > >> >
> > > > >> > I read in archive about a HttpSessionListener that should
> > > > >> do the trick.
> > > > >> > Unfortunately I can't find a place to install it.
> > > > >> >
> > > > >> > Thanks
> > > > >> >
> > > > >> > Andreas
> > > > >> >
> > > > >> >
> > > > >> >
> > > > >>
> > > >
> > ---------------------------------------------------------------------
> > > > >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > >> > For additional commands, e-mail: users-help@wicket.apache.org
> > > > >> >
> > > > >> >
> > > > >>
> > > > >
> > > > >
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > > >
> > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
> > --
> > regards,
> > Vineet Semwal
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
regards,
Vineet Semwal

RE: best way to detect session termination

Posted by Andreas Lüdtke <sa...@t-online.de>.
Vineet,

I'm now storing the session id in the user record. But now I have another
problem, because hibernate tells me now in sessionDestroy():

org.hibernate.HibernateException: No Hibernate Session bound to thread, and
configuration does not allow creation of non-transactional one here

I'm using spring to inject my dao. I also tried to use the dao in my
HttpSessionListener which is configured in web.xml, but that prevents my app
from being started by Tomcat.
Next I did was to create a manual created hibernate session, but that raised
other problems like a missing hibernate.hbm.xml file and I don't want to
configure that manually...

Does somebody see another way to access my user data, or am I doing something
stupid?

Andreas


> -----Original Message-----
> From: vineet semwal [mailto:vineetsemwal1982@gmail.com] 
> Sent: Tuesday, February 16, 2010 2:15 PM
> To: users@wicket.apache.org; sam.luedtke@t-online.de
> Subject: Re: best way to detect session termination
> 
> can't you simply do that in 
> webapplication.sessiondestroy(String sessionid),
>  you can store the sessionid when user logs in and on sessiondestroyed
> ,search the user by this sessionid ,
> and change whatever in user object and then persist it..
> 
> On Tue, Feb 16, 2010 at 6:23 PM, Andreas Lüdtke 
> <sa...@t-online.de>wrote:
> 
> > I studied the classes HttpSessionBindingListener and
> > AbstractHttpSessionStore
> > as you noted, but I think I'll still have no link between 
> the SessionId
> > from
> > the HTTPSession and my own Session. Maybe I'm missing 
> something or "I don't
> > see the wood among all the trees" as we say in Germany...
> >
> > Andreas
> >
> > > -----Original Message-----
> > > From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
> > > Sent: Monday, February 15, 2010 7:08 PM
> > > To: sam.luedtke@t-online.de
> > > Cc: users@wicket.apache.org
> > > Subject: Re: best way to detect session termination
> > >
> > > You could use a HttpSessionBindingListener like Wicket 
> does internally
> > > (see AbstractHttpSessionStore). Or as a hack store 
> references to the
> > > session objects in the session listener. That's the easy fix, but
> > > doesn't scale if you need session replication (unless 
> maybe you use
> > > e.g. Terracotta).
> > >
> > > Eelco
> > >
> > > On Sun, Feb 14, 2010 at 4:36 AM, Andreas Lüdtke
> > > <sa...@t-online.de> wrote:
> > > > Hi Eelco,
> > > >
> > > > thanks for the hint. Now I can detect the end of a session.
> > > Unfortunately I
> > > > can't access my own wicket session in that
> > > sessionDestroyed() method in order
> > > > to get the info about the connected user. I've got ther
> > > error message
> > > > "java.lang.IllegalStateException: you can only locate or
> > > create sessions in
> > > > the context of a request cycle".
> > > >
> > > > Do you know how I can achieve this?
> > > >
> > > > Andreas
> > > >
> > > >> -----Original Message-----
> > > >> From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
> > > >> Sent: Saturday, February 13, 2010 7:02 PM
> > > >> To: users@wicket.apache.org; sam.luedtke@t-online.de
> > > >> Subject: Re: best way to detect session termination
> > > >>
> > > >> 
> http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7
> > > >>
> > > >> Eelco
> > > >>
> > > >> On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke
> > > >> <sa...@t-online.de> wrote:
> > > >> > I would like to detect the termination of the 
> session to set the
> > > >> > "lastAccesTime" in the user profile. This should also
> > > >> happen if the session
> > > >> > times out.
> > > >> >
> > > >> > I read in archive about a HttpSessionListener that should
> > > >> do the trick.
> > > >> > Unfortunately I can't find a place to install it.
> > > >> >
> > > >> > Thanks
> > > >> >
> > > >> > Andreas
> > > >> >
> > > >> >
> > > >> >
> > > >>
> > > 
> ---------------------------------------------------------------------
> > > >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > >> > For additional commands, e-mail: users-help@wicket.apache.org
> > > >> >
> > > >> >
> > > >>
> > > >
> > > >
> > >
> > > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> 
> -- 
> regards,
> Vineet Semwal
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: best way to detect session termination

Posted by vineet semwal <vi...@gmail.com>.
can't you simply do that in webapplication.sessiondestroy(String sessionid),
 you can store the sessionid when user logs in and on sessiondestroyed
,search the user by this sessionid ,
and change whatever in user object and then persist it..

On Tue, Feb 16, 2010 at 6:23 PM, Andreas Lüdtke <sa...@t-online.de>wrote:

> I studied the classes HttpSessionBindingListener and
> AbstractHttpSessionStore
> as you noted, but I think I'll still have no link between the SessionId
> from
> the HTTPSession and my own Session. Maybe I'm missing something or "I don't
> see the wood among all the trees" as we say in Germany...
>
> Andreas
>
> > -----Original Message-----
> > From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
> > Sent: Monday, February 15, 2010 7:08 PM
> > To: sam.luedtke@t-online.de
> > Cc: users@wicket.apache.org
> > Subject: Re: best way to detect session termination
> >
> > You could use a HttpSessionBindingListener like Wicket does internally
> > (see AbstractHttpSessionStore). Or as a hack store references to the
> > session objects in the session listener. That's the easy fix, but
> > doesn't scale if you need session replication (unless maybe you use
> > e.g. Terracotta).
> >
> > Eelco
> >
> > On Sun, Feb 14, 2010 at 4:36 AM, Andreas Lüdtke
> > <sa...@t-online.de> wrote:
> > > Hi Eelco,
> > >
> > > thanks for the hint. Now I can detect the end of a session.
> > Unfortunately I
> > > can't access my own wicket session in that
> > sessionDestroyed() method in order
> > > to get the info about the connected user. I've got ther
> > error message
> > > "java.lang.IllegalStateException: you can only locate or
> > create sessions in
> > > the context of a request cycle".
> > >
> > > Do you know how I can achieve this?
> > >
> > > Andreas
> > >
> > >> -----Original Message-----
> > >> From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
> > >> Sent: Saturday, February 13, 2010 7:02 PM
> > >> To: users@wicket.apache.org; sam.luedtke@t-online.de
> > >> Subject: Re: best way to detect session termination
> > >>
> > >> http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7
> > >>
> > >> Eelco
> > >>
> > >> On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke
> > >> <sa...@t-online.de> wrote:
> > >> > I would like to detect the termination of the session to set the
> > >> > "lastAccesTime" in the user profile. This should also
> > >> happen if the session
> > >> > times out.
> > >> >
> > >> > I read in archive about a HttpSessionListener that should
> > >> do the trick.
> > >> > Unfortunately I can't find a place to install it.
> > >> >
> > >> > Thanks
> > >> >
> > >> > Andreas
> > >> >
> > >> >
> > >> >
> > >>
> > ---------------------------------------------------------------------
> > >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > >> > For additional commands, e-mail: users-help@wicket.apache.org
> > >> >
> > >> >
> > >>
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
regards,
Vineet Semwal

Re: best way to detect session termination

Posted by James Carman <jc...@carmanconsulting.com>.
You can maintain a map somewhere on your own to do that.

On Tue, Feb 16, 2010 at 7:53 AM, Andreas Lüdtke <sa...@t-online.de> wrote:
> I studied the classes HttpSessionBindingListener and AbstractHttpSessionStore
> as you noted, but I think I'll still have no link between the SessionId from
> the HTTPSession and my own Session. Maybe I'm missing something or "I don't
> see the wood among all the trees" as we say in Germany...
>
> Andreas
>
>> -----Original Message-----
>> From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
>> Sent: Monday, February 15, 2010 7:08 PM
>> To: sam.luedtke@t-online.de
>> Cc: users@wicket.apache.org
>> Subject: Re: best way to detect session termination
>>
>> You could use a HttpSessionBindingListener like Wicket does internally
>> (see AbstractHttpSessionStore). Or as a hack store references to the
>> session objects in the session listener. That's the easy fix, but
>> doesn't scale if you need session replication (unless maybe you use
>> e.g. Terracotta).
>>
>> Eelco
>>
>> On Sun, Feb 14, 2010 at 4:36 AM, Andreas Lüdtke
>> <sa...@t-online.de> wrote:
>> > Hi Eelco,
>> >
>> > thanks for the hint. Now I can detect the end of a session.
>> Unfortunately I
>> > can't access my own wicket session in that
>> sessionDestroyed() method in order
>> > to get the info about the connected user. I've got ther
>> error message
>> > "java.lang.IllegalStateException: you can only locate or
>> create sessions in
>> > the context of a request cycle".
>> >
>> > Do you know how I can achieve this?
>> >
>> > Andreas
>> >
>> >> -----Original Message-----
>> >> From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
>> >> Sent: Saturday, February 13, 2010 7:02 PM
>> >> To: users@wicket.apache.org; sam.luedtke@t-online.de
>> >> Subject: Re: best way to detect session termination
>> >>
>> >> http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7
>> >>
>> >> Eelco
>> >>
>> >> On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke
>> >> <sa...@t-online.de> wrote:
>> >> > I would like to detect the termination of the session to set the
>> >> > "lastAccesTime" in the user profile. This should also
>> >> happen if the session
>> >> > times out.
>> >> >
>> >> > I read in archive about a HttpSessionListener that should
>> >> do the trick.
>> >> > Unfortunately I can't find a place to install it.
>> >> >
>> >> > Thanks
>> >> >
>> >> > Andreas
>> >> >
>> >> >
>> >> >
>> >>
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >
>> >> >
>> >>
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: best way to detect session termination

Posted by Andreas Lüdtke <sa...@t-online.de>.
I studied the classes HttpSessionBindingListener and AbstractHttpSessionStore
as you noted, but I think I'll still have no link between the SessionId from
the HTTPSession and my own Session. Maybe I'm missing something or "I don't
see the wood among all the trees" as we say in Germany...

Andreas

> -----Original Message-----
> From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com] 
> Sent: Monday, February 15, 2010 7:08 PM
> To: sam.luedtke@t-online.de
> Cc: users@wicket.apache.org
> Subject: Re: best way to detect session termination
> 
> You could use a HttpSessionBindingListener like Wicket does internally
> (see AbstractHttpSessionStore). Or as a hack store references to the
> session objects in the session listener. That's the easy fix, but
> doesn't scale if you need session replication (unless maybe you use
> e.g. Terracotta).
> 
> Eelco
> 
> On Sun, Feb 14, 2010 at 4:36 AM, Andreas Lüdtke 
> <sa...@t-online.de> wrote:
> > Hi Eelco,
> >
> > thanks for the hint. Now I can detect the end of a session. 
> Unfortunately I
> > can't access my own wicket session in that 
> sessionDestroyed() method in order
> > to get the info about the connected user. I've got ther 
> error message
> > "java.lang.IllegalStateException: you can only locate or 
> create sessions in
> > the context of a request cycle".
> >
> > Do you know how I can achieve this?
> >
> > Andreas
> >
> >> -----Original Message-----
> >> From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
> >> Sent: Saturday, February 13, 2010 7:02 PM
> >> To: users@wicket.apache.org; sam.luedtke@t-online.de
> >> Subject: Re: best way to detect session termination
> >>
> >> http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7
> >>
> >> Eelco
> >>
> >> On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke
> >> <sa...@t-online.de> wrote:
> >> > I would like to detect the termination of the session to set the
> >> > "lastAccesTime" in the user profile. This should also
> >> happen if the session
> >> > times out.
> >> >
> >> > I read in archive about a HttpSessionListener that should
> >> do the trick.
> >> > Unfortunately I can't find a place to install it.
> >> >
> >> > Thanks
> >> >
> >> > Andreas
> >> >
> >> >
> >> >
> >> 
> ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >
> >> >
> >>
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: best way to detect session termination

Posted by Eelco Hillenius <ee...@gmail.com>.
You could use a HttpSessionBindingListener like Wicket does internally
(see AbstractHttpSessionStore). Or as a hack store references to the
session objects in the session listener. That's the easy fix, but
doesn't scale if you need session replication (unless maybe you use
e.g. Terracotta).

Eelco

On Sun, Feb 14, 2010 at 4:36 AM, Andreas Lüdtke <sa...@t-online.de> wrote:
> Hi Eelco,
>
> thanks for the hint. Now I can detect the end of a session. Unfortunately I
> can't access my own wicket session in that sessionDestroyed() method in order
> to get the info about the connected user. I've got ther error message
> "java.lang.IllegalStateException: you can only locate or create sessions in
> the context of a request cycle".
>
> Do you know how I can achieve this?
>
> Andreas
>
>> -----Original Message-----
>> From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com]
>> Sent: Saturday, February 13, 2010 7:02 PM
>> To: users@wicket.apache.org; sam.luedtke@t-online.de
>> Subject: Re: best way to detect session termination
>>
>> http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7
>>
>> Eelco
>>
>> On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke
>> <sa...@t-online.de> wrote:
>> > I would like to detect the termination of the session to set the
>> > "lastAccesTime" in the user profile. This should also
>> happen if the session
>> > times out.
>> >
>> > I read in archive about a HttpSessionListener that should
>> do the trick.
>> > Unfortunately I can't find a place to install it.
>> >
>> > Thanks
>> >
>> > Andreas
>> >
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: best way to detect session termination

Posted by Andreas Lüdtke <sa...@t-online.de>.
Hi Eelco,

thanks for the hint. Now I can detect the end of a session. Unfortunately I
can't access my own wicket session in that sessionDestroyed() method in order
to get the info about the connected user. I've got ther error message
"java.lang.IllegalStateException: you can only locate or create sessions in
the context of a request cycle".

Do you know how I can achieve this?

Andreas

> -----Original Message-----
> From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com] 
> Sent: Saturday, February 13, 2010 7:02 PM
> To: users@wicket.apache.org; sam.luedtke@t-online.de
> Subject: Re: best way to detect session termination
> 
> http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7
> 
> Eelco
> 
> On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke 
> <sa...@t-online.de> wrote:
> > I would like to detect the termination of the session to set the
> > "lastAccesTime" in the user profile. This should also 
> happen if the session
> > times out.
> >
> > I read in archive about a HttpSessionListener that should 
> do the trick.
> > Unfortunately I can't find a place to install it.
> >
> > Thanks
> >
> > Andreas
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: best way to detect session termination

Posted by Eelco Hillenius <ee...@gmail.com>.
http://www.xyzws.com/Servletfaq/when-do-i-use-httpsessionlistener/7

Eelco

On Sat, Feb 13, 2010 at 8:38 AM, Andreas Lüdtke <sa...@t-online.de> wrote:
> I would like to detect the termination of the session to set the
> "lastAccesTime" in the user profile. This should also happen if the session
> times out.
>
> I read in archive about a HttpSessionListener that should do the trick.
> Unfortunately I can't find a place to install it.
>
> Thanks
>
> Andreas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org