Thanks, Timothy, it works now! Your suggestion incorporated here: http://github.com/opyate/yauser/commit/eb7af882ea8bdcfc3e621e3b0b8e77ad72b8ef58
Yauser v 0.1-SNAPSHOT is now a fully functional URL shortener, but check the roadmap for future features. Thanks guys, Juan 2009/7/20 Timothy Perrett <timo...@getintheloop.eu> > > Change your dispatcher to be: > > LiftRules.dispatch.prepend { > case r @ Req("u" :: id :: Nil, "", GetRequest) => () => { > // lookup in your database here... > Full(RedirectResponse(fullyQualifiedUrl)) > } > } > > > I can then pass the id parameter to your database query then do a > RedirectResponse which is the appropriate LiftResponse. In your > snippet your using S.redirectTo which is not the correct context for > its use. > > Does that help? > > Cheers, Tim > > On Jul 20, 11:03 am, Juan M Uys <opy...@gmail.com> wrote: > > Good day, guys. > > > > First of all, David, thanks for a great tool. I started my first project > > yesterday and it's been fun so far. > > > > I'm creating a URL shortener, and would like to know what the best > practice > > is for creating a light-weight controller that has no view (no associated > > form). > > Basically, clients will request:http://localhost:8080/u/123 > > ...and I will redirect to a URL which was saved under id=123 > > > > Here's my first attempt at mapping to the handler for these kind of URLs: > > line 43/44: > http://github.com/opyate/yauser/blob/2ce8feb7da369f7fc3ef755a192c42ae... > > > > And, the handler: > http://github.com/opyate/yauser/blob/2ce8feb7da369f7fc3ef755a192c42ae... > > > > This code does not work, at the moment. Here are the different use-cases > and > > associated failures: > > > > 1) If I request:http://localhost:8080/u/123 > > ...I get "The Requested URL /u/123 was not found on this server" > > > > 2) If I request:http://localhost:8080/u/ > > ...I get "The Requested URL /u/ was not found on this server" > > > > 3) If I request:http://localhost:8080/u > > ...I get an HTTP 500 with: > > net.liftweb.http.ResponseShortcutException: Shortcut > > ... on the line in the handler which does the actual redirect. > > > > Thanks! > > > > -- > > juan > > Jonathan Swift< > http://www.brainyquote.com/quotes/authors/j/jonathan_swift.html> > > - "May you live every day of your life." > > > -- juan +44 7702 783 956 Stephen Leacock<http://www.brainyquote.com/quotes/authors/s/stephen_leacock.html> - "I detest life-insurance agents: they always argue that I shall some day die, which is not so." --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---