From: Matti Tahvonen Date: Thu, 25 Jun 2009 13:20:35 +0000 (+0000) Subject: Added liferay specific hack to extend portal session after each Vaadin servlet visit. X-Git-Tag: 6.7.0.beta1~2706 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c432f5210101cbb383c7429f156142a871e200c3;p=vaadin-framework.git Added liferay specific hack to extend portal session after each Vaadin servlet visit. svn changeset:8240/svn branch:6.0 --- diff --git a/src/com/vaadin/terminal/gwt/server/ApplicationPortlet.java b/src/com/vaadin/terminal/gwt/server/ApplicationPortlet.java index 323941108c..f432e17fd1 100644 --- a/src/com/vaadin/terminal/gwt/server/ApplicationPortlet.java +++ b/src/com/vaadin/terminal/gwt/server/ApplicationPortlet.java @@ -1,6 +1,7 @@ package com.vaadin.terminal.gwt.server; import java.io.IOException; +import java.io.OutputStream; import java.io.PrintWriter; import java.io.Serializable; @@ -72,8 +73,31 @@ public class ApplicationPortlet implements Portlet, Serializable { request.setAttribute(ApplicationServlet.REQUEST_APPSTYLE, style); } + dispatcher.include(request, response); + boolean isLifeRay = request.getPortalContext().getPortalInfo() + .toLowerCase().contains("liferay"); + if (isLifeRay) { + /* + * Temporary support to heartbeat Liferay session when using + * Vaadin based portlet. We hit an extra xhr to liferay + * servlet to extend the session lifetime after each Vaadin + * request. This hack can be removed when supporting porlet + * 2.0 and resourceRequests. + * + * TODO make this configurable, this is not necessary with + * some custom session configurations. + */ + OutputStream out = response.getPortletOutputStream(); + byte[] lifeRaySessionHearbeatHack = ("") + .getBytes(); + out.write(lifeRaySessionHearbeatHack); + } + } catch (PortletException e) { PrintWriter out = response.getWriter(); out.print("

Servlet include failed!

"); @@ -89,5 +113,4 @@ public class ApplicationPortlet implements Portlet, Serializable { } } - }