Java Reference
In-Depth Information
however, the method has no return type and the last parameter is an AsyncCallback
object.
Listing 6-4. The code for LoginServiceAsync.class
package com.appirio.timeentry.client;
import com.google.gwt.user.client.rpc.AsyncCallback;
public interface LoginServiceAsync {
public void login(String requestUri, AsyncCallback<LoginInfo> async);
}
Google Accounts Login Implementation
Now you need to create your server-side implementation (Listing 6-5) that uses
Google Accounts to actually authenticate your users and return their information if
successful.
Listing 6-5. The code for LoginServiceImpl.class
package com.appirio.timeentry.server;
import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;
import com.appirio.timeentry.client.LoginInfo;
import com.appirio.timeentry.client.LoginService;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
public class LoginServiceImpl extends RemoteServiceServlet implements
LoginService {
public LoginInfo login(String requestUri) {
LoginInfo loginInfo = new LoginInfo();
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
if (user != null) {
loginInfo.setLoggedIn(true);
loginInfo.setLogoutUrl(userService.createLogoutURL(requestUri));
 
Search WWH ::




Custom Search