[Lift] Re: catch a URL
Great suggestions - thanks guys! Jeppe Nejsum Madsen wrote: > Timothy Perrett writes: > >> Ah. In that case, does this help: >> >> Menu(Loc("Some", List("some","page"), "Some", >>EarlyResponse(() => { >> // do some response here, >> // return Empty if you dont want >> // a response but a filter style >> // intercept. >> Empty >>}) >> )) >> >> Does that help? > > Or, if you just need to run some code before a template is rendered: > > Menu(Loc("test", List("landing"), "test", Template{() => > println("Hit the template URL"); > // Handle Empty case :-) > > TemplateFinder.findAnyTemplate(List("mytemplat","index")).open_! >})) > > /Jeppe > > > > --~--~-~--~~~---~--~~ 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: catch a URL
Timothy Perrett writes: > Ah. In that case, does this help: > > Menu(Loc("Some", List("some","page"), "Some", >EarlyResponse(() => { > // do some response here, > // return Empty if you dont want > // a response but a filter style > // intercept. > Empty >}) > )) > > Does that help? Or, if you just need to run some code before a template is rendered: Menu(Loc("test", List("landing"), "test", Template{() => println("Hit the template URL"); // Handle Empty case :-) TemplateFinder.findAnyTemplate(List("mytemplat","index")).open_! })) /Jeppe --~--~-~--~~~---~--~~ 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: catch a URL
Ah. In that case, does this help: Menu(Loc("Some", List("some","page"), "Some", EarlyResponse(() => { // do some response here, // return Empty if you dont want // a response but a filter style // intercept. Empty }) )) Does that help? Cheers, Tim On 23 Oct 2009, at 17:07, Chris Lewis wrote: > > Hi Tim, > > I don't specifically want to rewrite anything. What I want is to be > able > to run some initialization code when a specific page is requested. > As I > said, I'm writing a google app engine app that uses google's > authentication service to auth users (using their google account). I'm > instructing the auth service to returned the authenticated user to > their > home page, a page protected and mapped via SiteMap. However, if it's > their first time logging in, I need to bootstrap them in my app. > Rewriting was suggested by Jeppe, and I had thought that way might > work. > It doesn't seem to, b/c Lift doesn't appear to fire the rewriters on > URLs mapped in SiteMap. > > I'm not married to the idea of rewrites to solve this problem, I just > need a non-snippet way to solve it. > > -chris > > Timothy Perrett wrote: >> Chris, >> >> SiteMap deals with what pages you are saying should be visible. Here, >> I term "page" as the physical xhtml file that represents the stuff >> the users sees - its a file on your system. >> >> Rewritten URLs dont need to feature in SiteMap because lift is clever >> enough to know that the page you are rewriting to already has (or has >> not) been allowed access via sitemap. >> >> Sounds like your trying to add rewritten URLs to your sitemap? >> >> Cheers, Tim >> >> PS: Jeppe, thanks for the link recycling!! >> >> On 23 Oct 2009, at 16:43, Chris Lewis wrote: >> >>> Thanks for that link, however it doesn't seem like rewrite rules >>> fire >>> for paths that are mapped in the SiteMap. Can anyone confirm that? I >>> could have the redirect point to a non-existing URL, and do logic + >>> rewrite there. I'm curious though, are rewrites considered if the >>> URL >>> matches a page in the SiteMap? >>> >>> Jeppe Nejsum Madsen wrote: Chris Lewis writes: > Hi list, > > I'm working on an appengine app, and need to store some user > information. I authenticate the user with their google account, > and I > need to create their "local" entity only if it's their first time > logging in. > > When a user logs in via google, they are redirected back to your > app, to > a URL of your choosing. My thought was to catch the request as it > comes > back and, if it's their first time logging in, create a User > entity. My > question then is how can I do this without: > > a) Using a snippet, called from the return landing page and > emitting > NodeSeq.Empty - hack. > > b) Using custom dispatch and then redirecting. That may work, but > it's > an unneeded round trip. > > Any thoughts? Thanks! Not sure if the landing page is static, has parameters etc and what you want to do afterwards. Assume you need to render some template and the landing page is not static (if it is you could just use a normal Loc) I would probably wrap the landing page in a RewriteRequest, and when a match is made, do the user creation/lookup thing and then just render the template. Tim wrote and article about rewriting http://blog.getintheloop.eu/2009/5/3/url-rewriting-with-the-lift-framework Also, I've been using the Locs from CRUDify as an example of how to do more custom-type Locs with rewriting. /Jeppe >> >> >>> >> > > > > --~--~-~--~~~---~--~~ 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: catch a URL
Hi Tim, I don't specifically want to rewrite anything. What I want is to be able to run some initialization code when a specific page is requested. As I said, I'm writing a google app engine app that uses google's authentication service to auth users (using their google account). I'm instructing the auth service to returned the authenticated user to their home page, a page protected and mapped via SiteMap. However, if it's their first time logging in, I need to bootstrap them in my app. Rewriting was suggested by Jeppe, and I had thought that way might work. It doesn't seem to, b/c Lift doesn't appear to fire the rewriters on URLs mapped in SiteMap. I'm not married to the idea of rewrites to solve this problem, I just need a non-snippet way to solve it. -chris Timothy Perrett wrote: > Chris, > > SiteMap deals with what pages you are saying should be visible. Here, > I term "page" as the physical xhtml file that represents the stuff > the users sees - its a file on your system. > > Rewritten URLs dont need to feature in SiteMap because lift is clever > enough to know that the page you are rewriting to already has (or has > not) been allowed access via sitemap. > > Sounds like your trying to add rewritten URLs to your sitemap? > > Cheers, Tim > > PS: Jeppe, thanks for the link recycling!! > > On 23 Oct 2009, at 16:43, Chris Lewis wrote: > >> Thanks for that link, however it doesn't seem like rewrite rules fire >> for paths that are mapped in the SiteMap. Can anyone confirm that? I >> could have the redirect point to a non-existing URL, and do logic + >> rewrite there. I'm curious though, are rewrites considered if the URL >> matches a page in the SiteMap? >> >> Jeppe Nejsum Madsen wrote: >>> Chris Lewis writes: >>> Hi list, I'm working on an appengine app, and need to store some user information. I authenticate the user with their google account, and I need to create their "local" entity only if it's their first time logging in. When a user logs in via google, they are redirected back to your app, to a URL of your choosing. My thought was to catch the request as it comes back and, if it's their first time logging in, create a User entity. My question then is how can I do this without: a) Using a snippet, called from the return landing page and emitting NodeSeq.Empty - hack. b) Using custom dispatch and then redirecting. That may work, but it's an unneeded round trip. Any thoughts? Thanks! >>> Not sure if the landing page is static, has parameters etc and what >>> you >>> want to do afterwards. >>> >>> Assume you need to render some template and the landing page is not >>> static (if it is you could just use a normal Loc) I would probably >>> wrap >>> the landing page in a RewriteRequest, and when a match is made, do >>> the >>> user creation/lookup thing and then just render the template. >>> >>> Tim wrote and article about rewriting >>> http://blog.getintheloop.eu/2009/5/3/url-rewriting-with-the-lift-framework >>> >>> Also, I've been using the Locs from CRUDify as an example of how to >>> do >>> more custom-type Locs with rewriting. >>> >>> /Jeppe >>> > > > > > --~--~-~--~~~---~--~~ 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: catch a URL
Chris, SiteMap deals with what pages you are saying should be visible. Here, I term "page" as the physical xhtml file that represents the stuff the users sees - its a file on your system. Rewritten URLs dont need to feature in SiteMap because lift is clever enough to know that the page you are rewriting to already has (or has not) been allowed access via sitemap. Sounds like your trying to add rewritten URLs to your sitemap? Cheers, Tim PS: Jeppe, thanks for the link recycling!! On 23 Oct 2009, at 16:43, Chris Lewis wrote: > > Thanks for that link, however it doesn't seem like rewrite rules fire > for paths that are mapped in the SiteMap. Can anyone confirm that? I > could have the redirect point to a non-existing URL, and do logic + > rewrite there. I'm curious though, are rewrites considered if the URL > matches a page in the SiteMap? > > Jeppe Nejsum Madsen wrote: >> Chris Lewis writes: >> >>> Hi list, >>> >>> I'm working on an appengine app, and need to store some user >>> information. I authenticate the user with their google account, >>> and I >>> need to create their "local" entity only if it's their first time >>> logging in. >>> >>> When a user logs in via google, they are redirected back to your >>> app, to >>> a URL of your choosing. My thought was to catch the request as it >>> comes >>> back and, if it's their first time logging in, create a User >>> entity. My >>> question then is how can I do this without: >>> >>> a) Using a snippet, called from the return landing page and emitting >>> NodeSeq.Empty - hack. >>> >>> b) Using custom dispatch and then redirecting. That may work, but >>> it's >>> an unneeded round trip. >>> >>> Any thoughts? Thanks! >> >> Not sure if the landing page is static, has parameters etc and what >> you >> want to do afterwards. >> >> Assume you need to render some template and the landing page is not >> static (if it is you could just use a normal Loc) I would probably >> wrap >> the landing page in a RewriteRequest, and when a match is made, do >> the >> user creation/lookup thing and then just render the template. >> >> Tim wrote and article about rewriting >> http://blog.getintheloop.eu/2009/5/3/url-rewriting-with-the-lift-framework >> >> Also, I've been using the Locs from CRUDify as an example of how to >> do >> more custom-type Locs with rewriting. >> >> /Jeppe >> >>> >> > > > > --~--~-~--~~~---~--~~ 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: catch a URL
Thanks for that link, however it doesn't seem like rewrite rules fire for paths that are mapped in the SiteMap. Can anyone confirm that? I could have the redirect point to a non-existing URL, and do logic + rewrite there. I'm curious though, are rewrites considered if the URL matches a page in the SiteMap? Jeppe Nejsum Madsen wrote: > Chris Lewis writes: > >> Hi list, >> >> I'm working on an appengine app, and need to store some user >> information. I authenticate the user with their google account, and I >> need to create their "local" entity only if it's their first time >> logging in. >> >> When a user logs in via google, they are redirected back to your app, to >> a URL of your choosing. My thought was to catch the request as it comes >> back and, if it's their first time logging in, create a User entity. My >> question then is how can I do this without: >> >> a) Using a snippet, called from the return landing page and emitting >> NodeSeq.Empty - hack. >> >> b) Using custom dispatch and then redirecting. That may work, but it's >> an unneeded round trip. >> >> Any thoughts? Thanks! > > Not sure if the landing page is static, has parameters etc and what you > want to do afterwards. > > Assume you need to render some template and the landing page is not > static (if it is you could just use a normal Loc) I would probably wrap > the landing page in a RewriteRequest, and when a match is made, do the > user creation/lookup thing and then just render the template. > > Tim wrote and article about rewriting > http://blog.getintheloop.eu/2009/5/3/url-rewriting-with-the-lift-framework > > Also, I've been using the Locs from CRUDify as an example of how to do > more custom-type Locs with rewriting. > > /Jeppe > > > > --~--~-~--~~~---~--~~ 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: catch a URL
Chris Lewis writes: > Hi list, > > I'm working on an appengine app, and need to store some user > information. I authenticate the user with their google account, and I > need to create their "local" entity only if it's their first time > logging in. > > When a user logs in via google, they are redirected back to your app, to > a URL of your choosing. My thought was to catch the request as it comes > back and, if it's their first time logging in, create a User entity. My > question then is how can I do this without: > > a) Using a snippet, called from the return landing page and emitting > NodeSeq.Empty - hack. > > b) Using custom dispatch and then redirecting. That may work, but it's > an unneeded round trip. > > Any thoughts? Thanks! Not sure if the landing page is static, has parameters etc and what you want to do afterwards. Assume you need to render some template and the landing page is not static (if it is you could just use a normal Loc) I would probably wrap the landing page in a RewriteRequest, and when a match is made, do the user creation/lookup thing and then just render the template. Tim wrote and article about rewriting http://blog.getintheloop.eu/2009/5/3/url-rewriting-with-the-lift-framework Also, I've been using the Locs from CRUDify as an example of how to do more custom-type Locs with rewriting. /Jeppe --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---