How to redirect to login page after session expire in GWT RPC call

后端 未结 8 1260
死守一世寂寞
死守一世寂寞 2020-12-13 07:44

I am using GWT and RPC in my app. after session expires when I do a RPC call, because of my login-filter the request redirect to login.jsp, but my problem is client doen\'t

8条回答
  •  旧时难觅i
    2020-12-13 08:24

    You will get com.google.gwt.user.client.rpc.InvocationException when service method is not called because of session expired. You can check that in onFailure method and simply redirect user to login page.

    
        public void onFailure(Throwable caught) {
        if (caught instanceof InvocationException) {
                                SC.warn("Your session has expired, Please login again.",
                                        value -> com.google.gwt.user.client.Window.Location.replace("/login.jsp"));
        }else{...
        }
        }
    
    

提交回复
热议问题