Compare commits
No commits in common. "95ceb82eed82bcb379917c113714c633b5fb102a" and "a792f5d2b744724f640c415669b2f04978dc2842" have entirely different histories.
95ceb82eed
...
a792f5d2b7
12
pom.xml
12
pom.xml
|
@ -122,14 +122,12 @@
|
|||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api -->
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>6.0.0</version>
|
||||
<!-- <dependency>
|
||||
<groupId>jakarta.servlet.jsp</groupId>
|
||||
<artifactId>jakarta.servlet.jsp-api</artifactId>
|
||||
<version>2.3.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependency>-->
|
||||
<!-- <dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
|
|
|
@ -124,15 +124,4 @@ public class CookieBean {
|
|||
public void setDisplayListSize(Integer value) {
|
||||
cookieMap.put(KEY_DISPLAY_ROWS, String.valueOf(value));
|
||||
}
|
||||
|
||||
public void sessionIdleListener() {
|
||||
log.warn("Session Idle Listener fired.");
|
||||
JSFUtils.addWarningMessage("Timeout approaching. Save your work!");
|
||||
}
|
||||
|
||||
public void sessionTimeout() {
|
||||
log.warn("Session Timeout Listener fired.");
|
||||
JSFUtils.logout();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import jakarta.faces.context.ExternalContext;
|
|||
import jakarta.faces.context.FacesContext;
|
||||
import jakarta.faces.context.Flash;
|
||||
import jakarta.servlet.http.Cookie;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -149,20 +148,5 @@ public class JSFUtils {
|
|||
getExternalContext().addResponseCookie(name,
|
||||
URLEncoder.encode(value, "UTF-8"),
|
||||
properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy current session, logging user out.
|
||||
*/
|
||||
public static void logout() {
|
||||
log.warn("Logging out session");
|
||||
jakarta.servlet.http.HttpSession session =
|
||||
(HttpSession) getExternalContext().getSession(false);
|
||||
if ( session != null ) {
|
||||
session.invalidate();
|
||||
} else {
|
||||
log.warn("Session did not exist.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,20 +10,18 @@ import org.springframework.boot.autoconfigure.domain.EntityScan;
|
|||
import org.springframework.boot.web.server.ErrorPage;
|
||||
import org.springframework.boot.web.server.ErrorPageRegistrar;
|
||||
import org.springframework.boot.web.server.ErrorPageRegistry;
|
||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||
import org.springframework.boot.web.servlet.ServletContextInitializer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
@SpringBootApplication
|
||||
@ServletComponentScan
|
||||
@EntityScan(value = {
|
||||
"com.mousetech.gourmetj.persistence.model" })
|
||||
public class SpringPrimeFacesApplication {
|
||||
|
||||
final String errorPage = "/error/error.html";
|
||||
final String error404Page = "/error/error404.html";
|
||||
final String expiredPage = "/main.xhtml";
|
||||
final String expiredPage = "/error/viewExpired.xhtml";
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SpringPrimeFacesApplication.class,
|
||||
|
|
|
@ -164,6 +164,20 @@ public class UserSession implements Serializable {
|
|||
*/
|
||||
private List<Recipe> shoppingList = new ArrayList<Recipe>();
|
||||
|
||||
/**
|
||||
* @return the sessionTimeoutInterval, msec
|
||||
*/
|
||||
public long getSessionTimeoutInterval() {
|
||||
return 5000L; //sessionTimeoutInterval;
|
||||
}
|
||||
|
||||
public void sessionIdleListener() {
|
||||
log.warn("Session Idle Listener fired.");
|
||||
JSFUtils.addWarningMessage("Timeout approaching. Save your work!");
|
||||
// PrimeFaces.current()
|
||||
// .executeScript("sessionExpiredConfirmation.show()");
|
||||
}
|
||||
|
||||
public String logoutAction() {
|
||||
log.warn("Session Idle listener logout");
|
||||
return goHome();
|
||||
|
|
|
@ -15,14 +15,13 @@
|
|||
<h:outputScript name="js/scrolltable.js" />
|
||||
<style>
|
||||
.deDescl {
|
||||
width: 15em;
|
||||
text-align: left;
|
||||
}
|
||||
width: 15em;
|
||||
text-align: left;
|
||||
|
||||
}
|
||||
.deDescr {
|
||||
text-align: left;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.ingSel {
|
||||
width: 3em;
|
||||
text-align: center;
|
||||
|
@ -55,9 +54,7 @@
|
|||
<p:tab id="overviewTab"
|
||||
title="Description"
|
||||
>
|
||||
<p:panelGrid columns="2"
|
||||
columnClasses="deDescl, deDescr"
|
||||
>
|
||||
<p:panelGrid columns="2" columnClasses="deDescl, deDescr">
|
||||
<f:facet name="header">Description</f:facet>
|
||||
<p:outputLabel for="@next"
|
||||
value="Title"
|
||||
|
@ -152,15 +149,13 @@
|
|||
rows="10" cols="45"
|
||||
value="#{recipeDetailBean.recipe.description}"
|
||||
/>
|
||||
</p:panelGrid>
|
||||
<p:panel id="picPanel">
|
||||
<img id="bigPix"
|
||||
src="/img/picture/?dt=#{recipeDetailBean.currentTime}"
|
||||
/>
|
||||
</p:panel>
|
||||
<p:panelGrid id="picButtonPanel"
|
||||
columns="2"
|
||||
>
|
||||
</p:panelGrid>
|
||||
<p:panel id="picPanel">
|
||||
<img id="bigPix"
|
||||
src="/img/picture/?dt=#{recipeDetailBean.currentTime}"
|
||||
/>
|
||||
</p:panel>
|
||||
<p:panelGrid id="picButtonPanel" columns="2">
|
||||
<p:fileUpload id="ctlUpload"
|
||||
label="Upload Image"
|
||||
listener="#{recipeDetailBean.ajaxUploadImage}"
|
||||
|
@ -170,14 +165,14 @@
|
|||
auto="true"
|
||||
sizeLimit="1000000"
|
||||
allowTypes="/(\.|\/)(gif|jpe?g|png|webp)$/"
|
||||
/>
|
||||
/>
|
||||
<p:commandButton id="ctlDelImg"
|
||||
value="Delete Image"
|
||||
action="#{recipeDetailBean.ajaxDeleteImage}"
|
||||
update="picPanel"
|
||||
immediate="true"
|
||||
/>
|
||||
</p:panelGrid>
|
||||
action="#{recipeDetailBean.ajaxDeleteImage}"
|
||||
update="picPanel"
|
||||
immediate="true"
|
||||
/>
|
||||
</p:panelGrid>
|
||||
</p:tab>
|
||||
<p:tab id="ingredientsTab"
|
||||
title="Ingredients"
|
||||
|
@ -401,28 +396,23 @@
|
|||
action="recipeDetails.jsf"
|
||||
/>
|
||||
<p:commandButton id="doHome" value="Home"
|
||||
icon="ui-icon-home" ajax="false"
|
||||
immediate="true" action="main.jsf"
|
||||
/>
|
||||
icon="ui-icon-home"
|
||||
ajax="false" immediate="true"
|
||||
action="main.jsf"
|
||||
/>
|
||||
</h:form>
|
||||
</p:panel>
|
||||
<!-- Note timeouts must be less than
|
||||
session timeout in application properties-->
|
||||
<p:growl id="growl" showDetail="true" sticky="true" />
|
||||
<!-- -->
|
||||
<p:growl id="growl" showDetail="true" />
|
||||
<h:form id="frmTimeout">
|
||||
<p:idleMonitor timeout="1500000">
|
||||
<p:ajax id="ajaxIdle" event="idle"
|
||||
listener="#{cookieBean.sessionIdleListener}"
|
||||
update="growl"
|
||||
/>
|
||||
</p:idleMonitor>
|
||||
<p:idleMonitor timeout="1900000">
|
||||
<p:ajax id="ajaxIdle" event="idle"
|
||||
listener="#{cookieBean.sessionTimeout}"
|
||||
update="growl"
|
||||
oncomplete="window.location='#{request.contextPath}/main.jsf'"
|
||||
/>
|
||||
</p:idleMonitor>
|
||||
<p:idleMonitor
|
||||
timeout="#{userSession.sessionTimeoutInterval}"
|
||||
>
|
||||
<p:ajax id="ajaxIdle" event="idle"
|
||||
listener="#{userSession.sessionIdleListener}"
|
||||
update="growl"
|
||||
/>
|
||||
</p:idleMonitor>
|
||||
</h:form>
|
||||
<!-- -->
|
||||
<p:dialog id="addGroupDlg" widgetVar="addGroupDlg">
|
||||
|
@ -454,9 +444,7 @@
|
|||
<p:dialog id="editShopcatDlg"
|
||||
widgetVar="editShopcatDlg"
|
||||
>
|
||||
<ui:include
|
||||
src="/WEB-INF/layout/dialog/editShopcat.xhtml"
|
||||
/>
|
||||
<ui:include src="/WEB-INF/layout/dialog/editShopcat.xhtml" />
|
||||
</p:dialog>
|
||||
</ui:define>
|
||||
</ui:composition>
|
||||
|
|
|
@ -25,7 +25,7 @@ server:
|
|||
servlet:
|
||||
session:
|
||||
timeout: '30m'
|
||||
# Theme here overrides joinfaces theme
|
||||
# Theme here pverrides jinfaces theme
|
||||
# context-parameters:
|
||||
# primefaces:
|
||||
# THEME: vela
|
||||
|
|
Loading…
Reference in New Issue
Block a user