In one of my GWT-Platform applications, I had a strange problem when I launch an application in Jetty configured in the GWT plugin for eclipse and click on the updated browser page, the current page loads (placeManager.getCurrentPlaceRequest ()) successfully, but when the war The application is deployed to tomcat / jboss, stops after the onBind () method of the current host location request and does not show the page.
During the update processing, the first canReveal () method for GateKeeper for this Presenter returns false, and after the server is called, I again find the current location, which the canReveal () method calls to return true, but the host is still not open. So, here I suspect something is complicated.
Any hint of this behavior?
Below is the code snippet for the implemented LoggedInGatekeeper, which plays a key role:
public class LoggedInGatekeeper implements Gatekeeper {
private final EventBus eventBus; private final DispatchAsync dispatcher; private final PlaceManager placeManager; private CurrentUser currentUser; private boolean isUserLoggedOut; private String lastPageAccessed; @Inject public LoggedInGatekeeper(final EventBus eventBus, final DispatchAsync dispatcher, final PlaceManager placeManager) { this.eventBus = eventBus; this.dispatcher = dispatcher; this.placeManager = placeManager; this.eventBus.addHandler(LoginAuthenticatedEvent.getType(), new LoginAuthenticatedEventHandler() { @Override public void onLogin(LoginAuthenticatedEvent event) { currentUser = event.getCurrentUser(); isUserLoggedOut = false; } }); this.eventBus.addHandler(LogoutUserEvent.getType(), new LogoutUserEventHandler() { @Override public void onLogoutUser(LogoutUserEvent event) { SessionFactory.removeCookie(Constants.LAST_PAGE_ACCESSED); currentUser = null; isUserLoggedOut = true; } }); } @Override public boolean canReveal() { Log.info("Browser fetched session cookie : " + Cookies.getCookie(Constants.JSESSION_COOKIE_KEY)); if (Cookies.getCookie(Constants.JSESSION_COOKIE_KEY) == null) { SC.say("Your session is expired. Please login again"); NavigateToLoginEvent.fire(eventBus); return false; } if (currentUser != null && !isUserLoggedOut) { lastPageAccessed = placeManager.getCurrentPlaceRequest().getNameToken(); Log.info("canReveal() 1 : " + lastPageAccessed); SessionFactory.addCookie(Constants.LAST_PAGE_ACCESSED, lastPageAccessed); return currentUser.isLoggedIn(); } else if (isUserLoggedOut) { Log.info("canReveal() 2 : User is logged out"); NavigateToLoginEvent.fire(eventBus); return false; } else { Log.info("canReveal() 3 : Check on server for logged in user"); dispatcher.execute(new FetchLoggedInUserAction(), new FetchLoggedInUserAsyncCallback()); return true; } } class FetchLoggedInUserAsyncCallback extends MessageAsyncCallback<FetchLoggedInUserResult> { public FetchLoggedInUserAsyncCallback() { super("Loading..."); } @Override public void doOnFailure(Throwable caught) { NavigateToLoginEvent.fire(eventBus); } @SuppressWarnings("unchecked") @Override public void doOnSuccess(FetchLoggedInUserResult result) { if (result == null) { Log.info("doOnSuccess() 1 : LoggedInUser not found on server"); NavigateToLoginEvent.fire(eventBus); } else { Log.info("doOnSuccess() 2 : LoggedInUser found on server"); if (result.getLoggedInUser() != null) { currentUser = new CurrentUser(); currentUser.setMerchantConsoleUser(result.getLoggedInUser()); SessionFactory.getClientSessionInstance().put(SessionKeys.LOGGED_IN_USER, result.getLoggedInUser()); PlaceRequest currentPlaceRequest = placeManager.getCurrentPlaceRequest(); Log.info("doOnSuccess() 3 : " + currentPlaceRequest.getNameToken()); if (currentPlaceRequest != null) { placeManager.revealPlace(currentPlaceRequest); } } else { NavigateToLoginEvent.fire(eventBus); } } } }
}
code>
Thanks at Advance.
source share