The RequestVar sounds a bit more fun, but I'd rather not take your time -- I'm sure if the SessionVar becomes onerous I can toy with that. I have some concerns about stability of the image URLs, actually, so using a SessionVar with some stable names seems like a better idea.
I'm interested in learning how the state works in detail in lift though, so do you mind explaining why there might be multiple instances? I assumed that (session, snippet class) was one-to-one with snippet instances? -Ross On Jul 14, 2009, at 2:18 PM, David Pollak wrote: > > > On Tue, Jul 14, 2009 at 10:50 AM, Ross Mellgren <[email protected]> > wrote: > darn, I was hoping I could just get away with letting Lift manage > the session by virtue of managing the session snippet. > > There may be multiple stateful snippet instances for a given > stateful snippet within the system. Figuring out which is which is > a non-trivial task for your image serving URL. > > If you really, really don't like the SessionVar idea, you can bind a > function to your /image request and that function can deposit a > reference to the current stateful snippet into a RequestVar that can > be accessed during the image serving process. If you like that > answer better, give me a few days to whip up an example. > > > Thanks for the advice. > > -Ross > > On Jul 13, 2009, at 6:38 PM, David Pollak wrote: > >> >> >> On Mon, Jul 13, 2009 at 3:21 PM, Ross Mellgren <[email protected]> >> wrote: >> >> Hi all, >> >> Is there any way to get a StatefulSnippet instance for a particular >> class in the current session? It looks like there's machinery in S, >> LiftRules, and LiftSession to get these but they're all marked >> private[http]. >> >> I'm still getting used to Lift, so I could very well be approaching >> this the wrong way (using a custom dispatch) -- I have a snippet >> which >> manages an image editing workflow. I'd like to create a dispatch >> which >> serves up the current version of the image(s) to the user, so I need >> to dump back a raw response without any template processing. >> >> I could stuff the current image(s) in a SessionVar or perhaps use an >> injector and RequestVar, perhaps? >> >> Your best bet is to use a SessionVar. Put the image or a pointer >> to how to get the image in a SessionVar. >> >> >> -Ross >> >> >> >> >> >> >> -- >> Lift, the simply functional web framework http://liftweb.net >> Beginning Scala http://www.apress.com/book/view/1430219890 >> Follow me: http://twitter.com/dpp >> Git some: http://github.com/dpp >> >> >> > > > > > > > -- > Lift, the simply functional web framework http://liftweb.net > Beginning Scala http://www.apress.com/book/view/1430219890 > Follow me: http://twitter.com/dpp > Git some: http://github.com/dpp > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
