I have started having a look at gwtiger and some of the functionality in it looks great. I am particularly interested in how the session handling works. However, after checking the code and running the online demo, I noticed that the session information on the user (i.e. username) which should be displayed with the Welcome message is not displayed. Have I genuinely missed something or is this a potential bug?
Thanks in advance
Kind Regards
Mahamad
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Mahamad,
I dont have the server running for the online demo so the server side code is stubbed out.
If you want to see the real session handling, please see the GWTigerDemo included in the download.
Thanks for getting back to me so soon. I have had a look at the classes and I'll have another play around with them to see if I'm making a mistake somewhere.
In the meantime, can I ask how I should be checking who is logged in and retrieving the User Object? Should I be:
1. Just retrieving the name from the cookie (this doesn't sound viable as it's only for the remember me function - if someone doesn't select it, then I won't know who's logged in).
2. Pass the user object from one GWT BaseScreen to another? I think this is already in the setMainScreen(User) method, should we just use this.
3. Have it stored in the singleton and then be able to access it from throughout the project
4. Utilise the getUserFromSession() or isSessionAlive() method in the Service Implementation? (Doesn't this lead to a large number of RPC calls?
When running the GWTigerDemo code, the user object seems to be initialised, then when I try to access it from the TopPanel to show the User Information, no user can be found for some reason and therefore nothing is displayed with the Welcome! screen. I think even with just the GWT Hosted Mode Application, this should work right?
Thank you for helping me out here, I'm still a bit of a newbie with GWT and any help is appreciated. (GWTiger is going to make my life a lot easier with session handling... thanks!)
Moe
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There are different ways of doing this and it all depends on what you want to do.
What I have done in an application is to use the Base class (e.g. BaseMyAppScreen) from which all screens are derived.
If you set this user from your Login screen, it will be available from all your screens. The singleton method will achieve the same result but this code is smaller.
private static UserBean user=null;
public void setUser(UserBean u) {
user=u;
}
public UserBean getUser() {
return user;
}
Let me know if this works for you. I will add it to my example application.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Welcome to Help
Please feel free to post your questions or issues regarding GWTiger here.
Dear Addy
I have started having a look at gwtiger and some of the functionality in it looks great. I am particularly interested in how the session handling works. However, after checking the code and running the online demo, I noticed that the session information on the user (i.e. username) which should be displayed with the Welcome message is not displayed. Have I genuinely missed something or is this a potential bug?
Thanks in advance
Kind Regards
Mahamad
Hi Mahamad,
I dont have the server running for the online demo so the server side code is stubbed out.
If you want to see the real session handling, please see the GWTigerDemo included in the download.
look into the checkLogin method on the client side in the following class. It calls the checkLogin on the server below.
Note that after the server confirms the login is correct, this code stores the cookie (optional) and then calls the main screen with the user object which can be used to display on the page.
http://gwtiger.googlecode.com/svn/trunk/samples/GWTigerDemo/src/com/mycompany/client/screen/LoginScreen.java
You should check out the checkLogin method in the following class.
http://gwtiger.googlecode.com/svn/trunk/samples/GWTigerDemo/src/com/mycompany/server/MyAppServiceImpl.java
Please let me know if you need more help and I will be happy to walk you through this.
Addy
Hi Addy
Thanks for getting back to me so soon. I have had a look at the classes and I'll have another play around with them to see if I'm making a mistake somewhere.
In the meantime, can I ask how I should be checking who is logged in and retrieving the User Object? Should I be:
1. Just retrieving the name from the cookie (this doesn't sound viable as it's only for the remember me function - if someone doesn't select it, then I won't know who's logged in).
2. Pass the user object from one GWT BaseScreen to another? I think this is already in the setMainScreen(User) method, should we just use this.
3. Have it stored in the singleton and then be able to access it from throughout the project
4. Utilise the getUserFromSession() or isSessionAlive() method in the Service Implementation? (Doesn't this lead to a large number of RPC calls?
When running the GWTigerDemo code, the user object seems to be initialised, then when I try to access it from the TopPanel to show the User Information, no user can be found for some reason and therefore nothing is displayed with the Welcome! screen. I think even with just the GWT Hosted Mode Application, this should work right?
Thank you for helping me out here, I'm still a bit of a newbie with GWT and any help is appreciated. (GWTiger is going to make my life a lot easier with session handling... thanks!)
Moe
There are different ways of doing this and it all depends on what you want to do.
What I have done in an application is to use the Base class (e.g. BaseMyAppScreen) from which all screens are derived.
If you set this user from your Login screen, it will be available from all your screens. The singleton method will achieve the same result but this code is smaller.
private static UserBean user=null;
public void setUser(UserBean u) {
user=u;
}
public UserBean getUser() {
return user;
}
Let me know if this works for you. I will add it to my example application.