2012-07-20 68 views
0

我正在開發一個僅在您是管理員時加載的Google應用。這是我嘗試去做的一個例子。無法驗證用戶是否是Google應用中的管理員

public class MyAppEntryPoint implements EntryPoint { 
    @Override 
    public void onModuleLoad() { 
     appUserServ = GWT.create(AppUserService.class); 
     appUserServ.IsAdministrator(new AsyncCallback<Boolean>() { 
     @Override 
     public void onSuccess(Boolean isAdmin) { 
      if(isAdmin) { 
       LoadUI(); //Loads the site. 
      } 
     } 
     @Override 
     public void onFailure(Throwable caught) { 
      //handle error 
     } 
    }; 
    } 
} 

AppUserService.IsAdministrator電話AppUser.IsAdministrator()這就要求UserService.isUserAdmin()

當我嘗試運行應用程序並登錄作爲管理員,我得到這個錯誤:

com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract boolean com.myapp.client.AsyncServices.AppUserService.IsAdministrator()' threw an unexpected exception: java.lang.VerifyError: Expecting a stackmap frame at branch target 38 in method com.myapp.UserService.AppUser.ValidUser()Z at offset 33 
    ... 
Caused by: java.lang.VerifyError: Expecting a stackmap frame at branch target 38 in method com.myapp.UserService.AppUser.ValidUser()Z at offset 33 
    at com.myapp.server.AppUserServiceImpl.IsAdministrator(AppUserServiceImpl.java:26) 
    ... 

有誰知道這是什麼錯誤意味着或如何解決呢?

此外,我正在開發谷歌SDK的v1.7。

+0

你能顯示服務器端異常嗎? – 2012-07-21 04:26:23

回答

2

當你說管理員時,你的意思是Google App Engine管理員的概念嗎?如果是這樣,你可以configure this in app.yaml並顯着降低複雜性。例如:

handlers: 

- url: /admin/* 
    servlet: com.example.AdminServlet 
    login: admin 

這個例子會將所有請求/admin/*AdminServlet並要求用戶將顯示頁面之前的管理員。

+0

這看起來很完美。謝謝。 – dkellycollins 2012-07-23 16:45:13

相關問題