Instead of this I would just extend RemoteServiceServlet and add a public static method that makes the session available to everyone (just like RequestFactoryServlet does), e.g.
public static HttpSession getThreadLocalSession() {
return getThreadLocalRequest().getSession();
}
Then in your service method:
public boolean isUserLoggedIn() throws IllegalArgumentException {
HttpSession session = YourExtendedRemoteServiceServlet.getThreadLocalSession();
if(session.isNew()) {
throw new IllegalArgumentException("Logged out");
}
}
That way you actually see the session check at the correct place and not hidden in your RemoteServiceServlet implementation.
-- J.
-- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/7pjmY6KxjVcJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment