use of org.rstudio.studio.client.application.model.InvalidSessionInfo in project rstudio by rstudio.
the class RemoteServer method handleRpcErrorInternally.
private boolean handleRpcErrorInternally(RpcError error) {
if (error.getCode() == RpcError.UNAUTHORIZED) {
handleUnauthorizedError();
return true;
} else if (error.getCode() == RpcError.INVALID_CLIENT_ID) {
// disconnect
disconnect();
// fire event
ClientDisconnectedEvent event = new ClientDisconnectedEvent();
eventBus_.fireEvent(event);
// handled
return true;
} else if (error.getCode() == RpcError.INVALID_CLIENT_VERSION) {
// disconnect
disconnect();
// fire event
InvalidClientVersionEvent event = new InvalidClientVersionEvent();
eventBus_.fireEvent(event);
// handled
return true;
} else if (error.getCode() == RpcError.SERVER_OFFLINE) {
// disconnect
disconnect();
// fire event
ServerOfflineEvent event = new ServerOfflineEvent();
eventBus_.fireEvent(event);
// handled
return true;
} else if (error.getCode() == RpcError.INVALID_SESSION) {
// disconnect
disconnect();
// fire event
InvalidSessionInfo info = error.getClientInfo().isObject().getJavaScriptObject().cast();
InvalidSessionEvent event = new InvalidSessionEvent(info);
eventBus_.fireEvent(event);
// handled
return true;
} else {
return false;
}
}
use of org.rstudio.studio.client.application.model.InvalidSessionInfo in project rstudio by rstudio.
the class Application method onInvalidSession.
public void onInvalidSession(InvalidSessionEvent event) {
// calculate the url without the scope
InvalidSessionInfo info = event.getInfo();
String baseURL = GWT.getHostPageBaseURL();
String scopePath = info.getScopePath();
int loc = baseURL.indexOf(scopePath);
if (loc != -1)
baseURL = baseURL.substring(0, loc) + "/";
if (info.getScopeState() == InvalidSessionInfo.ScopeMissingProject) {
baseURL += "projectnotfound.htm";
} else {
// add the scope info to the query string
baseURL += "?project=" + URL.encodeQueryString(info.getSessionProject()) + "&id=" + URL.encodeQueryString(info.getSessionProjectId());
}
navigateWindowWithDelay(baseURL);
}
Aggregations