yes i would invalidate the session:

onclick() {
  final string url=urlfor(HomePage.class);
  getsession().invalidate();
  getrequestcycle().pushTarget(new RedirectRequestTarget(url));
}

something like that

-igor


On 4/24/07, Francisco Diaz Trepat - gmail <[EMAIL PROTECTED]>
wrote:

Hello everyone, I was wondering for a proper way to handle sessions and
logging in and out of a wicket application in general.

The thing is as follows.

I have a Session called WicketSession, inside of which I use a CORBA
BUISINESS object labeled m_cSession to do a Login.

WicketSession has the following two methods:

   /**
    * Terminates the logged user for this Session.
    */
   public void logout() {
      //Verify user isn't logged out already
      if (!m_bUserLoggedIn) {
         return;
      }
      //Execute a logout
      try {
         m_cSession.logout();
         m_bUserLoggedIn = false;
         m_cSessionLocale = Locale.getDefault();
      }
      catch (Exception xException) {
         m_bUserLoggedIn = false;
         m_cSessionLocale = Locale.getDefault();
      }
   }

   /**
    * Initiates logged user for this Session.
    */
   public void login(String sUserId, String sUserPassword) {
      //Verify input data and that the user isn't logged in already
      if (m_bUserLoggedIn || sUserId == null || sUserPassword == null) {
         m_bUserLoggedIn = false;
         return;
      }
      //Execute a login
      try {
         //create a session
         m_cSession = new ch.logismata.serverwrapper.Session();
         //set user and password
         m_cSession.setId(sUserId);
         m_cSession.setPassword(sUserPassword);
         //Execute and verify login
         if (m_cSession.login() != null) {
            m_bUserLoggedIn = true;
         }
      } catch (Exception xException) {
         m_bUserLoggedIn = false;
      }
   }


...

Very plain. The thing is this, Session also maintains certain state
already in wicket, and a question was:

Should I invalidate the session? If I do, can I redirect the user to a
"Home Page" where he would get a new session going-on?

Is this a proper approach?

Usually when I close the Tab on my Firefox and I Call to the site, the
Session is also remembered as the Locale is maintain as that of the last
state (before I close the tab).

Why is this?

Sorry if my questions may feel sordid.

f(t)

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to