cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <jer...@media.demon.co.uk>
Subject Re: Woody: managing persistence sessions
Date Wed, 05 Nov 2003 17:02:38 GMT

On Wednesday, November 5, 2003, at 02:45 PM, Antonio Gallardo wrote:

> Hi Jeremy:
>
> Can you explain a little bit? I still does not understand your point.
> Sorry I know it is my fault.

OK, I will try again .... :)

Lets say you have a script that uses continuations (sendPageAndWait is 
called).

Lets also say that you have to do specific things (eg. persistence 
management) just before starting a continuation-cycle (where you want 
to keep sending the form until it has validated), and just after  the 
continuation-cycle is finished.

With no 'continuation-events' you have to place the code before and 
after each function call to sendPageAndWait (or the function that calls 
it like form.sendPage).

If you have several places in your script where sendPageAndWait is 
called, or your scripts call other scripts that do sendPageAndWait, you 
have lots of code duplicated all over the place.

If you use the 'continuation-events' however, you do not need to 
duplicate anything, you stuff just gets called as needed.

The only problem here, is that there is no event that specifies, "the 
continuation-cycle has finished".

There are events that tell you other things like "continue": a 
continuation has resumed , "break": a continuation has started, 
"return": sendPageAndWait has finished rendering the page.


Any clearer?

regards Jeremy

> Jeremy Quinn dijo:
>>
>> On Wednesday, November 5, 2003, at 01:06 PM, Reinhard Poetz wrote:
>>
>>>> I am really impressed with the Cocoon Forms framework!!
>>>> And the continuation-lifecycle 'catch' events work well too!!
>>>> There is one more event that some people could conceivably want ....
>>>> but I do not know if it is possible .... "The Continuation has
>>>> completed".
>>>>
>>>> Many thanks guys!
>>>
>>> Sorry, but I haven't got what you mean with "The Continuation has
>>> completed".
>>> When is this event reached? Can you give a example (maybe using some
>>> code)?
>>
>> This is what I am thinking about:
>>
>> If you take this code snippet here:
>>
>>    . . .
>>     // get the User
>>     form.load (user);
>>     session.close();
>>     form.showForm (formURI);
>>     session = factory.createSession ();
>>     form.save (user);
>>     // save the User
>>    . . .
>>
>> The line "session.close();" in the sample above, could be replaced by
>> this (obviously after the snippet):
>>
>> 	catch (break) {
>> 		session.close();
>> 	}
>>
>> because it will be called just as a continuation is about to start
>>
>> whereas the line "session = factory.createSession ();" does not have 
>> an
>> equivalent handler that would trigger after all continuation handling
>> has completed.
>>
>> do you see what I mean?
>>
>> regards Jerm
>
>
>


Mime
View raw message