RE: $ctxid when and why?
"Christian Cryder" <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Andras, Just to followup on Jake's explanation with a little bit of further clarification. The basic idea of the local context repository, as well as statemap context associated with the events it that this space only lasts the duration of the req-resp cycle. There are occasions however, where you fire a ClientSideRedirectException from within a control handler - in this case, the single req-resp cycle really gets broken out into 2 cycles: the first to redirect the browser URL, the second to actually generate the appropriate view. From the developers perspective, you really want this to be viewed as one contiguous cycle, even though its physically smanning two requests...that is really more of an incidental implementation detail required by HTTP. So that's why its implemented as it is. You don't need to worry about objects placed in this state context not getting cleaned up. In the near future, I think I will probably be adding support to optionally allow events to say "make this event contiguous with the one that comes after" (thus keeping the local context around in these occasions). Here's an example of where you might use this - when a user fires a "DeleteRecord" control event, you first make sure they're authroized to do so in the handler, etc, and then you may want to actually delete the record and display the appropriate response. Between the Control and the View events, however, you may first want to prompt the user "are you sure?" (y/n/cancel)...in cases like this it might be nice to persist local context across multiple req-resp cycles. Hope that sheds some light on the issue... Christian ---------------------------------------------- Christian Cryder [[email protected]] Internet Architect, ATMReports.com Barracuda - http://barracudamvc.org ---------------------------------------------- "Coffee? I could quit anytime, just not today" -----Original Message----- From: [email protected] [mailto:[email protected]]On Behalf Of Jacob Kjome Sent: Friday, March 21, 2003 12:07 PM To: [email protected] Subject: Re: [Barracuda] $ctxid when and why? See persistContext() and restoreContext() in DefaultEventContext.java.... //csc_082302.2 - rewritten to persist context using a unique id (per request) //in a Global Weak Repository, rather than persisting context in user session, //which inherantly had problems if multiple frames on a client were firing //different events at the same time. The down side of this fix is that the //redirected url shows in the browser with something like this tacked onto //the url: $ctxid=_1030135624563 Jake At 04:36 PM 3/21/2003 +0200, you wrote: Hi barracudas, I want you to ask about the $ctxid parameter. As i see this is used to persist the event context in more than request-response cyles. I don't understand why this is needed. My understanding of the EventContext is that it should be used to pass objects from Control Event Handlers to View Event Handlers. These objects would be distroyed when the request-response cycle has ended. My assumption is correct? I would be surpised to find out that the Objects put in the EventContext not getting released and garbage collected. I just found out that throwing a ClientSideRedirectException to a static html page would look like this: ourpage.html?$ctxid=_5523212233 How can i disable the persist of the context? Thank you, Andras. _______________________________________________ Barracuda mailing list [email protected] http://barracudamvc.org/lists/listinfo/barracuda