Search in sources :

Example 1 with InvalidSessionInfo

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;
    }
}
Also used : ClientDisconnectedEvent(org.rstudio.studio.client.application.events.ClientDisconnectedEvent) ServerOfflineEvent(org.rstudio.studio.client.application.events.ServerOfflineEvent) InvalidSessionInfo(org.rstudio.studio.client.application.model.InvalidSessionInfo) InvalidClientVersionEvent(org.rstudio.studio.client.application.events.InvalidClientVersionEvent) InvalidSessionEvent(org.rstudio.studio.client.application.events.InvalidSessionEvent)

Example 2 with InvalidSessionInfo

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);
}
Also used : InvalidSessionInfo(org.rstudio.studio.client.application.model.InvalidSessionInfo)

Aggregations

InvalidSessionInfo (org.rstudio.studio.client.application.model.InvalidSessionInfo)2 ClientDisconnectedEvent (org.rstudio.studio.client.application.events.ClientDisconnectedEvent)1 InvalidClientVersionEvent (org.rstudio.studio.client.application.events.InvalidClientVersionEvent)1 InvalidSessionEvent (org.rstudio.studio.client.application.events.InvalidSessionEvent)1 ServerOfflineEvent (org.rstudio.studio.client.application.events.ServerOfflineEvent)1