On Thu, Mar 4, 2010 at 4:26 PM, andythedestroyer <andythedestro...@gmail.com > wrote:
> Ok Wow. Sometimes you really impress me dpp. That worked. I don't > think I ever would have figured that out but now that I see it I see > what is going on. I have never used HighLevelSessionDispatcher before > though.. I need to go though the code and learn that one. > Nobody but me (and now you) that I know of ever used highLevelSessionDispatch. I added the feature when we were working on some code back in the CircleShare day that had to go out to an external service and then have a return URL which contained state. Being able to define a throw-away URL was the best answer. Please add this to the wiki. > > Good stuff. Thanks again you smart smart man. > <blush/> > > -Andy > > On Mar 4, 3:56 pm, David Pollak <feeder.of.the.be...@gmail.com> wrote: > > On Thu, Mar 4, 2010 at 2:00 PM, andythedestroyer < > andythedestro...@gmail.com > > > > > > > > > wrote: > > > Hello, > > > > > I have a simple use case where there is a 2 page form wizard then a > > > redirect to a third party ( for some external validation ) which > > > redirects back to a third and final page of the wizard. > > > > > I know I could just use snippets and SessionVars to manage this but I > > > have been using StatefullSnippets and would like to try to solve this > > > problem rather than accept failure and use another method. > > > > > I pass the url for the third page to the third party to redirect to > > > when their work is done. The problem is the snippet state is lost > > > after the redirect. I have tried many different things and it seems > > > like something like this should work. > > > > > // in the processing done before redirect to third party. > > > // assemble the return path url. > > > > > class Wizard extends StatefulSnippet with Logger { > > > .... > > > def doRedirect = { > > > val returnPath = urlEncode(S.hostAndPath + ( link("/lastPage", () => > > > redirectTo("/lastPage"), NodeSeq.Empty) \ "@href).text) > > > > > redirectTo( third_party_url +"?return=" + returnPath) > > > } > > > } > > > > Try: > > > > def doRedirect { > > val tmp = Helpers.randomString(20) > > > > S.addHighLevelSessionDispatcher("wizard", { > > case Req(List(tmp), _, _) => () => { > > S.removeHighLevelSessionDispatcher("wizard") > > redirectTo("/lastPage") > > } > > } > > > > val returnPath= urlEncode(S.hostAndPath + tmp) > > > > S.redirectTo(third_party_url+"?return=" + returnPath) > > > > } > > > > The high level session dispatcher was built for this very reason... > further, > > the return URL is random and only associated with the current session so > it > > makes hijacking any information or redirecting other sessions back to the > > URL a non-issue. > > > > Thanks, > > > > David > > > > > > > > > This does generate a return path like "http://localhost:8080/lastPage? > > > F1151306194165AHF=_" , however all state is gone after the third party > > > redirects back to the site, however if I don't redirect to the third > > > party and instead redirect the "val returnPath" I construct directly, > > > state is maintained. > > > > > Is it possible to resume my StatefulSnippet? Or shall I just use > > > something else? > > > > > Thanks to all who read and or respond. > > > > > -Andy > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Lift" group. > > > To post to this group, send email to lift...@googlegroups.com. > > > To unsubscribe from this group, send email to > > > liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com> > <liftweb%2bunsubscr...@googlegroups.com<liftweb%252bunsubscr...@googlegroups.com> > > > > > . > > > 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 lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com> > . > 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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.