2 Replies Latest reply on Feb 21, 2008 2:35 AM by shane.bryzak

    Possible to end been with Scope=SESSION?

    jmahle

      Hi,


      Maybe this is a stupid question, but is it possible to end a session without closing the browser?


      I have a bean responsible for uploading a file and save it in the database. If the scope of this bean isn't set to Session I cant upload the file and get an error 500.


      But if my scope is Session my conversation is never ended, and I can only save information about one file in the database, next time I try the prevouis conversation is not ended.


      I know that @Begin and @End doesn't work when scope is Session. Is it possible to end a session in another way?


      Thanks,
      Jacob

        • 1. Re: Possible to end been with Scope=SESSION?
          sunfire

          I think you have two choices to invalidate your HttpSession with Seam:


          a) if you use Seam security features try


          Identity.logout()



          b) if you don't use Seam security features try


          Session.instance().invalidate()



          Both options will will clear out your HttpSession after the request ended.


          Hope this helps, Thorsten


          p.s.: you may also want to have a second look at your upload bean again because usually you shouldn't need SESSION scope for this.

          • 2. Re: Possible to end been with Scope=SESSION?
            shane.bryzak

            You should definitely be using a conversation-scoped component for this.  Look at RegisterAction in the seamspace example, it's conversation-scoped and receives an uploaded file.