From 35b979139f4fbb6e6bbc19728951277adce394b7 Mon Sep 17 00:00:00 2001 From: Automerge Date: Tue, 22 May 2012 17:07:33 +0000 Subject: [PATCH] [merge from 6.7] #8305 extend Liferay session when the user interacts with a Vaadin portlet svn changeset:23802/svn branch:6.8 --- .../gwt/client/ApplicationConnection.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java index dcf52827ed..4448c047c2 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java @@ -330,6 +330,25 @@ public class ApplicationConnection { } }-*/; + /** + * If on Liferay and logged in, ask the client side session management + * JavaScript to extend the session duration. + * + * Otherwise, Liferay client side JavaScript will explicitly expire the + * session even though the server side considers the session to be active. + * See ticket #8305 for more information. + */ + protected native void extendLiferaySession() + /*-{ + if ($wnd.Liferay && $wnd.Liferay.Session) { + $wnd.Liferay.Session.extend(); + // if the extend banner is visible, hide it + if ($wnd.Liferay.Session.banner) { + $wnd.Liferay.Session.banner.remove(); + } + } + }-*/; + /** * Get the active Console for writing debug messages. May return an actual * logging console, or the NullConsole if debugging is not turned on. @@ -819,6 +838,14 @@ public class ApplicationConnection { public void execute() { if (!hasActiveRequest()) { hideLoadingIndicator(); + + // If on Liferay and session expiration management is in + // use, extend session duration on each request. + // Doing it here rather than before the request to improve + // responsiveness. + // Postponed until the end of the next request if other + // requests still pending. + extendLiferaySession(); } } }); -- 2.39.5