This method is updating test variable. But the problem is that if condition does not wait for call to be completed instead it executes and produces wrong result. Any suggestion.
((GWTServiceUsersAsync)GWT.create(GWTServiceUsers.class)).checkSession(callbackcheck);
if(test==0) {
MessageBox.alert("Access denied", "Access denied, please log in", null);
return 0;
} else {
return 1;
}
Async means that you don’t know when the callback will occur which is why it doesn’t wait. Also in java we generally use booleans(true, false) not numbers. Here is an example on what you would do:
The rest of your code after check session can then be handled in responseHandlingMethod. I would recommend following some of the tutorials that google have like Google RPC tutorial.