Please see the following and let me know is this available in OpenEJB:

Interface 
HttpSessionListener<http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpSessionListener.html>

As I demonstrated earlier, in a previous email (below), this is not working
in OpenEJB. Should I open a JIRA for this?



On Sun, Nov 25, 2012 at 2:57 AM, Romain Manni-Bucau
<rmannibu...@gmail.com>wrote:

> I dont think you can by default (at least hope otherwise would probably be
> a security issue)
> Le 25 nov. 2012 08:50, "Howard W. Smith, Jr." <smithh032...@gmail.com> a
> écrit :
>
> > Interesting. Glassfish always trigger my UserBean.sessionTimeout() via
> > HttpSessionListener.sessionDestroyed, when I undeploy app or shutdown
> > server.  Maybe this type of behavior/feature is
> > container-specific.whether/not sessions are persisted at shutdown?
> >
> > Hmmm, user A opens session, server shuts down while user A logged in... I
> > guess this is beneficial for when server comes back up, user A can resume
> > his work. Right?
> >
> > If so, my brother asked me if my web app could 'persist' session if he
> > loses (internet) connection to the server. I guess my app does not
> persist
> > and resume 'persisted' sessions, or maybe I didn't know how to turn on
> that
> > feature when I was develop app for Glassfish.
> >
> >
> > Is there a JVM or tomcat/tomee container option for
> >
> > On Sun, Nov 25, 2012 at 2:41 AM, Romain Manni-Bucau
> > <rmannibu...@gmail.com>wrote:
> >
> > > Hmm,
> > >
> > > Sessions are persisted so you cant destroy a session from a session
> > events
> > > excepted the timeout which will do it automatically
> > > Le 25 nov. 2012 08:36, "Howard W. Smith, Jr." <smithh032...@gmail.com>
> a
> > > écrit :
> > >
> > > > Interesting. So, when server shutdown, sessions are not destroyed?
> > > >
> > > > If the answer is yes, I guess you are telling me that I should invoke
> > > > session.invalidate() in a @PreDestroy of my CDI @SessionScoped
> > UserBean?
> > > >
> > > > I have a sessionTimeout method on my UserBean already, it is usually
> > > called
> > > > by HttpSessionListener on sessionDestroyed.
> > > >
> > > >
> > > > On Sun, Nov 25, 2012 at 2:27 AM, Romain Manni-Bucau
> > > > <rmannibu...@gmail.com>wrote:
> > > >
> > > > > Because the session is not destroyed, you need to destroy it or
> wait
> > > the
> > > > > session timeout
> > > > > Le 25 nov. 2012 07:21, "Howard W. Smith, Jr." <
> > smithh032...@gmail.com>
> > > a
> > > > > écrit :
> > > > >
> > > > > > I have the following defined for my HttpSessionListener, and I
> > don't
> > > > see
> > > > > it
> > > > > > being executed (or showing up in server log) when I undeploy or
> > > > shutdown
> > > > > > TomEE.
> > > > > >
> > > > > > /*
> > > > > >  * To change this template, choose Tools | Templates
> > > > > >  * and open the template in the editor.
> > > > > >  */
> > > > > > package pf;
> > > > > >
> > > > > > import java.util.Date;
> > > > > >
> > > > > > import javax.inject.Inject;
> > > > > >
> > > > > > import javax.servlet.annotation.WebListener;
> > > > > > import javax.servlet.http.HttpSessionEvent;
> > > > > > import javax.servlet.http.HttpSessionListener;
> > > > > >
> > > > > > import jsf.users.pf_UsersController;
> > > > > >
> > > > > > /**
> > > > > >  *
> > > > > >  * @author Administrator
> > > > > >  */
> > > > > > @WebListener
> > > > > > public class UserHttpSessionListener implements
> > HttpSessionListener {
> > > > > >
> > > > > >     @Inject
> > > > > >     private pf_UsersController userBean;
> > > > > >
> > > > > >     @Override
> > > > > >     public void sessionCreated(HttpSessionEvent event) {
> > > > > >         // Do here the job.
> > > > > >     }
> > > > > >
> > > > > >     @Override
> > > > > >     public void sessionDestroyed(HttpSessionEvent event) {
> > > > > >         /*
> > > > > >          * JSF Managed Beans
> > > > > >          *
> > > > > >         pf_UsersController userBean = (pf_UsersController)
> > > > > > event.getSession().
> > > > > >
> > > > getAttribute("pf_usersController");
> > > > > >          */
> > > > > >         if (userBean != null && userBean.getUser() != null) {
> > > > > >             String userName = userBean.getUser().getUserName();
> > > > > >
> > > > > System.out.println("UserHttpSessionListener.sessionDestroyed():
> > > > > > " +
> > > > > >                                userName + " session destroyed");
> > > > > >             userBean.sessionTimeout();
> > > > > >         }
> > > > > >     }
> > > > > >
> > > > > > }
> > > > > >
> > > > >
> > > >
> > >
> >
>

Reply via email to