Thanks a lot, also to all others!

> On 18. 5. 2024, at 4:06, Paul Hoadley via Webobjects-dev 
> <webobjects-dev@lists.apple.com> wrote:
> On 18 May 2024, at 6:26 am, Amedeo Mantica via Webobjects-dev 
> <webobjects-dev@lists.apple.com <mailto:webobjects-dev@lists.apple.com>> 
> wrote:
>> I no longer use WO but I recall this framework in wonder: 
>> ERPersistentSessionStorage
> 
> That framework is a fantastic proof of concept, but in practice the approach 
> can be quite brittle. It works by Java-serializing the object graph rooted at 
> the WOSession, so if any object in that graph isn't serializable, it's game 
> over for that session. By all means try it out, but in our experience (and 
> we've sunk many hours into experimentation with it), it works brilliantly 
> right up until it fails spectacularly.

Hmmm... can you recall please some scenarios, which lead to the spectacular 
failure?

Based on the ER source code and some Ramsey suggestionst (thanks again!) I've 
found a way which so far, tested just for a short time only at my side, seems 
to work reasonably well — here's the gist, without error checking, logging and 
other cosmetics:

===
class OCSSession extends ERXSession {
    WOContext lastContext
    void sleep {
        if (context.page) lastContext=context.clone()
        super.sleep()
    }
}

class OCSDirectAction extends ERXDirectAction {
    WOActionResults restorePreviousStateAction {
        Session ss=session()
        if (ss.lastContext) { // code essentially stolen from ERD2WDirectAction
            String cid=ss.lastContext.request.stringFormValueForKey('__cid')
            if (cid) return ss.restorePageForContextID(cid)
            if (ss.lastContext.page) return ss.lastContext.page
        }
        pageWithName(MainPage.class.name)
    }
}
===

If you can foresee case(s) when it would fail, I'd be grateful for some hints, 
so that I test them here and update my code appropriately.

Thanks again and all the best,
OC

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to