This commit is contained in:
Jan Bartel 2016-09-22 18:05:49 +10:00
parent 969f1daeb5
commit 3359bc8548
3 changed files with 44 additions and 1 deletions

View File

@ -12,6 +12,7 @@
<New class="org.eclipse.jetty.server.session.DefaultSessionCacheFactory">
<Set name="evictionPolicy"><Property name="jetty.session.evictionPolicy" default="-1" /></Set>
<Set name="saveOnInactiveEvict"><Property name="jetty.session.saveOnInactiveEvict" default="false" /></Set>
<Set name="saveOnCreate"><Property name="jetty.session.saveOnCreate" default="false" /></Set>
<Set name="removeUnloadableSessions"><Property name="jetty.session.removeUnloadableSessions" default="false"/></Set>
</New>
</Arg>

View File

@ -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

View File

@ -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;
}