Tuesday, January 19, 2010

Signing A User Out

I realized that I haven't shown how to sign a user out yet. I have a link to /signout in my navigation template, but nothing mapped to that URL. This is where having a project plan (or at least a to-do list) would help!

So, I'll create a Signout servlet mapped to /signout. In that servlet, I need to get the session object and call the invalidate method on it. Afterward, I'll redirect the user to the front page.

It'll look something like this:


HttpSession session = req.getSession(false);

if (session != null)
session.invalidate();

resp.sendRedirect("/front");


and that's it. Not a big deal, but something we needed to implement.

1 comment:

  1. Hello. First, to let you know I have found this blog very helpful, and thank you for that.

    Listen I am using GWT and GAE and with RPC, and also NetBeans (so I do not have the luck of working with FileMaker). When I first get to the app I have the sign in page, and then with the Printer if the sign in was successfull I can create an html with the javascript created by the MainEntryPoint.

    My question is: after I create this page everything else will be manage by the EntryPoint?. And no need to call anyother servlet than the RPC calls. Thank you in advance.

    ReplyDelete