From b735e95587971171bec21005715e71ac83798305 Mon Sep 17 00:00:00 2001 From: anhefti Date: Wed, 19 Jan 2022 16:06:31 +0100 Subject: [PATCH] SEBSERV-261 --- .../ethz/seb/sebserver/gui/RAPConfiguration.java | 16 ++++++++++++++++ .../resources/config/application-gui.properties | 2 ++ 2 files changed, 18 insertions(+) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/RAPConfiguration.java b/src/main/java/ch/ethz/seb/sebserver/gui/RAPConfiguration.java index 31096dd2..469a86fd 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/RAPConfiguration.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/RAPConfiguration.java @@ -30,6 +30,7 @@ import org.eclipse.rap.rwt.service.ServiceManager; import org.eclipse.swt.widgets.Composite; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.core.env.Environment; import org.springframework.http.HttpStatus; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; @@ -42,6 +43,7 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.auth.SEBServerAuthori public class RAPConfiguration implements ApplicationConfiguration { + public static final String ATTR_USER_SESSION_TIMEOUT = "sebserver.gui.session.timeout"; private static final String DEFAULT_THEME_NAME = "sebserver"; private static final Logger log = LoggerFactory.getLogger(RAPConfiguration.class); @@ -141,6 +143,7 @@ public class RAPConfiguration implements ApplicationConfiguration { @Override protected void createContents(final Composite parent) { + final HttpSession httpSession = RWT .getUISession(parent.getDisplay()) .getHttpSession(); @@ -164,6 +167,19 @@ public class RAPConfiguration implements ApplicationConfiguration { final WebApplicationContext webApplicationContext = getWebApplicationContext(httpSession); initSpringBasedRAPServices(webApplicationContext); + final Environment environment = webApplicationContext.getBean(Environment.class); + if (environment != null) { + + final Integer sessionTimeout = environment.getProperty( + ATTR_USER_SESSION_TIMEOUT, + Integer.class, + -1); + + httpSession.setMaxInactiveInterval(sessionTimeout); + } else { + httpSession.setMaxInactiveInterval(-1); + } + final EntryPointService entryPointService = webApplicationContext .getBean(EntryPointService.class); diff --git a/src/main/resources/config/application-gui.properties b/src/main/resources/config/application-gui.properties index be3ab3a7..7911fbbe 100644 --- a/src/main/resources/config/application-gui.properties +++ b/src/main/resources/config/application-gui.properties @@ -1,6 +1,8 @@ ########################################################## ### SEB Server GUI configuration +sebserver.gui.session.timeout=-1 + # theme sebserver.gui.theme=css/sebserver.css sebserver.gui.list.page.size=20