Re: [Webware-discuss] forward() and Session mgmt

Top Page
Author: Christoph Zwerschke
Date:  
To: Discussion of Webware for Python including feedback and proposals.
Subject: Re: [Webware-discuss] forward() and Session mgmt
Christoph Zwerschke schrieb:
> Ben Parker wrote:
>> Calls to forward() will invoke the complete awake/respond/sleep cycle
>> within the outer awake/respond/sleep cycle of the parent transaction.
>> This means that if a servlet forwards a request to another servlet, then
>> the session will be awakened twice and put to sleep twice (or more
>> depending on the number of forward calls). This was causing some issues
>> in our application because we use database sessions, but it would apply
>> to anyone using the SessionFileStore as well.
>
> the transaction actually awake()s the session only if it does not exist,
> so it should not happen twice. Can you check that again? But I think
> you're right about sleep(). Transaction.awake() should really increase a
> counter if it does not awake the session because it already exists, and
> Transaction.sleep() should decrease the counter and send the session to
> sleep if it reaches zero. Would this solve your problem?


I wrote nonsense in my first sentence. Of course the session is only
awakened if it *exists*, i.e. when it was set with setSession() or
implicitly created with session(). So you're right, in a nested
transaction it will be awakened twice.

I have now solved this in with a counter as you suggested:
http://svn.w4py.org/Webware/trunk/WebKit/Transaction.py

Let me know if this solves your problem. It will then go into Ww 1.0.

-- Chris

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Webware-discuss mailing list
Webware-discuss@???
https://lists.sourceforge.net/lists/listinfo/webware-discuss