[Lift] Re: fall-through redirect
Joe, See the enclosed code. The menu last menu item (see Boot.scala) is a fall through menu item that will intercept any request. The code is not as concise as Rails, but it's a corner case. Hope this helps. Thanks, David On Fri, Jun 5, 2009 at 10:37 AM, Joe Wass j...@folktunefinder.com wrote: I'm after re-writing, not a re-direct (although I'd compromise to a redirect if re-writing isn't possible). In Rails I seem to recall it wasn't re-writing but binding after all other attempts to bind had failed. For comparison, here's the Rails version: [rails routes.rb] # normal mappings etc map.connect '/search', :controller = 'view', :action = 'search' ... # fallback find member after everything else has failed map.connect /:tag, :controller = view, :action = member [/rails] which would bind the portion after the slash to 'tag' Sorry to drag another framework into it, but I think it's the best way to explain. Joe On Jun 5, 3:13 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Joe, Do you want a redirect (HTTP 304) or do you want the URL rewritten so that Lift sees site.com/user/member, but the browser still thinks in sent site.com/member ? Thanks, David On Fri, Jun 5, 2009 at 1:47 AM, Joe Wass j...@folktunefinder.com wrote: Hello everyone, I want to be able to handle requests that don't fall within the sitemap. I have a site with members, and, providing that a user id doesn't conflict with any part of a sitemap path, I want site.com/ member to redirect to site.com/user/member. I've done this kind with Rails, but the Lift model doesn't quite seem to match Rails so I'm a little unsure about how to go about doing it... suggestions? TIA! Joe -- 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 -- 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 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 -~--~~~~--~~--~--~--- menu.tgz Description: GNU Zip compressed data
[Lift] Re: fall-through redirect
If you look back through the archives I was asking a similiar thing (matching the root) ages ago and we actually ended up adding a isRecursive flag to the rewriting mech - this allows you to tell lift to stop rewriting at the first match and subsequently not get stuck in an impossible loop. Cheers, Tim On Jun 6, 8:25 pm, Joe Wass j...@folktunefinder.com wrote: Tim -- Thanks, yes that was very useful; it's certainly helped me understand working with parameters in urls. For the moment I'm working round the requirement to match at the root of the url but eventually it would be nice to be able to do it. David, any guidance on this would be much appreciated! Cheers Joe On Jun 6, 12:28 am, Timothy Perrett timo...@getintheloop.eu wrote: Joe, You might enjoy my article on URL rewriting:http://is.gd/wq4K Does that help? Cheers, Tim On Jun 5, 6:37 pm, Joe Wass j...@folktunefinder.com wrote: I'm after re-writing, not a re-direct (although I'd compromise to a redirect if re-writing isn't possible). In Rails I seem to recall it wasn't re-writing but binding after all other attempts to bind had failed. For comparison, here's the Rails version: [rails routes.rb] # normal mappings etc map.connect '/search', :controller = 'view', :action = 'search' ... # fallback find member after everything else has failed map.connect /:tag, :controller = view, :action = member [/rails] which would bind the portion after the slash to 'tag' Sorry to drag another framework into it, but I think it's the best way to explain. Joe On Jun 5, 3:13 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Joe, Do you want a redirect (HTTP 304) or do you want the URL rewritten so that Lift sees site.com/user/member, but the browser still thinks in sent site.com/member ? Thanks, David On Fri, Jun 5, 2009 at 1:47 AM, Joe Wass j...@folktunefinder.com wrote: Hello everyone, I want to be able to handle requests that don't fall within the sitemap. I have a site with members, and, providing that a user id doesn't conflict with any part of a sitemap path, I want site.com/ member to redirect to site.com/user/member. I've done this kind with Rails, but the Lift model doesn't quite seem to match Rails so I'm a little unsure about how to go about doing it... suggestions? TIA! Joe -- 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 -~--~~~~--~~--~--~---
[Lift] Re: fall-through redirect
Tim, This isn't a rewriting problem, it's a sitemap problem. Maybe I'll have time today to work on it today. Thanks, David On Jun 7, 2009 5:05 AM, Timothy Perrett timo...@getintheloop.eu wrote: If you look back through the archives I was asking a similiar thing (matching the root) ages ago and we actually ended up adding a isRecursive flag to the rewriting mech - this allows you to tell lift to stop rewriting at the first match and subsequently not get stuck in an impossible loop. Cheers, Tim On Jun 6, 8:25 pm, Joe Wass j...@folktunefinder.com wrote: Tim -- Thanks, yes that was very... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: fall-through redirect
Tim -- Thanks, yes that was very useful; it's certainly helped me understand working with parameters in urls. For the moment I'm working round the requirement to match at the root of the url but eventually it would be nice to be able to do it. David, any guidance on this would be much appreciated! Cheers Joe On Jun 6, 12:28 am, Timothy Perrett timo...@getintheloop.eu wrote: Joe, You might enjoy my article on URL rewriting:http://is.gd/wq4K Does that help? Cheers, Tim On Jun 5, 6:37 pm, Joe Wass j...@folktunefinder.com wrote: I'm after re-writing, not a re-direct (although I'd compromise to a redirect if re-writing isn't possible). In Rails I seem to recall it wasn't re-writing but binding after all other attempts to bind had failed. For comparison, here's the Rails version: [rails routes.rb] # normal mappings etc map.connect '/search', :controller = 'view', :action = 'search' ... # fallback find member after everything else has failed map.connect /:tag, :controller = view, :action = member [/rails] which would bind the portion after the slash to 'tag' Sorry to drag another framework into it, but I think it's the best way to explain. Joe On Jun 5, 3:13 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Joe, Do you want a redirect (HTTP 304) or do you want the URL rewritten so that Lift sees site.com/user/member, but the browser still thinks in sent site.com/member ? Thanks, David On Fri, Jun 5, 2009 at 1:47 AM, Joe Wass j...@folktunefinder.com wrote: Hello everyone, I want to be able to handle requests that don't fall within the sitemap. I have a site with members, and, providing that a user id doesn't conflict with any part of a sitemap path, I want site.com/ member to redirect to site.com/user/member. I've done this kind with Rails, but the Lift model doesn't quite seem to match Rails so I'm a little unsure about how to go about doing it... suggestions? TIA! Joe -- 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 -~--~~~~--~~--~--~---
[Lift] Re: fall-through redirect
Joe, Do you want a redirect (HTTP 304) or do you want the URL rewritten so that Lift sees site.com/user/member, but the browser still thinks in sent site.com/member ? Thanks, David On Fri, Jun 5, 2009 at 1:47 AM, Joe Wass j...@folktunefinder.com wrote: Hello everyone, I want to be able to handle requests that don't fall within the sitemap. I have a site with members, and, providing that a user id doesn't conflict with any part of a sitemap path, I want site.com/ member to redirect to site.com/user/member. I've done this kind with Rails, but the Lift model doesn't quite seem to match Rails so I'm a little unsure about how to go about doing it... suggestions? TIA! Joe -- 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 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 -~--~~~~--~~--~--~---
[Lift] Re: fall-through redirect
I'm after re-writing, not a re-direct (although I'd compromise to a redirect if re-writing isn't possible). In Rails I seem to recall it wasn't re-writing but binding after all other attempts to bind had failed. For comparison, here's the Rails version: [rails routes.rb] # normal mappings etc map.connect '/search', :controller = 'view', :action = 'search' ... # fallback find member after everything else has failed map.connect /:tag, :controller = view, :action = member [/rails] which would bind the portion after the slash to 'tag' Sorry to drag another framework into it, but I think it's the best way to explain. Joe On Jun 5, 3:13 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Joe, Do you want a redirect (HTTP 304) or do you want the URL rewritten so that Lift sees site.com/user/member, but the browser still thinks in sent site.com/member ? Thanks, David On Fri, Jun 5, 2009 at 1:47 AM, Joe Wass j...@folktunefinder.com wrote: Hello everyone, I want to be able to handle requests that don't fall within the sitemap. I have a site with members, and, providing that a user id doesn't conflict with any part of a sitemap path, I want site.com/ member to redirect to site.com/user/member. I've done this kind with Rails, but the Lift model doesn't quite seem to match Rails so I'm a little unsure about how to go about doing it... suggestions? TIA! Joe -- 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 -~--~~~~--~~--~--~---
[Lift] Re: fall-through redirect
Joe, You might enjoy my article on URL rewriting: http://is.gd/wq4K Does that help? Cheers, Tim On Jun 5, 6:37 pm, Joe Wass j...@folktunefinder.com wrote: I'm after re-writing, not a re-direct (although I'd compromise to a redirect if re-writing isn't possible). In Rails I seem to recall it wasn't re-writing but binding after all other attempts to bind had failed. For comparison, here's the Rails version: [rails routes.rb] # normal mappings etc map.connect '/search', :controller = 'view', :action = 'search' ... # fallback find member after everything else has failed map.connect /:tag, :controller = view, :action = member [/rails] which would bind the portion after the slash to 'tag' Sorry to drag another framework into it, but I think it's the best way to explain. Joe On Jun 5, 3:13 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Joe, Do you want a redirect (HTTP 304) or do you want the URL rewritten so that Lift sees site.com/user/member, but the browser still thinks in sent site.com/member ? Thanks, David On Fri, Jun 5, 2009 at 1:47 AM, Joe Wass j...@folktunefinder.com wrote: Hello everyone, I want to be able to handle requests that don't fall within the sitemap. I have a site with members, and, providing that a user id doesn't conflict with any part of a sitemap path, I want site.com/ member to redirect to site.com/user/member. I've done this kind with Rails, but the Lift model doesn't quite seem to match Rails so I'm a little unsure about how to go about doing it... suggestions? TIA! Joe -- 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 -~--~~~~--~~--~--~---
[Lift] Re: fall-through redirect
Joe, On Fri, Jun 5, 2009 at 10:37 AM, Joe Wass j...@folktunefinder.com wrote: I'm after re-writing, not a re-direct (although I'd compromise to a redirect if re-writing isn't possible). In Rails I seem to recall it wasn't re-writing but binding after all other attempts to bind had failed. For comparison, here's the Rails version: [rails routes.rb] # normal mappings etc map.connect '/search', :controller = 'view', :action = 'search' ... # fallback find member after everything else has failed map.connect /:tag, :controller = view, :action = member [/rails] which would bind the portion after the slash to 'tag' Okay... there may be a way to do this in Lift, but it's non-obvious. I'll noodle around with some code tomorrow during down time at the Scala Lift Off (http://scalaliftoff.com) and see if I can make it more obvious. Sorry to drag another framework into it, but I think it's the best way to explain. I really like to see how other people have used other frameworks to get good results. I have a high regard for Rails and think that it is a ground-breaking and excellent tool. Thanks, David Joe On Jun 5, 3:13 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Joe, Do you want a redirect (HTTP 304) or do you want the URL rewritten so that Lift sees site.com/user/member, but the browser still thinks in sent site.com/member ? Thanks, David On Fri, Jun 5, 2009 at 1:47 AM, Joe Wass j...@folktunefinder.com wrote: Hello everyone, I want to be able to handle requests that don't fall within the sitemap. I have a site with members, and, providing that a user id doesn't conflict with any part of a sitemap path, I want site.com/ member to redirect to site.com/user/member. I've done this kind with Rails, but the Lift model doesn't quite seem to match Rails so I'm a little unsure about how to go about doing it... suggestions? TIA! Joe -- 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 -- 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 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 -~--~~~~--~~--~--~---