I have a login.jsp with the login form.
And a hostedPage.jsp where the user is redirected after his logged in.
Also I have a MyServiceServlet that extends RemoteServiceServlet. In this
class I overrided onBeforeRequestDeserialized and I check if the user if
logued in. If he is not, I throw an AuthenticationException
protected void onBeforeRequestDeserialized(String serializedRequest) {
UserService userService = UserServiceFactory.getUserService();
com.google.appengine.api.users.User user =
userService.getCurrentUser();
if (user == null) {
throw new AuthenticationException();
}
}
In this class also I have a few methods to know if the user is logued in,
ie:
public String getUserId() {
HttpServletRequest request = this.getThreadLocalRequest();
HttpSession session = request.getSession();
if (session.getAttribute(SessionVariables.USER_SESSION) != null) {
return ((User) session
.getAttribute(SessionVariables.USER_SESSION)).getEmail();
}
return null;
}
Then all my ServiceImpl extends MyServiceServlet.
I hope this helps you a little.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.