diff --git a/README.md b/README.md index 30acbde..ef011a4 100644 --- a/README.md +++ b/README.md @@ -95,4 +95,16 @@ displayed. To minimize this, better timeout mechanisms have been installed and the recipe browser keeps last-search and search-type values in long-lived cookies on the client. The server will read and cache them, but if the server times out, it will automatically -re-read the cookies on the next request. \ No newline at end of file +re-read the cookies on the next request. + +When editing, the AJAX controls tended to get confused when a +session timed out. New changes give a "save work" warning 5 minutes +before timeout, and force a timeout from JavaScript that +exits the unattended page before the user can run afoul of the +lost session. + +Note that by default, JSF caches ViewState in a session so every +JSF View can cause a session to be created, not just Views that +reference View- or SessionScoped backing beans. This is alterable +by setting an option in the faces-config. +force \ No newline at end of file diff --git a/application.properties b/application.properties index 2eaa53c..9741f1c 100644 --- a/application.properties +++ b/application.properties @@ -24,3 +24,6 @@ gourmet.password.file=${user.home}/.gourmetpw # This will override aplication.yml #server.servlet.context-parameters.primefaces.THEME=le-frog + +### HttpSession timeout (note effects on detailEdit idleMonitors) +server.servlet.session.timeout=35m diff --git a/src/main/java/com/mousetech/gourmetj/CookieBean.java b/src/main/java/com/mousetech/gourmetj/CookieBean.java index 2f29af4..c18399e 100644 --- a/src/main/java/com/mousetech/gourmetj/CookieBean.java +++ b/src/main/java/com/mousetech/gourmetj/CookieBean.java @@ -22,6 +22,7 @@ import jakarta.inject.Named; /** * Request caching object for cookie data persistence. + * Does double-duty serving View Session timeouts. * * @author timh * @since Jan 31, 2024 @@ -125,13 +126,16 @@ public class CookieBean { cookieMap.put(KEY_DISPLAY_ROWS, String.valueOf(value)); } + /** + * IdleMonitor backing methods (session/View timeout) + */ public void sessionIdleListener() { - log.warn("Session Idle Listener fired."); + log.info("Session Idle Listener fired."); JSFUtils.addWarningMessage("Timeout approaching. Save your work!"); } public void sessionTimeout() { - log.warn("Session Timeout Listener fired."); + log.info("Session Timeout Listener fired."); JSFUtils.logout(); } diff --git a/src/main/resources/META-INF/resources/detailEdit.xhtml b/src/main/resources/META-INF/resources/detailEdit.xhtml index d62e415..cf8f54e 100644 --- a/src/main/resources/META-INF/resources/detailEdit.xhtml +++ b/src/main/resources/META-INF/resources/detailEdit.xhtml @@ -391,11 +391,7 @@ - +