switch (statusCode) {
case STATUS_CODE_OK:
if (response != null && response.getText() != null && response.getText().isEmpty()
&& !LoginView.isLoginShowing()) { // this happens when the RHQ server was restarted
Log.error("RHQ server was probably restarted. Showing the login page.");
new LoginView().showLoginDialog(true);
break;
}
RPCTracker.getInstance().succeedCall(this);
callback.onResponseReceived(request, response);
break;
// these status codes are known to be returned from various browsers when the server is lost or not responding
case STATUS_CODE_ERROR_INTERNET_NO_RESPONSE:
case STATUS_CODE_ERROR_INTERNET_CANNOT_CONNECT:
case STATUS_CODE_ERROR_INTERNET_CONNECTION_ABORTED:
RPCTracker.getInstance().failCall(this);
// If the server is unreachable or has terminated, and the user is still logged in,
// let them know the server is now unreachable.
if (UserSessionManager.isLoggedIn()) {
CoreGUI.getErrorHandler().handleError(CoreGUI.getMessages().view_core_serverUnreachable());
} else {
new LoginView().showLoginDialog(true);
}
break;
default:
RPCTracker.getInstance().failCall(this);
// process the failure only if the user still logged in
if (UserSessionManager.isLoggedIn()) {
callback.onResponseReceived(request, response);
} else {
new LoginView().showLoginDialog(true);
}
}
}