Problem solved !! Issue not related to GWT !! On Jun 5, 11:08 pm, GWTNewbie <[email protected]> wrote: > Hello: > I am a newbie to GWT. I am developing an app (without MVP). The app > has a login page and a welcome page. I am using the Entry Point class > itself as my Event listener and History ValueChangeHandler. The > scenario is as follows, when the user launches the URL the system > first validates if there is a session active for the user, if the > session is active the Welcome page is displayed. If no session is > active the Login Page is displayed and if the user enters valid > credentials the welcome page is displayed. The issue is that if a > session is already running the welcome page never gets displayed. > > Code snippets are as follows: > > public class MainApp implements EntryPoint, AsyncCallback<String>, > EventHandler, ValueChangeHandler { > > /** > * This is the entry point method. > */ > private SessionContext session = new SessionContext(); > > public void onModuleLoad() { > //validateSession(); > Log.warn("onModuleLoad()"); > initHistory(); > } > > private void initHistory() { > String token = History.getToken(); > Log.warn("initHistory()" + token); > History.addValueChangeHandler(this); > if (token.length() == 0) { > onHistoryChange(Event.DISPLAY_LOGON.toString()); > } else { > onHistoryChange(token); > } > } > > private void onHistoryChange(String token) { > Log.warn("onHistoryChange() - token :" + token); > if (token.equals(Event.DISPLAY_LOGON.toString()) > || > token.equals(Event.LOGON_SUCCESSFUL.toString())) { > validateSession(); > } > } > > @Override > public void onFailure(Throwable caught) { > Log.warn("Validate Session Failed !!"); > this.showLogonView(); > } > > @Override > public void onSuccess(String result) { > Log.warn("Validate Session successful - sessionId : " + > result); > this.showWelcomeView(); > } > > private void showWelcomeView() { > Log.warn("showWelcomeView()"); > Log.warn("SessionId: " + > session.getSessionDetails().getSessionId().toString()); > HomeView homeView = new HomeView(this, session); > WelcomeHeaderView headerView = new WelcomeHeaderView(this, > session); > WelcomeMenuView menuView = new WelcomeMenuView(this, session); > RootLayoutPanel.get().clear(); > Integer count = > (Integer)RootLayoutPanel.get().getWidgetCount(); > Log.warn("After Clear: " + count.toString()); > RootLayoutPanel.get().add(homeView); > homeView.headerPanel.add(headerView); > homeView.leftPanel.add(menuView); > count = (Integer)RootLayoutPanel.get().getWidgetCount(); > Log.warn("After Add: " + count.toString()); > History.newItem(Event.LOGON_SUCCESSFUL.toString()); > } > > private void showLogonView() { > Log.warn("showLogonView()"); > HomeView homeView = new HomeView(this, session); > LoginView loginView = new LoginView(this, session); > RootLayoutPanel.get().clear(); > RootLayoutPanel.get().add(homeView); > homeView.mainPanel.add(loginView); > History.newItem(Event.DISPLAY_LOGON.toString()); > } > > private void validateSession() { > LogonAndRegistrationServiceAsync logonAndRegistrationService > = GWT > .create(LogonAndRegistrationService.class); > String sessionId = Cookies.getCookie("sid"); > logonAndRegistrationService.checkSession(sessionId, this); > } > > } > > When there is no session active, the login View gets displayed > correctly and when valid credentials are provided the WelcomeView is > displayed correctly. However when a session is already active (and > when I switch on the GWT-Log) I can see that the showWelcomeView() > gets invoked, but the subsequent Log entries are not shown and looks > like the rest of the code is not getting executed. The call stack from > the GWT Log is shown below: > > (-:-) 2010-06-05 22:28:12,633 [WARN ] onModuleLoad() > (-:-) 2010-06-05 22:28:12,635 [WARN ] initHistory()LOGON_SUCCESSFUL > (-:-) 2010-06-05 22:28:12,635 [WARN ] onHistoryChange() - > token :LOGON_SUCCESSFUL > (-:-) 2010-06-05 22:28:12,993 [WARN ] Validate Session successful - > sessionId : Session Valid > (-:-) 2010-06-05 22:28:12,995 [WARN ] showWelcomeView() > > Any ideas as to what is going wrong here ? > Thanks a lot. > Best regards > Venki
-- 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.
