5 Replies Latest reply on May 11, 2008 4:48 PM by admin.admin.email.tld

    How does Seam know when a client session ends?

    admin.admin.email.tld

      Is there any doc or book that explains this?  I believe I asked this on the old forum and Pete answered by stating something like the servlet determines this from a closed browser or session timeout and relays this info to Seam.  But still don't know exactly how this works.


      When I exec a use case that uses a SFSB then immediately close the browser, what happens?  I know that Seam gives the client a new conversation id for the next use case execution but how/when is the session destroyed if the SFSB is conversation-scoped as in many cases they are?

        • 1. Re: How does Seam know when a client session ends?
          admin.admin.email.tld

          I just noticed the following in my console after I close IE and open a new browser instance pointing to my xhtml page:


          09:41:13,387 INFO  [Contexts] starting up: org.jboss.seam.web.session
          09:41:13,387 INFO  [Contexts] starting up: org.jboss.seam.security.identity



          I was able to reproduce this so somehow Seam does know a session ended.  There was no output in the server.log indicating a session ended after I closed the browser.


          Where can we find more info on what the servlet in a Seam app is responsible for in the classic MVC pattern?

          • 2. Re: How does Seam know when a client session ends?
            mcoffin

            Seam uses the same methods as any other java webapp (jsp,servlet,etc). 


            In your web.xml you'll see lines similar to:



                <session-config>
                  <session-timeout>30</session-timeout> 
                </session-config>
            



            If the user closes the browser the session will be closed in the time specified by by session-timeout.

            • 3. Re: How does Seam know when a client session ends?
              zahidmaqbool

              just a question, when a session times out and the user has already closed his browser, then can we do some custom coding or write some clean up code???


              If so how is this possible..


              Thanks

              • 4. Re: How does Seam know when a client session ends?
                scheintod

                If I'm not completly wrong Closing the Browser has nothing to do with it. It's simply a matter of not accessing another page within the timeout period.


                To do cleanup after a session expires simply put some code in a session scoped bean in the destroy method.

                • 5. Re: How does Seam know when a client session ends?
                  admin.admin.email.tld

                  Mark Coffin wrote on May 10, 2008 01:59 PM:


                  Seam uses the same methods as any other java webapp (jsp,servlet,etc). 

                  In your web.xml you'll see lines similar to:


                      <session-config>
                        <session-timeout>30</session-timeout> 
                      </session-config>
                  



                  If the user closes the browser the session will be closed in the time specified by by session-timeout.



                  this is true.  but i'm talking about the scenario when the session does not timeout yet (e.g. a brand new session is started) and the user closes the browser...  this is the use case I am executing in my app and seeing that output posted in the server.log...