2 Replies Latest reply on Sep 5, 2008 2:32 PM by nimo stephan

    Destroy SessionContext in Container?

    nimo stephan Master

      Look at this:


      Client A has the session Context:


      org.jboss.seam.web.session = org.jboss.seam.web.Session@ff0e




      Client B has the session Context:


      org.jboss.seam.web.session = org.jboss.seam.web.Session@ee1e



      How can I selectivley destroy the session from Client B?


      I know, I can destroy a session via:


      Contexts.getSessionContext().remove("org.jboss.seam.web.session");



      But this destroys only the session from the actual Context, that means, when I invoke this method from Client B, then the Session from Client B will be destroyed.


      I use EJBs and JBOSS.


      Any suggestions?

        • 1. Re: Destroy SessionContext in Container?
          nimo stephan Master

          I have implemented a HttpSessionListener and have access to the session created by the user. This session differs from the session created by SEAM:


          For example:


          Session 1: org.apache.catalina.session.StandardSessionFacade@7f8dd0
          Session 2 (Seam): org.jboss.seam.web.Session@bao9bb



          This is not a problem, I guess. When I destroy Session 1, then automatically Session 2 is destroyed ! (Am I right?)


          The point is, now I have two listeners in web.xml:



          <listener>
          <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
          </listener>
          <listener>
          <listener-class>MyServletListener</listener-class>
          </listener>



          That is noisy, as I would like to have controll over all sessions via the SeamListener. Is that possible? Is there any other way, to achieve this in Seam (EJB)?

          • 2. Re: Destroy SessionContext in Container?
            nimo stephan Master

            The problem is, I can invalidate the session via


            session.invalidate();




            but SEAM complains it and says:
            Please end the HttpSession via


            org.jboss.seam.web.Session.instance().invalidate()




            Any best practices?