Thanks again. Here's what I came up with. // redirect handler that sets the locale cookie. redirect to same page // based on referer, as long as the host names are the same. LiftRules.dispatch.append { case r @ Req("change_locale" :: Nil, _, GetRequest) if S.param ("lang").isDefined => { var cookie = new Cookie("lang", S.param("lang").open_!) cookie.setMaxAge(31556926) // 1 year val redirect = S.referer match { case Full(referer) => if ((new URL(referer)).getHost() == S.hostName) referer else "/" case _ => "/" } () => Full(TemporaryRedirectResponse(redirect, r, cookie)) } }
On Apr 30, 1:38 pm, bradford <fingerm...@gmail.com> wrote: > Thank you, David. > > On Apr 30, 12:05 pm, David Pollak <feeder.of.the.be...@gmail.com> > wrote: > > > Personally, I'd use a custom dispatch. You're not rendering any HTML, so > > there's no reason to use the rendering machinery. > > LiftRules.dispatch.append { > > case r @ Req("change_language" :: Nil, _, GetRequest) if > > S.param("lang").isDefined && S.param("redirect").isDefined => > > TemporaryRedirectResponse(S.param("redirect").open_!, r, new Cookie(define > > cookie here)) > > > } > > On Thu, Apr 30, 2009 at 8:21 AM, bradford <fingerm...@gmail.com> wrote: > > > > I have a link that needs to accept 2 request parameters, set a cookie > > > according to param1, and then redirect to "/" + param2. Is this what > > > a view is for? > > > > for example, /change_language?lang=en_US&redirect=products. > > > > This would set the lang cookie to en_US (expiring in 3 years) and then > > > redirect me /products. > > > -- > > Lift, the simply functional web frameworkhttp://liftweb.net > > Beginning Scalahttp://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 liftweb@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 -~----------~----~----~----~------~----~------~--~---