Handles session timeouts much better now!

This commit is contained in:
Tim Holloway 2022-01-08 20:50:17 -05:00
parent 65acd42f11
commit ab9255d3d4
6 changed files with 38 additions and 4 deletions

View File

@ -23,7 +23,7 @@ public class SpringPrimeFacesApplication {
final String errorPage = "/error/error.html"; final String errorPage = "/error/error.html";
final String error404Page = "/error/error404.html"; final String error404Page = "/error/error404.html";
final String expiredPage = "/error/viewExpired.html"; final String expiredPage = "/error/viewExpired.xhtml";
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(SpringPrimeFacesApplication.class, SpringApplication.run(SpringPrimeFacesApplication.class,

View File

@ -130,8 +130,8 @@ public class UserSession implements Serializable {
} }
// Primefaces handle session timeout // Primefaces handle session timeout
// Session timeout, ms // Session timeout, ms (25 minutes)
long sessionTimeoutInterval = 30000L; long sessionTimeoutInterval = 25 * 60_000L;
/** /**
* @return the sessionTimeoutInterval * @return the sessionTimeoutInterval

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2"
>
<name>GourmetJ</name>
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>home</from-outcome>
<to-view-id>/main.jsf</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
<title>View Expired</title>
</h:head>
<h:body>
<h2>View Expired.</h2>
<h:form>
The user session has timed out. Return to main page.
<h:commandButton value="OK" action="home"></h:commandButton>
</h:form>
</h:body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@ -47,7 +47,7 @@
<p:commandButton <p:commandButton
value="Back" ajax="false" value="Back" ajax="false"
icon="ui-icon-arrowthick-1-w" icon="ui-icon-arrowthick-1-w"
action="main.jsf" action="home"
immediate="true" immediate="true"
/> />
<p:commandButton ajax="false" <p:commandButton ajax="false"