Not sure if I read your message closely enough, but if you want to redirect to a pre-initialized StatefulSnippet, one option is to instantiate it and use its snippet function in call to S.mapSnippet, in the redirect function. This will override lift's default behavior and use the snippet function to process the page being redirected to.
------------------------------------- Ross Mellgren<[email protected]> wrote: I have a stateful snippet: class TemplateEditor extends StatefulSnippet { ... val template = (TemplateEditor.template.is openOr S.redirectTo("chooser", () => { S.error("Session information lost, please choose what template to edit again") })) ... } with a companion object holding a RequestVar: object TemplateEditor { /** Request var that is populated with what template is under edit */ object template extends RequestVar[Box[Template]](Empty) ... } The flow is that another page with snippet chooses a template to edit, and then uses: S.redirectTo("/editor", () => { TemplateEditor.template(Full(template)) }) to stuff the template to edit into the RequestVar. I'd like for the state of TemplateEditor to use the value of the RequestVar, but not to require every link to re- stuff that RequestVar once the StatefulSnippet has been instantiated, and not require each snippet method to be wrapped with the logic to check the RequestVar and do the redirect if it's not populated. The problem I'm running into is that snippet instantiation is apparently too early to use S.redirectTo -- the Shortcut exception is being trapped as an instantiation exception and not being used as a redirect. It doesn't look entirely trivial to touch up LiftSession to pass this through, so I guess I'm partly soliciting feedback on whether there's a better pattern to use here (lazy val?) and partly asking if the behavior as it stands is desired. Thanks, -Ross --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
