On Fri, Jan 29, 2010 at 12:56 PM, ced <[email protected]> wrote:
> David, > thanks for the explanation! > > Let me explain my use case in more depth. Maybe another solution would > be suitable that I don't see. > > I use the comet actor to display a list of files which is sent by an > actor object monitoring a directory in turn. This is done via comet > because changes of the monitored directory can happen frequently and > it's not suitable for the user to reload the page to look for new > files having arrived. Each file should be displayed as a link so you > can click on it to get some detailed information. > > Another approach, which seems not so elegant to me, would be to render > links that take the file's name or some sort of file id as a > parameter, so that the snippet can resolve it to the file again. > This is one approach and likely to be the easiest in the short run... basically, have a SessionVar that maps GUID to file name and just include the GUID as a query param for the new window. We will have to come up with a longer term solution to this issue. The big problem is that Actors are guaranteed to only execute code in one thread. If you have a function that's bound to an Actor's instance variables, having that function execute code on another thread can have catastrophic impact. And there's no way to figure out if the function passed to the SHtml.link() method closed over CometActor instance variables. If it did, the function has to be executed in the context of the CometActor and can't have access to RequestVars. So, my first two ideas will not work: - Have functions passed to link always execute in the Request context rather than the context based on where they were created. - Have functions executed during a full page load (rather than during an Ajax operation) execute in the Request context What we could do is execute the functions synchronously on the CometActor and capture the RequestVar scope from the CometActor and merge that RequestVar context back into the main RequestVar context of the main request servicing thread. Marius -- do you have any thoughts on this issue? > > - Chris > > > > On 29 Jan., 21:40, David Pollak <[email protected]> wrote: > > CometActors do not have a request context and thus do not support request > > vars. The function generated during the execution of a CometActor is run > in > > the context of the CometActor. > > > > This is an interesting and novel use case... Let me think about it for a > > little while. > > > > > > > > > > > > On Fri, Jan 29, 2010 at 12:31 PM, ced <[email protected]> wrote: > > > Hi all, > > > > > I've got the following scenario: A comet actor renders a link like > > > this: > > > SHtml.link(myURL, handleClick, Text(linkText), "target" -> > > > "new_window") > > > > > The handleClick function then stores some information in a RequestVar. > > > Embedded into the page referenced by myURL, is a snippet that accesses > > > the RequestVar. > > > > > My problem now is that the RequestVar, when accessed by the snippet is > > > always empty. What I know is that the "handleClick" really stores > > > something into the RequestVar. > > > > > What am I doing wrong? Any help is appreciated. > > > > > Thanks, > > > Chris > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Lift" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > > > [email protected]<liftweb%[email protected]> > <liftweb%[email protected]<liftweb%[email protected]>> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/liftweb?hl=en. > > > > -- > > Lift, the simply functional web frameworkhttp://liftweb.net > > Beginning Scalahttp://www.apress.com/book/view/1430219890 > > Follow me:http://twitter.com/dpp > > Surf the harmonics > > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<liftweb%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
