4 Replies Latest reply on Feb 26, 2012 1:31 AM by erez135 s

    Not getting Session TimeOut event

    erez135 s Newbie

      hi

      I am using richfaces 4.1.0.20110805 with Apache Myfaces JSF Core-2.0 API 2..2

      I follow the richfaces user manual

       

      in web xml :

       

      <context-param>
      <param-name>org.ajax4jsf.handleViewExpiredOnClient</param-name>
      <param-value>true</param-value>
      </context-param>

       

      and add :

      A4J.AJAX.onExpired = function(loc, expiredMsg){

      in my code.

       

       

      i my code i also force session time out every 10 second and confirm it by getting the session id.

      i aslo try to write session  " MySessionListener implements HttpSessionListener " class

       

      <listener>

      <listener-class>mypackage.MySessionListener</listener-class>

      </listener>

       

      but by add this class to my web.xml listener my webApplication didn't able to start.

       

      I will be very happy to get your assist on this.

       

      ( my web.xml is attached )

       

      Thanks in advanced

        • 1. Re: Not getting Session TimeOut event
          Maheswara Sunkara Novice

          Please provide error details..

           

          Are you getting the problem once you add session listener?

          • 2. Re: Not getting Session TimeOut event
            erez135 s Newbie

            Maheswara,

            Thanks for your fast replay .

             

            i add this to the web.xml:

             

              <listener>

                <listener-class>user.MySessionListener</listener-class>

            </listener>

             

             

            my problem is that by try to run my tomcat server it gives me this error

             

            type Status report

            message /jsfQa/faces/index.xhtml

            description The requested resource (/jsfQa/faces/index.xhtml) is not available.

             

             

            by remove the added listener tag from the web.xml the problem not appear

            • 3. Re: Not getting Session TimeOut event
              Maheswara Sunkara Novice

              Are you refering to /jsfQa/faces/index.xhtml in your code?

               

              can you post your session listener code ?

              where are you forcing session timeout in 10sec?

               

              not seeing session timeout config in web.xml..

              • 4. Re: Not getting Session TimeOut event
                erez135 s Newbie

                my sessionTimeOut code

                 

                package usr;

                 

                 

                import javax.servlet.http.HttpSessionEvent;

                import javax.servlet.http.HttpSessionListener;

                 

                 

                public class MySessionListener implements HttpSessionListener {

                   

                     public  MySessionListener(HttpSessionEvent event) {

                            System.out.println("session");

                        

                            }

                    

                 

                    @Override

                    public void sessionCreated(HttpSessionEvent arg0) {

                        System.out.println("session created");

                       

                    }

                 

                    @Override

                    public void sessionDestroyed(HttpSessionEvent arg0) {

                        System.out.println("session ends");

                       

                    }

                 

                }

                 

                 

                i force ( give maximux session time out value) session timeout using two option's

                 

                1.  using code :

                 

                public void logout(){

                        FacesContext fc = FacesContext.getCurrentInstance();

                        HttpServletRequest request = (HttpServletRequest) fc.getExternalContext().getRequest();

                        request.getSession().setMaxInactiveInterval(10);

                        this.sessionid=    request.getSession().getId();

                    }

                 

                 

                2. set it in my web.xml

                 

                <session-config>

                      <session-timeout>2</session-timeout>

                    </session-config>

                 

                both option create sesstion timeOut ( i confirm it by getting the session id ).

                but i am unable to get any event for session time out.

                 

                Thanks for your help