GWT:如何验证下载后入口点? [英] GWT: How to download EntryPoint after authenticating?

查看:96
本文介绍了GWT:如何验证下载后入口点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里的想法是让我的GWT应用程序在2个不同的模块:

The idea here is to have my GWT app in 2 different modules:


  1. WebModule (入口点),仅仅包含一个登录界面;和

  2. 的AppModule (入口点),其中包含的主要应用

  1. WebModule (entry point) that simply contains a login screen; and
  2. AppModule (entry point) that contains the main application

当用户访问网站时, WebModule 下载到他们的浏览器和presents登录屏幕给他们。然后,他们必须提交用户名和密码,然后使用GWT-RPC来验证他们的身份,并确定他们是否被允许继续进行。

When users go to the website, the WebModule downloads into their browser and presents a login screen to them. They must then submit a username and password, which then uses GWT-RPC to authenticate them and determine if they are allowed to proceed.

如果验证通过,我想的AppModule 来下载,它有自己的出发地点(和各视图/ presenter),我想用户被重定向到那个地方。

If authentication passes, I would like the AppModule to be downloaded, which has its own starting Place (and respective view/presenter), and I would like the user to be redirected to that place.

我怎么能实现这个功能?既:

How could I implement this functionality? Both:


  • 强制的AppModule 只有成功登录后下载;和

  • 将用户重定向到的AppModule 的首发位置?

  • Forcing the AppModule to download only upon successful login; and
  • Redirecting the user to the AppModule's starting place?

在此先感谢!

推荐答案

我与面板普兰。
我的GWT应用程序有一个结构:

I'm plaing with panels. My GWT applications have a structure:

公共类课程实现入口点{

public class Courses implements EntryPoint {

....所有变量

public void onModuleLoad() {
    // Login - select from database all user
    //
    statusMessage.setText("Waiting for users list.");
    String message = new String();
    myDatastoreService.loginSelect(message,
            new AsyncCallback<List<LoginInfo>>() {
        public void onFailure(Throwable error) {
            Window.alert(error.getMessage());
        }

        public void onSuccess(List<LoginInfo> result) {
            statusMessage.setText("");
            loginInfo = result;
            if (loginInfo.isEmpty()) {
                System.out.println("Empty");
                UserDialog createUser = new UserDialog();
                createUser.userInfo("F", -1, currentUser,
                            userTable, loginInfo, statusMessage);
            } else {
                loginDialog();
            }
        }
    });
    RootPanel.get("statusPanelContainer").add(statusMessage);
}
// Login dialog:
private void loginDialog() {
    //Here you have to put all panels you need for login
    // If login is successfully : you have to remove all login panels from main panels (not root)
    // and call main dialog
     mainDialog();
    // If login is not successfully you stay on login panel

}
private void mainDialog() {
    // Here you put all your applications mains panels
}

}

这篇关于GWT:如何验证下载后入口点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆