diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/AbstractAsyncCallback.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/AbstractAsyncCallback.java index 9e635e8df1f030d68b6957fd54688e2e67aa414c..db28dd4d6db73628de0171880a236c4931ba853e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/AbstractAsyncCallback.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/AbstractAsyncCallback.java @@ -24,7 +24,9 @@ import com.extjs.gxt.ui.client.event.WindowListener; import com.extjs.gxt.ui.client.widget.Dialog; import com.extjs.gxt.ui.client.widget.MessageBox; import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException; import com.google.gwt.user.client.rpc.InvocationException; +import com.google.gwt.user.client.rpc.SerializationException; import ch.systemsx.cisd.common.shared.basic.utils.StringUtils; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.GWTUtils; @@ -207,6 +209,13 @@ public abstract class AbstractAsyncCallback<T> implements AsyncCallback<T> public final void onFailure(final Throwable caught) { + if (isIncompatibleServerException(caught)) + { + String sessionExpiredMessage = getMessage(Dict.SESSION_EXPIRED_MESSAGE); + handleSessionTerminated(sessionExpiredMessage); + return; + } + final String msg; if (caught instanceof InvocationException) { @@ -247,6 +256,12 @@ public abstract class AbstractAsyncCallback<T> implements AsyncCallback<T> } } + private boolean isIncompatibleServerException(final Throwable caught) + { + return caught instanceof SerializationException + || caught instanceof IncompatibleRemoteServiceException; + } + private String getMessage(String messageKey, Object... params) { if (viewContext != null) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java index 5fc114aecc3e975ac0c456c9ec9929d3c7d0b98d..4fd575c229f1bce96cb021cb865d1d63ebf68b2e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java @@ -199,6 +199,8 @@ public abstract class Dict public static final String EXCEPTION_WITHOUT_MESSAGE = "exception_withoutMessage"; + public static final String SESSION_EXPIRED_MESSAGE = "session_expired"; + // // Header // diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js index 21ff93ef95720552bcbc854832c6ce728fa55bfa..5aaed0ce026ee0701ec9c208b1c5597d349ded2b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js +++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js @@ -168,6 +168,7 @@ var common = { exception_invocationMessage: "Failed to contact the server. Please try again later or contact your administrator.", exception_withoutMessage: "Unexpected error has occurred, please contact your administrator:<br>{0}", + session_expired: "Session expired. Please login again.", // // Header