Fixed issue (persistent sessions did not work anymore).

Persistent sessions did not work anymore, because the Application
(which became part of the information to be serialized at some point in
time) was not serializable.
This commit is contained in:
Daniel Ruthardt 2017-09-25 10:35:11 +02:00 committed by Tobi Schäfer
parent e0f590da98
commit 541286dc59
2 changed files with 23 additions and 0 deletions

View file

@ -568,6 +568,8 @@ public class RhinoEngine implements ScriptingEngine {
return new GlobalProxy((GlobalObject) obj);
if (obj instanceof ApplicationBean)
return new ScriptBeanProxy("app");
if (obj instanceof Application)
return new ApplicationProxy();
if (obj instanceof RequestBean)
return new ScriptBeanProxy("req");
if (obj instanceof ResponseBean)

View file

@ -49,9 +49,30 @@ class ScriptBeanProxy implements SerializationProxy {
* @return the object represented by this proxy
*/
public Object getObject(RhinoEngine engine) {
try {
Object object = engine.global.get(name, engine.global);
} catch (Exception e) {
System.out.println(name);
}
return engine.global.get(name, engine.global);
}
}
/**
* Serialization proxy for the application object.
*
* @author Daniel Ruthardt
* @since 20170918
*/
class ApplicationProxy implements SerializationProxy {
private static final long serialVersionUID = -3635418002212260600L;
@Override
public Object getObject(RhinoEngine engine) {
// return the application
return engine.app;
}
}
/**