Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
19. Feb 2008, 10:28 CET | Link

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

2 Replies:
19. Feb 2008, 12:58 CET | Link

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.

21. Feb 2008, 02:35 CET | Link

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.