diff gnv/src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java @ 991:33198e55371c

Improved session handling in the gui. If a session has timed out, the user gets to the start point - the fis selection. gnv/trunk@1192 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 10 Jun 2010 15:13:08 +0000
parents 0441e78cd900
children 28a0628b11b0
line wrap: on
line diff
--- a/gnv/src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java	Thu Jun 10 09:54:58 2010 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java	Thu Jun 10 15:13:08 2010 +0000
@@ -2,6 +2,7 @@
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
 
 import org.apache.log4j.Logger;
 import org.apache.struts.action.Action;
@@ -94,5 +95,27 @@
 
         return good;
     }
+
+
+    protected boolean isSessionExhausted(HttpServletRequest request) {
+        HttpSession session = request.getSession();
+        return session.isNew();
+    }
+
+
+    protected ActionForward sessionExhaustedForward(
+        ActionMapping mapping, ActionForm form,
+        HttpServletRequest request, HttpServletResponse response)
+    throws Exception
+    {
+        request.setAttribute(
+            CommunicationKeys.REQUEST_EXCEPTION_SESSION_ID,
+            "SessionTimeout has occured");
+
+        log.warn("Session timed out.");
+
+        return new FetchArtifactFactoriesAction().execute(
+            mapping, form, request, response);
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org