Skip to content
Snippets Groups Projects
Commit 47994f2f authored by srosse's avatar srosse
Browse files

OO-449: with the whole caching refactoring, make the HTTP session partially...

OO-449: with the whole caching refactoring, make the HTTP session partially serializable without (too much) exceptions
parent 2225292a
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,7 @@
*/
package org.olat.core.id.context;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.text.DateFormat;
......@@ -523,7 +524,9 @@ public class BusinessControlFactory {
}
}
class MyContextEntry implements ContextEntry {
class MyContextEntry implements ContextEntry, Serializable {
private static final long serialVersionUID = 949522581806327579L;
private final OLATResourceable olatResourceable;
//fxdiff BAKS-7 Resume function
......
......@@ -19,6 +19,8 @@
*/
package org.olat.core.id.context;
import java.io.Serializable;
/**
*
* <h3>Description:</h3>
......@@ -27,7 +29,7 @@ package org.olat.core.id.context;
* Initial Date: 18 jan. 2011 <br>
* @author srosse, stephane.rosse@frentix.com, www.frentix.com
*/
public interface StateEntry extends Cloneable {
public interface StateEntry extends Cloneable, Serializable {
public StateEntry clone();
}
......@@ -31,7 +31,8 @@ import java.util.Map;
* @author srosse, stephane.rosse@frentix.com, www.frentix.com
*/
public class StateMapped implements StateEntry{
private static final long serialVersionUID = -164313132644246934L;
private Map<String,String> delegate = new HashMap<String,String>();
public StateMapped() {
......
......@@ -29,8 +29,9 @@ import org.olat.core.gui.control.navigation.SiteInstance;
* Initial Date: 18 jan. 2011 <br>
* @author srosse, stephane.rosse@frentix.com, www.frentix.com
*/
public class StateSite implements StateEntry{
public class StateSite implements StateEntry {
private static final long serialVersionUID = 963711681410259249L;
private transient SiteInstance site;
public StateSite() {
......
......@@ -74,7 +74,7 @@ public class UserSession implements HttpSessionBindingListener, GenericEventList
private static final long serialVersionUID = 1975177605776990868L;
// the environment (identity, locale, ..) of the identity
private transient IdentityEnvironment identityEnvironment;
private IdentityEnvironment identityEnvironment;
private transient SessionInfo sessionInfo;
private transient Map<String,Object> store;
/**
......@@ -82,10 +82,10 @@ public class UserSession implements HttpSessionBindingListener, GenericEventList
*/
private transient Map<String,Object> nonClearedStore = new HashMap<String,Object>();
private boolean authenticated = false;
private transient Preferences guiPreferences;
private transient EventBus singleUserSystemBus;
private transient Preferences guiPreferences;
private transient EventBus singleUserSystemBus;
private List<String> chats;
private transient Stack<HistoryPoint> history = new Stack<HistoryPoint>();
private Stack<HistoryPoint> history = new Stack<HistoryPoint>();
public UserSession() {
init();
......@@ -98,6 +98,15 @@ public class UserSession implements HttpSessionBindingListener, GenericEventList
authenticated = false;
sessionInfo = null;
}
private Object readResolve() {
store = new HashMap<String,Object>(4);
nonClearedStore = new HashMap<String,Object>();
singleUserSystemBus = CoordinatorManager.getInstance().getCoordinator().createSingleUserInstance();
sessionInfo = null;
System.out.println("readResolve 2");
return this;
}
/**
* @return true if is authenticated
......@@ -127,9 +136,15 @@ public class UserSession implements HttpSessionBindingListener, GenericEventList
* @return entry
*/
public Object getEntry(String key) {
if (key == null) return null;
if (store.get(key) != null) return store.get(key);
if (nonClearedStore.get(key) != null) return nonClearedStore.get(key);
if (key == null) {
return null;
}
if (store.get(key) != null) {
return store.get(key);
}
if (nonClearedStore.get(key) != null) {
return nonClearedStore.get(key);
}
else return null;
}
......
......@@ -105,7 +105,8 @@ public class HomePageContextEntryControllerCreator extends DefaultContextEntryCo
return identity != null;
}
private class HomePageStateEntry implements StateEntry {
public static class HomePageStateEntry implements StateEntry {
private static final long serialVersionUID = -8949620136046652588L;
private final Identity identity;
public HomePageStateEntry(Identity identity) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment