svn commit: r1305884 - /ofbiz/trunk/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1305884 - /ofbiz/trunk/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java

eckardjf
Author: eckardjf
Date: Tue Mar 27 16:18:42 2012
New Revision: 1305884

URL: http://svn.apache.org/viewvc?rev=1305884&view=rev
Log:
enable HashSessionManager persistent sessions, by default they will be written to runtime/jetty/sessions (can be configured via a property)

Modified:
    ofbiz/trunk/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java

Modified: ofbiz/trunk/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java?rev=1305884&r1=1305883&r2=1305884&view=diff
==============================================================================
--- ofbiz/trunk/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java (original)
+++ ofbiz/trunk/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java Tue Mar 27 16:18:42 2012
@@ -18,6 +18,7 @@
  *******************************************************************************/
 package org.ofbiz.jetty.container;
 
+import java.io.File;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -28,6 +29,7 @@ import org.ofbiz.base.container.Containe
 import org.ofbiz.base.container.ContainerException;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.SSLUtil;
+import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
 
 import org.eclipse.jetty.ajp.Ajp13SocketConnector;
@@ -66,6 +68,14 @@ public class JettyContainer implements C
         // configure JSSE properties
         SSLUtil.loadJsseProperties();
 
+        // session store directory
+        File sessionStoreDirectory = new File(UtilProperties.getPropertyValue("jetty", "session.store.directory", "runtime/jetty/sessions"));
+        if (!sessionStoreDirectory.exists()) {
+            if (!sessionStoreDirectory.mkdirs()) {
+                throw new ContainerException("error creating session store directory: " + sessionStoreDirectory.getAbsolutePath());
+            }
+        }
+
         // get the jetty container config
         ContainerConfig.Container jettyContainerConfig = ContainerConfig.getContainer("jetty-container", configFile);
 
@@ -104,6 +114,8 @@ public class JettyContainer implements C
 
                     // set the session manager
                     HashSessionManager sm = new HashSessionManager();
+                    sm.setStoreDirectory(sessionStoreDirectory);
+                    sm.setLazyLoad(true);
                     context.setSessionHandler(new SessionHandler(sm));
 
                     // set the virtual hosts