From: Automerge Date: Tue, 22 May 2012 17:07:33 +0000 (+0000) Subject: [merge from 6.7] #8305 extend Liferay session when the user interacts with a Vaadin... X-Git-Tag: 7.0.0.alpha3~142^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=35b979139f4fbb6e6bbc19728951277adce394b7;p=vaadin-framework.git [merge from 6.7] #8305 extend Liferay session when the user interacts with a Vaadin portlet svn changeset:23802/svn branch:6.8 --- 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(); } } });