From 3359bc85481587fc7354fdecb96387614242a995 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 22 Sep 2016 18:05:49 +1000 Subject: [PATCH] Issue #945 --- ...ssion-cache.xml => session-cache-hash.xml} | 1 + .../config/modules/session-cache-hash.mod | 3 +- .../session/DefaultSessionCacheFactory.java | 41 +++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) rename jetty-server/src/main/config/etc/sessions/{hash-session-cache.xml => session-cache-hash.xml} (90%) diff --git a/jetty-server/src/main/config/etc/sessions/hash-session-cache.xml b/jetty-server/src/main/config/etc/sessions/session-cache-hash.xml similarity index 90% rename from jetty-server/src/main/config/etc/sessions/hash-session-cache.xml rename to jetty-server/src/main/config/etc/sessions/session-cache-hash.xml index 07a62f84e2d..9909e774915 100644 --- a/jetty-server/src/main/config/etc/sessions/hash-session-cache.xml +++ b/jetty-server/src/main/config/etc/sessions/session-cache-hash.xml @@ -12,6 +12,7 @@ + diff --git a/jetty-server/src/main/config/modules/session-cache-hash.mod b/jetty-server/src/main/config/modules/session-cache-hash.mod index 4930104c8ff..9a09ec5dbdb 100644 --- a/jetty-server/src/main/config/modules/session-cache-hash.mod +++ b/jetty-server/src/main/config/modules/session-cache-hash.mod @@ -11,9 +11,10 @@ session-cache sessions [xml] -etc/sessions/hash-session-cache.xml +etc/sessions/session-cache-hash.xml [ini-template] #jetty.session.evictionPolicy=-1 #jetty.session.saveOnInactiveEvict=false +#jetty.session.saveOnCreate=false #jetty.session.removeUnloadableSessions=false diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/DefaultSessionCacheFactory.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/DefaultSessionCacheFactory.java index 373579a5b77..6f933de8fd0 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/DefaultSessionCacheFactory.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/DefaultSessionCacheFactory.java @@ -28,11 +28,36 @@ public class DefaultSessionCacheFactory implements SessionCacheFactory { int _evictionPolicy; boolean _saveOnInactiveEvict; + boolean _saveOnCreate; boolean _removeUnloadableSessions; + /** + * @return the saveOnCreate + */ + public boolean isSaveOnCreate() + { + return _saveOnCreate; + } + + + + /** + * @param saveOnCreate the saveOnCreate to set + */ + public void setSaveOnCreate(boolean saveOnCreate) + { + _saveOnCreate = saveOnCreate; + } + + + + + /** + * @return + */ public boolean isRemoveUnloadableSessions() { return _removeUnloadableSessions; @@ -41,6 +66,9 @@ public class DefaultSessionCacheFactory implements SessionCacheFactory + /** + * @param removeUnloadableSessions + */ public void setRemoveUnloadableSessions(boolean removeUnloadableSessions) { _removeUnloadableSessions = removeUnloadableSessions; @@ -49,6 +77,9 @@ public class DefaultSessionCacheFactory implements SessionCacheFactory + /** + * @return + */ public int getEvictionPolicy() { return _evictionPolicy; @@ -57,6 +88,9 @@ public class DefaultSessionCacheFactory implements SessionCacheFactory + /** + * @param evictionPolicy + */ public void setEvictionPolicy(int evictionPolicy) { _evictionPolicy = evictionPolicy; @@ -65,6 +99,9 @@ public class DefaultSessionCacheFactory implements SessionCacheFactory + /** + * @return + */ public boolean isSaveOnInactiveEvict() { return _saveOnInactiveEvict; @@ -73,6 +110,9 @@ public class DefaultSessionCacheFactory implements SessionCacheFactory + /** + * @param saveOnInactiveEvict + */ public void setSaveOnInactiveEvict(boolean saveOnInactiveEvict) { _saveOnInactiveEvict = saveOnInactiveEvict; @@ -90,6 +130,7 @@ public class DefaultSessionCacheFactory implements SessionCacheFactory DefaultSessionCache cache = new DefaultSessionCache(handler); cache.setEvictionPolicy(getEvictionPolicy()); cache.setSaveOnInactiveEviction(isSaveOnInactiveEvict()); + cache.setSaveOnCreate(isSaveOnCreate()); cache.setRemoveUnloadableSessions(isRemoveUnloadableSessions()); return cache; }