[Lift] Re: Dynamic Image generation / HttpServletResponse
Here's some code to serve an image out of the database. Here's the Mapper definition: class Image extends LongKeyedMapper[Image] with IdPK { def getSingleton = Image object image extends MappedBinary(this) object lookup extends MappedUniqueId(this, 32) { override def dbIndexed_? = true } object saveTime extends MappedLong(this) { override def defaultValue = millis } object mimeType extends MappedString(this, 256) } object Image extends Image with LongKeyedMetaMapper[Image] And here's the code that serves the image: object ImageLogic { object TestImage { def unapply(in: String): Option[Image] = Image.find(By(Image.lookup, in.trim)) } def matcher: LiftRules.DispatchPF = { case r @ Req("image_logic" :: TestImage(img) :: Nil, _, GetRequest) => () => servImage(img, r) } def servImage(img: Image, r: Req): Box[LiftResponse] = { if (r.testIfModifiedSince(img.saveTime)) Full(InMemoryResponse(new Array[Byte](0), List("Last-Modified" -> toInternetDate(img.saveTime.is)), Nil, 304)) else Full(InMemoryResponse(img.image.is, List("Last-Modified" -> toInternetDate(img.saveTime.is), "Content-Type" -> img.mimeType.is, "Content-Length" -> img.image.is.length.toString), Nil, 200)) } } In Boot: LiftRules.dispatch.append(ImageLogic.matcher) Does this help? Thanks, David On Wed, Mar 25, 2009 at 2:38 PM, Thomas Rynne wrote: > > Hi, > I want to dynamically generate images (actually a graph). I could > write a seperate servlet for this but I'd like easy access to the > Mapper classes and the logged in User etc so would prefer to write it > as a method in lift. > > Is there a hook for this? I suppose I essentially want direct acccess > to the httpresponse. > > I found some discussion of this here: > > http://groups.google.com/group/liftweb/browse_thread/thread/9d6f61f69a20765/d98a32e89e87d317 > > but I don't know if it was ever implemented, and need some pointers/ > documentation if it has been. > > thanks for any advice, > Thomas > > > > -- 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: Dynamic Image generation / HttpServletResponse
If you'd like graphing, depending on your use case perhaps check out the flot graph widget in lift-widgets Sent from my iPhone On 25 Mar 2009, at 21:38, Thomas Rynne wrote: > > Hi, > I want to dynamically generate images (actually a graph). I could > write a seperate servlet for this but I'd like easy access to the > Mapper classes and the logged in User etc so would prefer to write it > as a method in lift. > > Is there a hook for this? I suppose I essentially want direct acccess > to the httpresponse. > > I found some discussion of this here: > http://groups.google.com/group/liftweb/browse_thread/thread/9d6f61f69a20765/d98a32e89e87d317 > > but I don't know if it was ever implemented, and need some pointers/ > documentation if it has been. > > thanks for any advice, > Thomas > > > > --~--~-~--~~~---~--~~ 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: Dynamic Image generation / HttpServletResponse
Check out our JFreeChart graphing class in PocketChange: http://github.com/tjweir/pocketchangeapp/blob/903ae91ab2787aebd9a94a5439a7e39a9386bcdb/PocketChange/src/main/scala/com/pocketchangeapp/util/Charting.scala And how it hooks into the request cycle in Boot: http://github.com/tjweir/pocketchangeapp/blob/04adab6ab126f617d25e5f8222545a9a06e51e06/PocketChange/src/main/scala/bootstrap/liftweb/Boot.scala There's also an Image class under the util directory that serves up a MappedBinary image directly based on an Expense ID: http://github.com/tjweir/pocketchangeapp/blob/903ae91ab2787aebd9a94a5439a7e39a9386bcdb/PocketChange/src/main/scala/com/pocketchangeapp/util/Image.scala Derek On Wed, Mar 25, 2009 at 4:38 PM, Thomas Rynne wrote: > > Hi, > I want to dynamically generate images (actually a graph). I could > write a seperate servlet for this but I'd like easy access to the > Mapper classes and the logged in User etc so would prefer to write it > as a method in lift. > > Is there a hook for this? I suppose I essentially want direct acccess > to the httpresponse. > > I found some discussion of this here: > > http://groups.google.com/group/liftweb/browse_thread/thread/9d6f61f69a20765/d98a32e89e87d317 > > but I don't know if it was ever implemented, and need some pointers/ > documentation if it has been. > > thanks for any advice, > Thomas > > > > --~--~-~--~~~---~--~~ 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: lift:Menu.group
That seems reasonable to me. That's actually what the Menu.builder does, essentially. I don't think we want to modify the default behavior, but I could make it a "donthide" attribute instead of "always" to do what you're saying. Bradford, would that work for you? Derek On Wed, Mar 25, 2009 at 3:54 PM, Charles F. Munat wrote: > > Actually, my feeling on item is that if you're on that page, item should > return placeholder text (i.e. the same text without the link). For me, > at least, that's the most common scenario. > > Chas. > > bradford wrote: > > David, you're right that needing to surround the element text of a > > with span is a unique case and should be a custom snippet. I've > > removed the span now and think that Derek's addition of "always" would > > be just what I need. Adding group="foo" to Menu.builder would suffice > > as well. > > > > Thanks for the tips, Chas. > > > > Derek, if you do add "always" can you please let me know so that I can > > update my code. > > > > Thanks, > > Bradford > > > > On Mar 24, 10:37 pm, Derek Chen-Becker wrote: > >> The general case is that a page won't link to itself, I think, which is > why > >> the default isn't to show it when the page matches. Unless anyone has > >> objections I can add an "always" attribute. As for #1, the Menu.item > makes a > >> link using whatever the contents of the Menu.item tag are for the link > text: > >> > >> Go here > >> > >> should become > >> > >> Go here > >> > >> Am I misunderstanding what you're looking for there? As for #2, you > should > >> be able to add a class using the prefixed attribute: > >> > >> > >> > >> In this context, li_item is the menu item that matches the current page. > >> With Menu.group, you can specify the binding template: > >> > >> > >> > >> > >> > >> > >> > >> But there's no provision to do anything special for the current page. > >> > >> Let me know if that's not sufficient or if I'm misunderstanding your > >> requirement. > >> > >> Derek > >> > >> On Tue, Mar 24, 2009 at 3:50 PM, bradford wrote: > >> > >>> Thanks for the clarification, David, and for your snippet, Derek. > >>> I think adding an "always" attribute to Menu.item would be very > >>> beneficial. I still don't understand why that's not its default > >>> behavior. > >>> It looks like I will not be able to use any of lift's Menu tags at > >>> this time, because 1) I need to surround the item text with span and > >>> 2) I need a way to add class="active" to the li_item. Both are not > >>> possible with Menu.item, Menu.group, or Menu.builder. Let me know if > >>> I am mistaken. If I am not not, may I put in a feature request for > >>> these items. For the time being I will just hard code it as follows > >>> (which is not a big deal to me at this time): > >>> > >>> Foo1 > >>> Foo2 > >>> Foo3 > >>> > >>> Thanks again for the great support :) > >>> Bradford > >>> On Mar 24, 12:08 pm, David Pollak > >>> wrote: > On Tue, Mar 24, 2009 at 9:02 AM, Charles F. Munat > >>> wrote: > > David Pollak wrote: > >> What's the best practice: > >> For more information about . For > >>> more > >> information about . > >> Or > >> For more information about foo1. For more > >> information about foo2. > >> The latter. This allows you to move the pages around on the > >>> filesystem > >> without having to grep through all you source files looking for what > >> needs to be changed. > > Am I missing something, or did you mean the former? > D'oh! That brain-finger connection is always getting messed up. I > meant > the former. Thanks for correcting me! > > Chas. > -- > 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: Dynamic Image generation / HttpServletResponse
Oddly enough, I'm working on code like this right now... I'll post what I can. On Wed, Mar 25, 2009 at 2:38 PM, Thomas Rynne wrote: > > Hi, > I want to dynamically generate images (actually a graph). I could > write a seperate servlet for this but I'd like easy access to the > Mapper classes and the logged in User etc so would prefer to write it > as a method in lift. > > Is there a hook for this? I suppose I essentially want direct acccess > to the httpresponse. > > I found some discussion of this here: > > http://groups.google.com/group/liftweb/browse_thread/thread/9d6f61f69a20765/d98a32e89e87d317 > > but I don't know if it was ever implemented, and need some pointers/ > documentation if it has been. > > thanks for any advice, > Thomas > > > > -- 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] Dynamic Image generation / HttpServletResponse
Hi, I want to dynamically generate images (actually a graph). I could write a seperate servlet for this but I'd like easy access to the Mapper classes and the logged in User etc so would prefer to write it as a method in lift. Is there a hook for this? I suppose I essentially want direct acccess to the httpresponse. I found some discussion of this here: http://groups.google.com/group/liftweb/browse_thread/thread/9d6f61f69a20765/d98a32e89e87d317 but I don't know if it was ever implemented, and need some pointers/ documentation if it has been. thanks for any advice, Thomas --~--~-~--~~~---~--~~ 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: Absolute Beginner
On Wed, Mar 25, 2009 at 1:09 PM, Randinn wrote: > > Thinking on it further it seems I need to ask this of the Scala crowd. > My knowledge of programming is antiquated but I do not want to learn > Java just to un-learn parts of it Scala changes. You can try Beginning Scala. I assume some knowledge of an OO language, but most of the code is Scala from the ground up. > > > On Mar 26, 12:01 am, David Pollak > wrote: > > On Tue, Mar 24, 2009 at 9:35 PM, Randinn wrote: > > > > > Are there any plans for some tutorials/info for people that have no > > > programming experience (at least none in the last decade)? > > > > Sorry. Lift requires basic knowledge of Scala as well as some ability to > do > > stuff at the command line. > > > > > > > > -- > > 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 -~--~~~~--~~--~--~---
[Lift] Re: Absolute Beginner
Programming in Scala is not for absolute-never-programmed-before beginners, but you don't need to know any Java to use it. You'll probably have to learn a little bit of Java as you go along with Scala anyway, but not much in my experience. Chas. Randinn wrote: > Thinking on it further it seems I need to ask this of the Scala crowd. > My knowledge of programming is antiquated but I do not want to learn > Java just to un-learn parts of it Scala changes. > > On Mar 26, 12:01 am, David Pollak > wrote: >> On Tue, Mar 24, 2009 at 9:35 PM, Randinn wrote: >> >>> Are there any plans for some tutorials/info for people that have no >>> programming experience (at least none in the last decade)? >> Sorry. Lift requires basic knowledge of Scala as well as some ability to do >> stuff at the command line. >> >> >> >> -- >> 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: lift:Menu.group
Actually, my feeling on item is that if you're on that page, item should return placeholder text (i.e. the same text without the link). For me, at least, that's the most common scenario. Chas. bradford wrote: > David, you're right that needing to surround the element text of a > with span is a unique case and should be a custom snippet. I've > removed the span now and think that Derek's addition of "always" would > be just what I need. Adding group="foo" to Menu.builder would suffice > as well. > > Thanks for the tips, Chas. > > Derek, if you do add "always" can you please let me know so that I can > update my code. > > Thanks, > Bradford > > On Mar 24, 10:37 pm, Derek Chen-Becker wrote: >> The general case is that a page won't link to itself, I think, which is why >> the default isn't to show it when the page matches. Unless anyone has >> objections I can add an "always" attribute. As for #1, the Menu.item makes a >> link using whatever the contents of the Menu.item tag are for the link text: >> >> Go here >> >> should become >> >> Go here >> >> Am I misunderstanding what you're looking for there? As for #2, you should >> be able to add a class using the prefixed attribute: >> >> >> >> In this context, li_item is the menu item that matches the current page. >> With Menu.group, you can specify the binding template: >> >> >> >> >> >> >> >> But there's no provision to do anything special for the current page. >> >> Let me know if that's not sufficient or if I'm misunderstanding your >> requirement. >> >> Derek >> >> On Tue, Mar 24, 2009 at 3:50 PM, bradford wrote: >> >>> Thanks for the clarification, David, and for your snippet, Derek. >>> I think adding an "always" attribute to Menu.item would be very >>> beneficial. I still don't understand why that's not its default >>> behavior. >>> It looks like I will not be able to use any of lift's Menu tags at >>> this time, because 1) I need to surround the item text with span and >>> 2) I need a way to add class="active" to the li_item. Both are not >>> possible with Menu.item, Menu.group, or Menu.builder. Let me know if >>> I am mistaken. If I am not not, may I put in a feature request for >>> these items. For the time being I will just hard code it as follows >>> (which is not a big deal to me at this time): >>> >>> Foo1 >>> Foo2 >>> Foo3 >>> >>> Thanks again for the great support :) >>> Bradford >>> On Mar 24, 12:08 pm, David Pollak >>> wrote: On Tue, Mar 24, 2009 at 9:02 AM, Charles F. Munat >>> wrote: > David Pollak wrote: >> What's the best practice: >> For more information about . For >>> more >> information about . >> Or >> For more information about foo1. For more >> information about foo2. >> The latter. This allows you to move the pages around on the >>> filesystem >> without having to grep through all you source files looking for what >> needs to be changed. > Am I missing something, or did you mean the former? D'oh! That brain-finger connection is always getting messed up. I meant the former. Thanks for correcting me! > Chas. -- 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: AJAX and IE6. No love.
Daniel, Thanks so much! This is excellent. I don't know if it's the problem, but it won't hurt to reset the keepalives and find out. Now to figure out how to do that... Chas. Daniel Mueller wrote: > I'm not sure that this is of any help or even applies to lift, but we > had once a very similar situation with a corporate application. > Difference was that the problem occurred when you were working slower. > Here's the description of the problem and what the reason was. When we > ran our application in on dev servers, everything was working fine, > never any problems, never the server unavailable message. Even on the > test servers for the client there was never any problem and everything > was working fine, even though this time the app was using HTTPS. When > we put the application into production (HTTPS as well), we received > complaints similar to yours. Ok, differences between dev/test and > prod? Almost none, server setup the same (tomcat/apache at the time), > same OS, same build. Differences were only in network routing and that > the production was using a loadbalancer. Now that load balancer was a > pretty expensive piece of hardware, we used sticky sessions and the > app was built that it should even be able to handle session failover > gracefully (only cashing stuff in the session). And strangely we still > couldn't reproduce the bug even though the allowed us to test in the > production environment... > Now the fun started. It took some time to actually reproduce the bug, > because it happened only if you waited long enough on a page that is > using AJAX. It took a couple of minutes of waiting (doing nothing that > triggers AJAX) on a page before you could get the server unavailable > message when starting to use AJAX again which had to timeout as well > first. The wait time is not completely unreasonable (if you got a > complex form to fill, that's a reasonable time, depending on how your > site is structured) and after that, the AJAX part of the page was dead > (only reload could get you going again). > After being able to reproduce the bug, we set to find the source of > the problem. It turned out that the following things happened: Apache > has a configured connection pool and a configured connection keepalive > (sent in HTTP response header). It doesn't honor the keepalive though, > as long as you have enough spare connections in the pool (it'll simply > keep the timed out connections active). The loadbalancer on the other > hand is not that friendly and shuts the connections down after the > configured keepalive times out. That's the reason why it never showed > in dev and test and only with the loadbalancer (which is advertised as > being transparent) in place. > Ok, interesting story so far, but why does IE6 barf on it, connection > closing shouldn't be the end of the world, it happens often enough. > The problem is that IE6 automatic removal of SSLd keepalive > connections is seriously broken. It actually tries to reuse timed out > connections from the internal connection pool (IIRC, also see [1], or > google), which will not get you anywhere on the server, because the > connection has been shut down. > Resolution for us was to set the keepalive to a high value (half an > hour or so, the default is 300/5 minutes). This was also partially > because we were not allowed to touch the configuration of the > loadbalancer. [1] describes a different solution. > To find the problem we used SysInternals TCPView (free) to find out > what the issue was on the network, but that got us only that far. The > missing piece was SysInternals TDIMon (free), that showed us IE6s > internal connection pool events. TDIMon seems to be discontinued (at > least I couldn't find it on the site), and I haven't had to use it in > a while, so I don't know which application is actually filling the gap > or whether you can download it somewhere else (I don't know if the old > version is Vista compatible but it worked fine on XP). > > Hope that helps and that you find a solution (that was one of the > harder bugs I ever had to track down, thus the extensive writeup). > > Cheers, > -D > > [1] http://extjs.com/forum/showthread.php?t=45673 > [2] http://technet.microsoft.com/en-us/sysinternals/default.aspx > > On Mar 25, 2:22 am, "Charles F. Munat" wrote: >> I have a survey online that updates the server via AJAX when individual >> form fields are blurred. Works beautifully in Firefox, Opera, IE7, etc. >> >> But in IE6 there are some serious problems. Unfortunately, the users of >> this survey are corporate, and some of them are forced to use IE6 (DEATH >> to lazy sysadmins!). What happens is that the saves sometimes work, and >> other times do not. Occasionally, a "server unavailable message" pops >> up, and after that nothing seems to work. I have a couple of customers >> who are very seriously pissed off because they've had to re-enter data >> four and five times. >> >> I suspect that this has something to do w
[Lift] Re: Absolute Beginner
I'm having a hard time visualizing how a Scala for absolute programming newbs would look like. But I'd believe that there could be a market for it. On Wed, Mar 25, 2009 at 9:09 PM, Randinn wrote: > > Thinking on it further it seems I need to ask this of the Scala crowd. > My knowledge of programming is antiquated but I do not want to learn > Java just to un-learn parts of it Scala changes. > > On Mar 26, 12:01 am, David Pollak > wrote: > > On Tue, Mar 24, 2009 at 9:35 PM, Randinn wrote: > > > > > Are there any plans for some tutorials/info for people that have no > > > programming experience (at least none in the last decade)? > > > > Sorry. Lift requires basic knowledge of Scala as well as some ability to > do > > stuff at the command line. > > > > > > > > -- > > 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 > > > > -- Viktor Klang Senior Systems Analyst --~--~-~--~~~---~--~~ 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: Absolute Beginner
Thinking on it further it seems I need to ask this of the Scala crowd. My knowledge of programming is antiquated but I do not want to learn Java just to un-learn parts of it Scala changes. On Mar 26, 12:01 am, David Pollak wrote: > On Tue, Mar 24, 2009 at 9:35 PM, Randinn wrote: > > > Are there any plans for some tutorials/info for people that have no > > programming experience (at least none in the last decade)? > > Sorry. Lift requires basic knowledge of Scala as well as some ability to do > stuff at the command line. > > > > -- > 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: Absolute Beginner
Further it's my understanding that the current crop of Scala books assume you already have a working knowledge of java. On Mar 26, 12:01 am, David Pollak wrote: > On Tue, Mar 24, 2009 at 9:35 PM, Randinn wrote: > > > Are there any plans for some tutorials/info for people that have no > > programming experience (at least none in the last decade)? > > Sorry. Lift requires basic knowledge of Scala as well as some ability to do > stuff at the command line. > > > > -- > 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: Lift Authentication
Hi, Everything said here pretty much covers it. I just want to say the HTTP authentication has pretty much nothing to do with form based authentication. Lift HTTP authentication is based on RFC 2617. Form based authentication is something invented by J(2)EE JSR specs and J(2) EE containers use JAAS to support both. As Derek said using form based auth in Lift is also trivial. Br's, Marius --~--~-~--~~~---~--~~ 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: Lift Authentication
Generating a template form to do that in Lift is trivial. Assuming we had a default template for the Lift app already set up: Getting it to check for an existing cookie is something that you would have to do in your JAAS provider. Derek On Wed, Mar 25, 2009 at 11:29 AM, Chad Skinner wrote: > Yes, on an ejb server you configure the authentication realm and then > submit a form to a location that is handled by the container, i.e. > > > > > > > > > > On Wed, Mar 25, 2009 at 11:23 AM, Derek Chen-Becker > wrote: > >> You're talking about JAAS, right? I think that the term "form-based >> authentication" is a bit ambiguous. For those that aren't familiar, the EJB >> server can use an application-provided form and authtentication callback to >> go against an existing JAAS auth module. >> >> Derek >> >> >> On Wed, Mar 25, 2009 at 10:56 AM, Chad Skinner wrote: >> >>> All of our applications are currently using form based authentication in >>> the EJB container .. am I correct that this (Form based authentication) is >>> not supported in Lift? >>> As I see it, After checking the users cookie against the Authentication >>> server I would want to cache the returned User object for a period to >>> prevent hitting the server for each request. The only downfall is that if >>> the user logs out of the authentication server and the cache is not cleared >>> then the user would still be authenticated until the cache expires. >>> >>> I may be living in the dark ages, but I did not think you could log a >>> user out using HttpAuthentication short of closing the browser ... is this >>> true? >>> >>> >>> On Wed, Mar 25, 2009 at 10:20 AM, Timothy Perrett >>> wrote: >>> Further to that example, no doubt someone will laugh at me for using database access on each request... However this is just an example! In reality I actually read from an LRU cache to save the database access. Cheers, Tim On 25/03/2009 15:08, "Timothy Perrett" wrote: > > Chad, > > We have HTTP Basic Auth and HTTP Digest Auth support in Lift. The > authentication is implemented as a partial function that you implement > like so: > > LiftRules.httpAuthProtectedResource.prepend { > case (ParsePath("api" :: _, _, _, _)) => Full(AuthRole("admin")) > } > > LiftRules.authentication = HttpBasicAuthentication("lift") { > case (username, password, req) => { > User.find(By(User.username, username)) match { > case Full(user) if user.password.match_?(password) => { > userRoles(AuthRole("admin")) > true > } > case _ => false > } > } > } > > Does that make things clearer for you? Essentially what happens is > this: > > user request (no auth) ==> challenge > user request (with auth) ==> sucsess (or challenge if incorrect) > > HTTP Digest is a lot more complex, if you need info on that, let me > know. > > Thanks > > Tim > > > On Mar 25, 2:42 pm, Chad Skinner wrote: >> Humm, I am learning something about HttpBasicAuthentication and need to look >> into this more. Is this method called for every request ... even before the >> user fills out the login form? > > > >>> >>> >>> >> >> >> > > > > --~--~-~--~~~---~--~~ 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: What a difference a CPU makes
Nice. I ran the command line that you specified and the run is closer to 10 minutes. That would indicate that scaladoc generation is on the order of 3 minutes, although I'm not 100% positive there because of the inclusion of both package and install targets. Derek On Wed, Mar 25, 2009 at 12:45 PM, Timothy Perrett wrote: > > mvn -o clean install gets me: > 6min 33sec on my Mac Book Pro 2.4 Core 2 Duo > 5min 59sec on my Mac Pro 2x 2.66 Dual-Core Xenon > > On Mar 25, 5:05 pm, Lee Mighdoll wrote: > > Running mvn -o clean install, I get: > > 27:04 on my old desktop (1Ghz Sempron 3100, 2gb, software raid 1) > > 6:59 on my new laptop (Core2 Duo CPU 9550 2.66Ghz, 4gb, software raid 1) > > 4:41 on my new desktop (3Ghz Core2 Quad 9650, 8gb, hardware raid 10) > > > > (I ran mvn clean install first to make sure I had all the artifacts > > downloaded.) > > > > Anybody tried a parallel version of maven? > > > > Lee > > > > On Wed, Mar 25, 2009 at 9:22 AM, Timothy Perrett >wrote: > > > > > > > > > Also, what command are you running to constitute a “build”? I usually > run: > > > > > mvn clean package install scala:doc > > > > > What are you guys running as im interested in the comparison. > > > > > Cheers, Tim > > > > > On 25/03/2009 12:38, "David Pollak" > wrote: > > > > > Derek, > > > > > What OS are you running? The old numbers are worse than my HP 2133 > Netbook > > > which clocks in at 15 minutes for a full Lift build. > > > > > Thanks, > > > > > David > > > > > On Tue, Mar 24, 2009 at 7:42 PM, Derek Chen-Becker < > dchenbec...@gmail.com> > > > wrote: > > > > > I just wanted to throw this out there in case anyone else is > considering > > > new hardware. I had an Athlon X2 4200+ powering my dev box (6GB of ram, > 2 x > > > RAID 1 SATA drives) and average build time for a "mvn clean install" > for the > > > entire liftweb project was roughly 17 minutes and 45 seconds. I just > > > upgraded to a Phenom X3 720 (no change in any other hardware) and my > build > > > times are now about 7 minutes! I'm guessing that the L3 cache on the > Phenom > > > is a huge part of that, but I'm sure that the increased clock and newer > core > > > are helping a bit. > > > > > Derek > > > --~--~-~--~~~---~--~~ 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: State and binding
On Mar 25, 3:46 pm, Chad Skinner wrote: > >> Not know much about lift yet and wanting to learn more, what is stored in > >> the server session for a simple application? I am assuming it is used by > >> the > >> binder to store the generated form field names so the submitted fields can > >> be rebound ... what other state does the framework store in it? > > > Any SessionVars are held in Session state. Bindings from HTML elements to > > functions are held in Session state. Bindings between Comet Actors and the > > HTML the represents them in held in Session state. > > Thanks for the information, I believe that the documentation states that > lift has its own session system and that it does not use the servers session > ... if this is true and you are running two redundant servers, will the > servers session replication / clustering copy the Lift session? LiftSession is bound to HTTP session via a Session bridge which essentially is a HttpSessionBindingListener and HttpSessionActivationListener. But besides that LiftSession is managed by a SessionMaster actor.LiftSessions are not replicated among cluster nodes. > > State/session replication in a large cluster can cause problems, but for our > situation I don't see server state as being a problem as long as it is > minimal and replicates in clusters. > > I went to the Colorado Software Summit last year and went to a couple of > presentations by Yan Pujante and was very impressed by what they are doing > at linked-in. He presented a couple of sessions one on OSGi and the issues > they are solving or hoping to solve with it as well as the obstacles they > have encountered. Also, he did a presentation on their new security / > authentication system which was very interesting. One thing he mentioned was > that they were moving to a stateless environment, where the only state that > is maintained is that of the authenticated user object. > > Working for a school district I can say that Linked-in's world is ... well > different ... they have over 400 developers we have 2 ... they have I > believe he said 600 web servers ... we have two. Server state for us ... not > really a problem and I'd be happy if my development is easier, quicker and I > can better meet the needs of our users in a timely fashion. --~--~-~--~~~---~--~~ 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: What a difference a CPU makes
mvn -o clean install gets me: 6min 33sec on my Mac Book Pro 2.4 Core 2 Duo 5min 59sec on my Mac Pro 2x 2.66 Dual-Core Xenon On Mar 25, 5:05 pm, Lee Mighdoll wrote: > Running mvn -o clean install, I get: > 27:04 on my old desktop (1Ghz Sempron 3100, 2gb, software raid 1) > 6:59 on my new laptop (Core2 Duo CPU 9550 2.66Ghz, 4gb, software raid 1) > 4:41 on my new desktop (3Ghz Core2 Quad 9650, 8gb, hardware raid 10) > > (I ran mvn clean install first to make sure I had all the artifacts > downloaded.) > > Anybody tried a parallel version of maven? > > Lee > > On Wed, Mar 25, 2009 at 9:22 AM, Timothy Perrett > wrote: > > > > > Also, what command are you running to constitute a “build”? I usually run: > > > mvn clean package install scala:doc > > > What are you guys running as im interested in the comparison. > > > Cheers, Tim > > > On 25/03/2009 12:38, "David Pollak" wrote: > > > Derek, > > > What OS are you running? The old numbers are worse than my HP 2133 Netbook > > which clocks in at 15 minutes for a full Lift build. > > > Thanks, > > > David > > > On Tue, Mar 24, 2009 at 7:42 PM, Derek Chen-Becker > > wrote: > > > I just wanted to throw this out there in case anyone else is considering > > new hardware. I had an Athlon X2 4200+ powering my dev box (6GB of ram, 2 x > > RAID 1 SATA drives) and average build time for a "mvn clean install" for the > > entire liftweb project was roughly 17 minutes and 45 seconds. I just > > upgraded to a Phenom X3 720 (no change in any other hardware) and my build > > times are now about 7 minutes! I'm guessing that the L3 cache on the Phenom > > is a huge part of that, but I'm sure that the increased clock and newer core > > are helping a bit. > > > Derek --~--~-~--~~~---~--~~ 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: What a difference a CPU makes
Running mvn -o clean install, I get: 27:04 on my old desktop (1Ghz Sempron 3100, 2gb, software raid 1) 6:59 on my new laptop (Core2 Duo CPU 9550 2.66Ghz, 4gb, software raid 1) 4:41 on my new desktop (3Ghz Core2 Quad 9650, 8gb, hardware raid 10) (I ran mvn clean install first to make sure I had all the artifacts downloaded.) Anybody tried a parallel version of maven? Lee On Wed, Mar 25, 2009 at 9:22 AM, Timothy Perrett wrote: > > Also, what command are you running to constitute a “build”? I usually run: > > mvn clean package install scala:doc > > What are you guys running as im interested in the comparison. > > Cheers, Tim > > On 25/03/2009 12:38, "David Pollak" wrote: > > Derek, > > What OS are you running? The old numbers are worse than my HP 2133 Netbook > which clocks in at 15 minutes for a full Lift build. > > Thanks, > > David > > On Tue, Mar 24, 2009 at 7:42 PM, Derek Chen-Becker > wrote: > > I just wanted to throw this out there in case anyone else is considering > new hardware. I had an Athlon X2 4200+ powering my dev box (6GB of ram, 2 x > RAID 1 SATA drives) and average build time for a "mvn clean install" for the > entire liftweb project was roughly 17 minutes and 45 seconds. I just > upgraded to a Phenom X3 720 (no change in any other hardware) and my build > times are now about 7 minutes! I'm guessing that the L3 cache on the Phenom > is a huge part of that, but I'm sure that the increased clock and newer core > are helping a bit. > > Derek > > > > > > > > --~--~-~--~~~---~--~~ 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: Lift application: run an debug with IntelliJ IDEA plugin
Very cool. And it looks like a new version of the Scala plugin for IDEA was released today as well. Huzzah! On Wed, Mar 25, 2009 at 9:18 AM, Ilya Sergey wrote: > I happy to announce, that last version of Scala plugin IntelliJ IDEA > (http://plugins.intellij.net/plugin/?id=1347) provides possibility to run > and debug easily lift applications. --~--~-~--~~~---~--~~ 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: Lift Authentication
Yes, on an ejb server you configure the authentication realm and then submit a form to a location that is handled by the container, i.e. On Wed, Mar 25, 2009 at 11:23 AM, Derek Chen-Becker wrote: > You're talking about JAAS, right? I think that the term "form-based > authentication" is a bit ambiguous. For those that aren't familiar, the EJB > server can use an application-provided form and authtentication callback to > go against an existing JAAS auth module. > > Derek > > > On Wed, Mar 25, 2009 at 10:56 AM, Chad Skinner wrote: > >> All of our applications are currently using form based authentication in >> the EJB container .. am I correct that this (Form based authentication) is >> not supported in Lift? >> As I see it, After checking the users cookie against the Authentication >> server I would want to cache the returned User object for a period to >> prevent hitting the server for each request. The only downfall is that if >> the user logs out of the authentication server and the cache is not cleared >> then the user would still be authenticated until the cache expires. >> >> I may be living in the dark ages, but I did not think you could log a user >> out using HttpAuthentication short of closing the browser ... is this true? >> >> >> On Wed, Mar 25, 2009 at 10:20 AM, Timothy Perrett >> wrote: >> >>> >>> >>> Further to that example, no doubt someone will laugh at me for using >>> database access on each request... However this is just an example! In >>> reality I actually read from an LRU cache to save the database access. >>> >>> Cheers, Tim >>> >>> On 25/03/2009 15:08, "Timothy Perrett" wrote: >>> >>> > >>> > Chad, >>> > >>> > We have HTTP Basic Auth and HTTP Digest Auth support in Lift. The >>> > authentication is implemented as a partial function that you implement >>> > like so: >>> > >>> > LiftRules.httpAuthProtectedResource.prepend { >>> > case (ParsePath("api" :: _, _, _, _)) => Full(AuthRole("admin")) >>> > } >>> > >>> > LiftRules.authentication = HttpBasicAuthentication("lift") { >>> > case (username, password, req) => { >>> > User.find(By(User.username, username)) match { >>> > case Full(user) if user.password.match_?(password) => { >>> > userRoles(AuthRole("admin")) >>> > true >>> > } >>> > case _ => false >>> > } >>> > } >>> > } >>> > >>> > Does that make things clearer for you? Essentially what happens is >>> > this: >>> > >>> > user request (no auth) ==> challenge >>> > user request (with auth) ==> sucsess (or challenge if incorrect) >>> > >>> > HTTP Digest is a lot more complex, if you need info on that, let me >>> > know. >>> > >>> > Thanks >>> > >>> > Tim >>> > >>> > >>> > On Mar 25, 2:42 pm, Chad Skinner wrote: >>> >> Humm, I am learning something about HttpBasicAuthentication and need >>> to look >>> >> into this more. Is this method called for every request ... even >>> before the >>> >> user fills out the login form? >>> > > >>> > >>> >>> >>> >>> >>> >> >> >> > > > > --~--~-~--~~~---~--~~ 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] Lift application: run an debug with IntelliJ IDEA plugin
Hello, all. I happy to announce, that last version of Scala plugin IntelliJ IDEA ( http://plugins.intellij.net/plugin/?id=1347) provides possibility to run and debug easily lift applications. To import an existing lift application into IDEA just choose "Import project from existing model" when creating new project and point to the appropriate pom.xml file. All libraries will be configurated automatically. To create run configuration, first, make sure, that $M2_HOME variable is set up properly in your system. After that, switch to IDEA and right-click on the same pom.xml file in the project view. Choose "create 'my_app[jetty:run]' " and run configuration will be created. Using it you may run and debug your application. In some case there migh be an error with message like 'No valid Maven installation found'. Then just put correct path to maven installation directory (for example /usr/share/maven2) to Maven Home Directory textfield in General tab of created run configuration. With best regards, Ilya Sergey --~--~-~--~~~---~--~~ 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: Lift Authentication
> > Ohh... Right my apologies. I saw the post with Tyler and presumed you > specifically wanted to know about HTTP auth. My bad! > You can do form-based authentication just perfectly in lift... Its no > problem at all. > No apologies required at all. I am reading a lot and am trying to wrap my head around a lot of this and authentication / authorization is one of the areas that I want to make certain that I understand. My questions are about authentication in general. --~--~-~--~~~---~--~~ 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: What a difference a CPU makes
I'm just running "mvn clean install". I'll try your command and see what it does. I'm not a maven expert, but isn't "package" a subset of install anyway? Derek On Wed, Mar 25, 2009 at 11:22 AM, Timothy Perrett wrote: > > Also, what command are you running to constitute a “build”? I usually run: > > mvn clean package install scala:doc > > What are you guys running as im interested in the comparison. > > Cheers, Tim > > On 25/03/2009 12:38, "David Pollak" wrote: > > Derek, > > What OS are you running? The old numbers are worse than my HP 2133 Netbook > which clocks in at 15 minutes for a full Lift build. > > Thanks, > > David > > On Tue, Mar 24, 2009 at 7:42 PM, Derek Chen-Becker > wrote: > > I just wanted to throw this out there in case anyone else is considering > new hardware. I had an Athlon X2 4200+ powering my dev box (6GB of ram, 2 x > RAID 1 SATA drives) and average build time for a "mvn clean install" for the > entire liftweb project was roughly 17 minutes and 45 seconds. I just > upgraded to a Phenom X3 720 (no change in any other hardware) and my build > times are now about 7 minutes! I'm guessing that the L3 cache on the Phenom > is a huge part of that, but I'm sure that the increased clock and newer core > are helping a bit. > > Derek > > > > > > > > --~--~-~--~~~---~--~~ 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: Lift Authentication
You're talking about JAAS, right? I think that the term "form-based authentication" is a bit ambiguous. For those that aren't familiar, the EJB server can use an application-provided form and authtentication callback to go against an existing JAAS auth module. Derek On Wed, Mar 25, 2009 at 10:56 AM, Chad Skinner wrote: > All of our applications are currently using form based authentication in > the EJB container .. am I correct that this (Form based authentication) is > not supported in Lift? > As I see it, After checking the users cookie against the Authentication > server I would want to cache the returned User object for a period to > prevent hitting the server for each request. The only downfall is that if > the user logs out of the authentication server and the cache is not cleared > then the user would still be authenticated until the cache expires. > > I may be living in the dark ages, but I did not think you could log a user > out using HttpAuthentication short of closing the browser ... is this true? > > > On Wed, Mar 25, 2009 at 10:20 AM, Timothy Perrett > wrote: > >> >> >> Further to that example, no doubt someone will laugh at me for using >> database access on each request... However this is just an example! In >> reality I actually read from an LRU cache to save the database access. >> >> Cheers, Tim >> >> On 25/03/2009 15:08, "Timothy Perrett" wrote: >> >> > >> > Chad, >> > >> > We have HTTP Basic Auth and HTTP Digest Auth support in Lift. The >> > authentication is implemented as a partial function that you implement >> > like so: >> > >> > LiftRules.httpAuthProtectedResource.prepend { >> > case (ParsePath("api" :: _, _, _, _)) => Full(AuthRole("admin")) >> > } >> > >> > LiftRules.authentication = HttpBasicAuthentication("lift") { >> > case (username, password, req) => { >> > User.find(By(User.username, username)) match { >> > case Full(user) if user.password.match_?(password) => { >> > userRoles(AuthRole("admin")) >> > true >> > } >> > case _ => false >> > } >> > } >> > } >> > >> > Does that make things clearer for you? Essentially what happens is >> > this: >> > >> > user request (no auth) ==> challenge >> > user request (with auth) ==> sucsess (or challenge if incorrect) >> > >> > HTTP Digest is a lot more complex, if you need info on that, let me >> > know. >> > >> > Thanks >> > >> > Tim >> > >> > >> > On Mar 25, 2:42 pm, Chad Skinner wrote: >> >> Humm, I am learning something about HttpBasicAuthentication and need to >> look >> >> into this more. Is this method called for every request ... even before >> the >> >> user fills out the login form? >> > > >> > >> >> >> >> >> > > > > --~--~-~--~~~---~--~~ 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: What a difference a CPU makes
Also, what command are you running to constitute a ³build²? I usually run: mvn clean package install scala:doc What are you guys running as im interested in the comparison. Cheers, Tim On 25/03/2009 12:38, "David Pollak" wrote: > Derek, > > What OS are you running? The old numbers are worse than my HP 2133 Netbook > which clocks in at 15 minutes for a full Lift build. > > Thanks, > > David > > On Tue, Mar 24, 2009 at 7:42 PM, Derek Chen-Becker > wrote: >> I just wanted to throw this out there in case anyone else is considering new >> hardware. I had an Athlon X2 4200+ powering my dev box (6GB of ram, 2 x RAID >> 1 SATA drives) and average build time for a "mvn clean install" for the >> entire liftweb project was roughly 17 minutes and 45 seconds. I just upgraded >> to a Phenom X3 720 (no change in any other hardware) and my build times are >> now about 7 minutes! I'm guessing that the L3 cache on the Phenom is a huge >> part of that, but I'm sure that the increased clock and newer core are >> helping a bit. >> >> Derek >> >> > > --~--~-~--~~~---~--~~ 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: Lift Authentication
On Mar 25, 6:00 pm, David Pollak wrote: > On Wed, Mar 25, 2009 at 8:56 AM, Chad Skinner wrote: > > > All of our applications are currently using form based authentication in > > the EJB container .. am I correct that this (Form based authentication) is > > not supported in Lift? > > You are incorrect. Form-based authentication works just fine in Lift. > > > > > As I see it, After checking the users cookie against the Authentication > > server I would want to cache the returned User object for a period to > > prevent hitting the server for each request. The only downfall is that if > > the user logs out of the authentication server and the cache is not cleared > > then the user would still be authenticated until the cache expires. > > > I may be living in the dark ages, but I did not think you could log a user > > out using HttpAuthentication short of closing the browser ... is this true? > > No. You can stop honoring the authentication provided by HttpAuth. This > requires server logic rather than a hard-coded auth file. Actually there might be a way ... no bullet proof though. You can register a JavaScript listener when the browser is closed : onbeforeunload. Here you can probably send an Ajax logout call. > > > > > > > On Wed, Mar 25, 2009 at 10:20 AM, Timothy Perrett > > wrote: > > >> Further to that example, no doubt someone will laugh at me for using > >> database access on each request... However this is just an example! In > >> reality I actually read from an LRU cache to save the database access. > > >> Cheers, Tim > > >> On 25/03/2009 15:08, "Timothy Perrett" wrote: > > >> > Chad, > > >> > We have HTTP Basic Auth and HTTP Digest Auth support in Lift. The > >> > authentication is implemented as a partial function that you implement > >> > like so: > > >> > LiftRules.httpAuthProtectedResource.prepend { > >> > case (ParsePath("api" :: _, _, _, _)) => Full(AuthRole("admin")) > >> > } > > >> > LiftRules.authentication = HttpBasicAuthentication("lift") { > >> > case (username, password, req) => { > >> > User.find(By(User.username, username)) match { > >> > case Full(user) if user.password.match_?(password) => { > >> > userRoles(AuthRole("admin")) > >> > true > >> > } > >> > case _ => false > >> > } > >> > } > >> > } > > >> > Does that make things clearer for you? Essentially what happens is > >> > this: > > >> > user request (no auth) ==> challenge > >> > user request (with auth) ==> sucsess (or challenge if incorrect) > > >> > HTTP Digest is a lot more complex, if you need info on that, let me > >> > know. > > >> > Thanks > > >> > Tim > > >> > On Mar 25, 2:42 pm, Chad Skinner wrote: > >> >> Humm, I am learning something about HttpBasicAuthentication and need to > >> look > >> >> into this more. Is this method called for every request ... even before > >> the > >> >> user fills out the login form? > > -- > 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: Lift Authentication
Ohh... Right my apologies. I saw the post with Tyler and presumed you specifically wanted to know about HTTP auth. My bad! You can do form-based authentication just perfectly in lift... Its no problem at all. Thanks, Tim On 25/03/2009 16:00, "David Pollak" wrote: > > > On Wed, Mar 25, 2009 at 8:56 AM, Chad Skinner wrote: >> All of our applications are currently using form based authentication in the >> EJB container .. am I correct that this (Form based authentication) is not >> supported in Lift? > > You are incorrect. Form-based authentication works just fine in Lift. > >> >> As I see it, After checking the users cookie against the Authentication >> server I would want to cache the returned User object for a period to prevent >> hitting the server for each request. The only downfall is that if the user >> logs out of the authentication server and the cache is not cleared then the >> user would still be authenticated until the cache expires. >> >> I may be living in the dark ages, but I did not think you could log a user >> out using HttpAuthentication short of closing the browser ... is this true? > > No. You can stop honoring the authentication provided by HttpAuth. This > requires server logic rather than a hard-coded auth file. > >> >> >> On Wed, Mar 25, 2009 at 10:20 AM, Timothy Perrett >> wrote: >>> >>> >>> Further to that example, no doubt someone will laugh at me for using >>> database access on each request... However this is just an example! In >>> reality I actually read from an LRU cache to save the database access. >>> >>> Cheers, Tim >>> >>> On 25/03/2009 15:08, "Timothy Perrett" wrote: >>> > > Chad, > > We have HTTP Basic Auth and HTTP Digest Auth support in Lift. The > authentication is implemented as a partial function that you implement > like so: > > LiftRules.httpAuthProtectedResource.prepend { > case (ParsePath("api" :: _, _, _, _)) => Full(AuthRole("admin")) > } > > LiftRules.authentication = HttpBasicAuthentication("lift") { > case (username, password, req) => { > User.find(By(User.username, username)) match { > case Full(user) if user.password.match_?(password) => { > userRoles(AuthRole("admin")) > true > } > case _ => false > } > } > } > > Does that make things clearer for you? Essentially what happens is > this: > > user request (no auth) ==> challenge > user request (with auth) ==> sucsess (or challenge if incorrect) > > HTTP Digest is a lot more complex, if you need info on that, let me > know. > > Thanks > > Tim > > > On Mar 25, 2:42 pm, Chad Skinner wrote: > >> Humm, I am learning something about HttpBasicAuthentication and need to > look > >> into this more. Is this method called for every request ... even before > the > >> user fills out the login form? > > > > >>> >>> >>> >>> >> >> >> > > --~--~-~--~~~---~--~~ 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: Lift Authentication
On Wed, Mar 25, 2009 at 8:56 AM, Chad Skinner wrote: > All of our applications are currently using form based authentication in > the EJB container .. am I correct that this (Form based authentication) is > not supported in Lift? You are incorrect. Form-based authentication works just fine in Lift. > > As I see it, After checking the users cookie against the Authentication > server I would want to cache the returned User object for a period to > prevent hitting the server for each request. The only downfall is that if > the user logs out of the authentication server and the cache is not cleared > then the user would still be authenticated until the cache expires. > > I may be living in the dark ages, but I did not think you could log a user > out using HttpAuthentication short of closing the browser ... is this true? > No. You can stop honoring the authentication provided by HttpAuth. This requires server logic rather than a hard-coded auth file. > > > On Wed, Mar 25, 2009 at 10:20 AM, Timothy Perrett > wrote: > >> >> >> Further to that example, no doubt someone will laugh at me for using >> database access on each request... However this is just an example! In >> reality I actually read from an LRU cache to save the database access. >> >> Cheers, Tim >> >> On 25/03/2009 15:08, "Timothy Perrett" wrote: >> >> > >> > Chad, >> > >> > We have HTTP Basic Auth and HTTP Digest Auth support in Lift. The >> > authentication is implemented as a partial function that you implement >> > like so: >> > >> > LiftRules.httpAuthProtectedResource.prepend { >> > case (ParsePath("api" :: _, _, _, _)) => Full(AuthRole("admin")) >> > } >> > >> > LiftRules.authentication = HttpBasicAuthentication("lift") { >> > case (username, password, req) => { >> > User.find(By(User.username, username)) match { >> > case Full(user) if user.password.match_?(password) => { >> > userRoles(AuthRole("admin")) >> > true >> > } >> > case _ => false >> > } >> > } >> > } >> > >> > Does that make things clearer for you? Essentially what happens is >> > this: >> > >> > user request (no auth) ==> challenge >> > user request (with auth) ==> sucsess (or challenge if incorrect) >> > >> > HTTP Digest is a lot more complex, if you need info on that, let me >> > know. >> > >> > Thanks >> > >> > Tim >> > >> > >> > On Mar 25, 2:42 pm, Chad Skinner wrote: >> >> Humm, I am learning something about HttpBasicAuthentication and need to >> look >> >> into this more. Is this method called for every request ... even before >> the >> >> user fills out the login form? >> > > >> > >> >> >> >> >> > > > > -- 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: Lift Authentication
All of our applications are currently using form based authentication in the EJB container .. am I correct that this (Form based authentication) is not supported in Lift? As I see it, After checking the users cookie against the Authentication server I would want to cache the returned User object for a period to prevent hitting the server for each request. The only downfall is that if the user logs out of the authentication server and the cache is not cleared then the user would still be authenticated until the cache expires. I may be living in the dark ages, but I did not think you could log a user out using HttpAuthentication short of closing the browser ... is this true? On Wed, Mar 25, 2009 at 10:20 AM, Timothy Perrett wrote: > > > Further to that example, no doubt someone will laugh at me for using > database access on each request... However this is just an example! In > reality I actually read from an LRU cache to save the database access. > > Cheers, Tim > > On 25/03/2009 15:08, "Timothy Perrett" wrote: > > > > > Chad, > > > > We have HTTP Basic Auth and HTTP Digest Auth support in Lift. The > > authentication is implemented as a partial function that you implement > > like so: > > > > LiftRules.httpAuthProtectedResource.prepend { > > case (ParsePath("api" :: _, _, _, _)) => Full(AuthRole("admin")) > > } > > > > LiftRules.authentication = HttpBasicAuthentication("lift") { > > case (username, password, req) => { > > User.find(By(User.username, username)) match { > > case Full(user) if user.password.match_?(password) => { > > userRoles(AuthRole("admin")) > > true > > } > > case _ => false > > } > > } > > } > > > > Does that make things clearer for you? Essentially what happens is > > this: > > > > user request (no auth) ==> challenge > > user request (with auth) ==> sucsess (or challenge if incorrect) > > > > HTTP Digest is a lot more complex, if you need info on that, let me > > know. > > > > Thanks > > > > Tim > > > > > > On Mar 25, 2:42 pm, Chad Skinner wrote: > >> Humm, I am learning something about HttpBasicAuthentication and need to > look > >> into this more. Is this method called for every request ... even before > the > >> user fills out the login form? > > > > > > > > > > > --~--~-~--~~~---~--~~ 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: State and binding
On Wed, Mar 25, 2009 at 7:38 AM, Chad Skinner wrote: > So, are the sessions replicated or do you lose active connections if a node > goes down? Yes. And your app goes down if the RDBMS goes down. > > I agree I don't have a problem with server session state ... the only > problem I have is we originally used JSF for a number of our applications > and I hate the reliance on POST in order to submit the serialized state. > There is no reason in my mind not to support GET and keep the session > information on the server .. For this LIFT seems a good fit. > > Not lift related, but does anyone know of an inexpensive load balancer that > works well and would support session affinity? The only reason I ask is that > I would like to replace our current software LB with a hardware device and > with the budget cuts due to the economy I need something that will work well > with relatively small loads and that is cost effective. > I would use Nginx software as a load balancer. It's fast enough to handle a ton of traffic (on the order of 10K requests per second on a dual opteron). > > -- Chad > > > On Wed, Mar 25, 2009 at 8:58 AM, Viktor Klang wrote: > >> Hi Chad! >> >> Lift is intended to be clustered using a load-balancer with >> session-affinity, which means that no session replication is needed unless a >> node goes down. >> >> From only having almost a decade of web-framework development experience, >> I fully support the notion of having the session state serverside for highly >> interactive rich internet applications. >> Not only does it simplify development and enhance security, but it enables >> a whole lot of shortcuts not available for share-nothing approaches. >> >> That being said, I am a very big proponent for the REST model, which Lift >> is _very_ competent in providing an API for you to use, for ROA/REST needs. >> >> From what you may gather from this e-mail, I strongly believe in using the >> right tools for each job. >> >> Does this answer help you? >> >> Cheers, >> Viktor >> >> >> On Wed, Mar 25, 2009 at 2:46 PM, Chad Skinner wrote: >> >>> > Not know much about lift yet and wanting to learn more, what is stored > in the server session for a simple application? I am assuming it is used > by > the binder to store the generated form field names so the submitted fields > can be rebound ... what other state does the framework store in it? > Any SessionVars are held in Session state. Bindings from HTML elements to functions are held in Session state. Bindings between Comet Actors and the HTML the represents them in held in Session state. >>> >>> Thanks for the information, I believe that the documentation states that >>> lift has its own session system and that it does not use the servers session >>> ... if this is true and you are running two redundant servers, will the >>> servers session replication / clustering copy the Lift session? >>> >>> State/session replication in a large cluster can cause problems, but for >>> our situation I don't see server state as being a problem as long as it is >>> minimal and replicates in clusters. >>> >>> I went to the Colorado Software Summit last year and went to a couple of >>> presentations by Yan Pujante and was very impressed by what they are doing >>> at linked-in. He presented a couple of sessions one on OSGi and the issues >>> they are solving or hoping to solve with it as well as the obstacles they >>> have encountered. Also, he did a presentation on their new security / >>> authentication system which was very interesting. One thing he mentioned was >>> that they were moving to a stateless environment, where the only state that >>> is maintained is that of the authenticated user object. >>> >>> Working for a school district I can say that Linked-in's world is ... >>> well different ... they have over 400 developers we have 2 ... they have I >>> believe he said 600 web servers ... we have two. Server state for us ... not >>> really a problem and I'd be happy if my development is easier, quicker and I >>> can better meet the needs of our users in a timely fashion. >>> >>> >>> >> >> >> -- >> Viktor Klang >> Senior Systems Analyst >> >> >> >> > > > > -- 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: File <-> Class naming
That is indeed a fair point! The current rational for naming is probably something along the lines of "that's what felt right" rather than anything more logical :( Ok, what your proposing sounds cool to me. Provided it doesn't change any FCQN then were good to go. Cheers, Tim On 25/03/2009 15:43, "Alex Boisvert" wrote: > > Yes, just renaming. > > Right now, I'd say I'm picking the class that most closely matches the current > naming* and if that's not applicable then 1) if the file contain a class > hierarchy, then I pick the base trait/class or 2) the biggest public class > otherwise. > > alex > > * What's the rational behind the current naming? :) --~--~-~--~~~---~--~~ 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: lift:Menu.group
(1) It's correct because it makes use of Lift's access control features to exclude links that are not allowed. (2) If you don't like it, don't use it. Use your own. On Wed, Mar 25, 2009 at 7:00 AM, bradford wrote: > > Please don't shoot me for bringing this up again. I still don't think > the current behavior of Menu.item makes sense. If the user doesn't > want that link to appear on the page, then they shouldn't include > in its source. Most people put text > around their link: > > | | > > > which, on foo2, would render as > _foo1_ | | _foo3_ > > or > > For a good time click here llift:Menu.item>. For a not so good time name="foo2">click here. > > which, on foo2, would render as > For a good time _click here_. For a not so good time . > > Regards, > Bradford > > On Mar 25, 7:53 am, bradford wrote: > > David, you're right that needing to surround the element text of a > > with span is a unique case and should be a custom snippet. I've > > removed the span now and think that Derek's addition of "always" would > > be just what I need. Adding group="foo" to Menu.builder would suffice > > as well. > > > > Thanks for the tips, Chas. > > > > Derek, if you do add "always" can you please let me know so that I can > > update my code. > > > > Thanks, > > Bradford > > > > On Mar 24, 10:37 pm, Derek Chen-Becker wrote: > > > > > The general case is that a page won't link to itself, I think, which is > why > > > the default isn't to show it when the page matches. Unless anyone has > > > objections I can add an "always" attribute. As for #1, the Menu.item > makes a > > > link using whatever the contents of the Menu.item tag are for the link > text: > > > > > Go here > > > > > should become > > > > > Go here > > > > > Am I misunderstanding what you're looking for there? As for #2, you > should > > > be able to add a class using the prefixed attribute: > > > > > > > > > > In this context, li_item is the menu item that matches the current > page. > > > With Menu.group, you can specify the binding template: > > > > > > > > > > > > > > > > > > > > > > But there's no provision to do anything special for the current page. > > > > > Let me know if that's not sufficient or if I'm misunderstanding your > > > requirement. > > > > > Derek > > > > > On Tue, Mar 24, 2009 at 3:50 PM, bradford > wrote: > > > > > > Thanks for the clarification, David, and for your snippet, Derek. > > > > > > I think adding an "always" attribute to Menu.item would be very > > > > beneficial. I still don't understand why that's not its default > > > > behavior. > > > > > > It looks like I will not be able to use any of lift's Menu tags at > > > > this time, because 1) I need to surround the item text with span and > > > > 2) I need a way to add class="active" to the li_item. Both are not > > > > possible with Menu.item, Menu.group, or Menu.builder. Let me know if > > > > I am mistaken. If I am not not, may I put in a feature request for > > > > these items. For the time being I will just hard code it as follows > > > > (which is not a big deal to me at this time): > > > > > > > > > > Foo1 > > > > Foo2 > > > > Foo3 > > > > > > > > > > Thanks again for the great support :) > > > > > > Bradford > > > > > > On Mar 24, 12:08 pm, David Pollak > > > > wrote: > > > > > On Tue, Mar 24, 2009 at 9:02 AM, Charles F. Munat > > > > wrote: > > > > > > > > David Pollak wrote: > > > > > > > What's the best practice: > > > > > > > > > For more information about . > For > > > > more > > > > > > > information about . > > > > > > > > > Or > > > > > > > > > For more information about foo1. For > more > > > > > > > information about foo2. > > > > > > > > > The latter. This allows you to move the pages around on the > > > > filesystem > > > > > > > without having to grep through all you source files looking for > what > > > > > > > needs to be changed. > > > > > > > > Am I missing something, or did you mean the former? > > > > > > > D'oh! That brain-finger connection is always getting messed up. I > meant > > > > > the former. Thanks for correcting me! > > > > > > > > Chas. > > > > > > > -- > > > > > 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 -~--~~~~--~~--
[Lift] Re: File <-> Class naming
On Wed, Mar 25, 2009 at 8:43 AM, Alex Boisvert wrote: > 2009/3/25 Timothy Perrett > >> >> Ah ok I see this - so your not doing any splitting? just re-naming? >> What rational would you apply to decide on "most significant" class / >> object? >> > > Yes, just renaming. > > Right now, I'd say I'm picking the class that most closely matches the > current naming* and if that's not applicable then 1) if the file contain a > class hierarchy, then I pick the base trait/class or 2) the biggest public > class otherwise. > > alex > > * What's the rational behind the current naming? :) > General dpp randomness. Never allow me to name anything (except my children and animals) > > > > > > > > -- 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: What a difference a CPU makes
On Wed, Mar 25, 2009 at 7:11 AM, Derek Chen-Becker wrote: > Yeah, the iostat indicates very little disk activity, and since my machine > is running servers for web, email and VPN what I'm seeing could be entirely > unrelated to the build. As a comparison, my laptop (Dell Precision M4300) > with an Intel Core Duo T7700 and 4GB of memory builds in about 8:30. That's > a 32-bit JVM, so maybe I should run 32 bit on my desktop to see if that > makes a difference. My suspicion is that because the Athlon X2 4200+ has no > L3 cache (128K L1, 512K L2) it's having to go to main memory a lot. The > T7700 has 4MB L2 per core and the Phenom has 6MB L3 shared across cores. > > How does my current 7 minute build time compare with other people's > experience? My Core 2 Quad 2.4 Ghz desktop, I have a 7 minute build time (64 bit Ubuntu 8.04) My Core 2 Duo 2.4 Ghz laptop, I have a 7 minute build time (32 bit Windows Vista) > > > Derek > > > On Wed, Mar 25, 2009 at 8:52 AM, David Pollak < > feeder.of.the.be...@gmail.com> wrote: > >> Weird. My 2133 is running at 1.2 Ghz and has an 800Mhz (at best) memory >> speed. My experience with Lift builds on machines with a lot of memory is >> that there's almost no disk access... everything is cached. >> >> >> On Wed, Mar 25, 2009 at 6:32 AM, Derek Chen-Becker > > wrote: >> >>> Ubuntu 8.10 x64. Java is >>> >>> java version "1.6.0_12" >>> Java(TM) SE Runtime Environment (build 1.6.0_12-b04) >>> Java HotSpot(TM) 64-Bit Server VM (build 11.2-b01, mixed mode) >>> >>> Here's AMD's rundown of the difference between the CPUs: >>> >>> http://products.amd.com/en-us/DesktopCPUSideBySide.aspx?id=522&id=59 >>> >>> Note that I'm still using the original AM2 motherboard with the same >>> DDR2-800 memory. The fact that it's AM2 means that the Phenom is downgrading >>> its HyperTransport to the same speed as the Athlon X2 for bus access. >>> >>> I suppose I could benchmark it to see how it performs for other tasks. >>> I'm not sure how much an SSD would help. I'll run a build and monitor iostat >>> to see how much data transfer goes to/from the HDDs, but my machine >>> typically runs a file cache of about 800-900MB of memory (6GB total), so I >>> would suspect that most of what maven needs gets sucked into the cache. >>> >>> Derek >>> >>> On Wed, Mar 25, 2009 at 6:38 AM, David Pollak < >>> feeder.of.the.be...@gmail.com> wrote: >>> Derek, What OS are you running? The old numbers are worse than my HP 2133 Netbook which clocks in at 15 minutes for a full Lift build. Thanks, David On Tue, Mar 24, 2009 at 7:42 PM, Derek Chen-Becker < dchenbec...@gmail.com> wrote: > I just wanted to throw this out there in case anyone else is > considering new hardware. I had an Athlon X2 4200+ powering my dev box > (6GB > of ram, 2 x RAID 1 SATA drives) and average build time for a "mvn clean > install" for the entire liftweb project was roughly 17 minutes and 45 > seconds. I just upgraded to a Phenom X3 720 (no change in any other > hardware) and my build times are now about 7 minutes! I'm guessing that > the > L3 cache on the Phenom is a huge part of that, but I'm sure that the > increased clock and newer core are helping a bit. > > Derek > > > -- 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 >>> >>> >>> >> >> >> -- >> 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 >> >> >> > > > > -- 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: File <-> Class naming
2009/3/25 Timothy Perrett > > Ah ok I see this - so your not doing any splitting? just re-naming? > What rational would you apply to decide on "most significant" class / > object? Yes, just renaming. Right now, I'd say I'm picking the class that most closely matches the current naming* and if that's not applicable then 1) if the file contain a class hierarchy, then I pick the base trait/class or 2) the biggest public class otherwise. alex * What's the rational behind the current naming? :) --~--~-~--~~~---~--~~ 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: File <-> Class naming
Ah ok I see this - so your not doing any splitting? just re-naming? What rational would you apply to decide on "most significant" class / object? Im not trying to be difficult or anything, id just like to fully understand what you want to chage and how that could happen. Cheers, Tim On Mar 25, 3:21 pm, Alex Boisvert wrote: > Tim, I think you misunderstood the proposal. There's going to be the same > number of source files overall. They will just be named according to the > "main" (as in most significant) class they contain. --~--~-~--~~~---~--~~ 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: File <-> Class naming
Tim, I think you misunderstood the proposal. There's going to be the same number of source files overall. They will just be named according to the "main" (as in most significant) class they contain. 2009/3/25 Timothy Perrett > > Hmm - Im a little skeptical. One of the nice things about Scala is > that you don't need one source file per class... that really bugs me > about Java. > > Can you be suscint about what stuff your splitting. Right now the > codebase in lift feels "workable". I wouldnt want to see it split out > into a jillion files... having to scroll through my big java code- > bases is a royal pain in the backside. > > Cheers, > > Tim > > On Mar 25, 2:54 pm, Alex Boisvert wrote: > > I'll wait a little more before I commit the changes in case others have > > feedback. > > > > I'm working my way through building each project with Buildr... and I'll > > give everybody a heads-up before I commit the changes. I suspect it > will > > affect between 15-25 files overall. > > > > alex > > > > 2009/3/25 David Pollak > > > > > > > > > On Tue, Mar 24, 2009 at 11:04 PM, Alex Boisvert >wrote: > > > > >> Hi Lifters, > > > > >> How would you feel about renaming .scala files to match the main > > >> class/trait in them? > > > > >> Let me give you a few examples, > > > > >> lift/src/main/scala/net/liftweb/http/auth/Authentication.scala > > >> currently holds a trait named HttpAuthentication. > > >> I'd like to rename it HttpAuthentication.scala > > > > >> lift/src/main/scala/net/liftweb/http/Stateful.scala > > >> currently holds the StatefulSnippet trait, > > >> so I'd like to rename it StatefulSnippet.scala > > > > >> lift/src/main/scala/net/liftweb/http/Vars.scala > > >> contains many things but the main class is AnyVar > > >> so I'd like to rename it AnyVar.scala > > > > >> and so on... > > > > >> There are two reasons I'd like to make these changes. First, I think > it's > > >> a good convention and it makes it easier to locate some of the main > classes > > >> more easily (my Java roots are showing) and second, which is much more > > >> selfish at this point, is that Buildr does recompilation checks based > on > > >> file timestamps and the existence of a corresponding .class file in > the > > >> target directory and so it would help Buildr avoid recompiling > everything > > >> all the time even though nothing has really changed. > > > > >> (I do realize practically nobody besides me uses Buildr in the Lift > > >> community at this point but I do intend to demonstrate that it's a > great > > >> alternative to Maven. And no, I'm not trying to replace or eradicate > Maven, > > >> I'm just trying to make my own life simpler and share the results. I > also > > >> realize that it's likely scalac will have better recompilation > detection in > > >> the future that may make the second reason for this request > irrelevant, > > >> although I think the first reason is sufficient) > > > > >> What do you think? > > > > > Because there is no API breakage for doing this, go right ahead. > > > > >> alex > > > > > -- > > > 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: Lift Authentication
Further to that example, no doubt someone will laugh at me for using database access on each request... However this is just an example! In reality I actually read from an LRU cache to save the database access. Cheers, Tim On 25/03/2009 15:08, "Timothy Perrett" wrote: > > Chad, > > We have HTTP Basic Auth and HTTP Digest Auth support in Lift. The > authentication is implemented as a partial function that you implement > like so: > > LiftRules.httpAuthProtectedResource.prepend { > case (ParsePath("api" :: _, _, _, _)) => Full(AuthRole("admin")) > } > > LiftRules.authentication = HttpBasicAuthentication("lift") { > case (username, password, req) => { > User.find(By(User.username, username)) match { > case Full(user) if user.password.match_?(password) => { > userRoles(AuthRole("admin")) > true > } > case _ => false > } > } > } > > Does that make things clearer for you? Essentially what happens is > this: > > user request (no auth) ==> challenge > user request (with auth) ==> sucsess (or challenge if incorrect) > > HTTP Digest is a lot more complex, if you need info on that, let me > know. > > Thanks > > Tim > > > On Mar 25, 2:42 pm, Chad Skinner wrote: >> Humm, I am learning something about HttpBasicAuthentication and need to look >> into this more. Is this method called for every request ... even before the >> user fills out the login form? > > > --~--~-~--~~~---~--~~ 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: File <-> Class naming
Hmm - Im a little skeptical. One of the nice things about Scala is that you don't need one source file per class... that really bugs me about Java. Can you be suscint about what stuff your splitting. Right now the codebase in lift feels "workable". I wouldnt want to see it split out into a jillion files... having to scroll through my big java code- bases is a royal pain in the backside. Cheers, Tim On Mar 25, 2:54 pm, Alex Boisvert wrote: > I'll wait a little more before I commit the changes in case others have > feedback. > > I'm working my way through building each project with Buildr... and I'll > give everybody a heads-up before I commit the changes. I suspect it will > affect between 15-25 files overall. > > alex > > 2009/3/25 David Pollak > > > > > On Tue, Mar 24, 2009 at 11:04 PM, Alex Boisvert wrote: > > >> Hi Lifters, > > >> How would you feel about renaming .scala files to match the main > >> class/trait in them? > > >> Let me give you a few examples, > > >> lift/src/main/scala/net/liftweb/http/auth/Authentication.scala > >> currently holds a trait named HttpAuthentication. > >> I'd like to rename it HttpAuthentication.scala > > >> lift/src/main/scala/net/liftweb/http/Stateful.scala > >> currently holds the StatefulSnippet trait, > >> so I'd like to rename it StatefulSnippet.scala > > >> lift/src/main/scala/net/liftweb/http/Vars.scala > >> contains many things but the main class is AnyVar > >> so I'd like to rename it AnyVar.scala > > >> and so on... > > >> There are two reasons I'd like to make these changes. First, I think it's > >> a good convention and it makes it easier to locate some of the main classes > >> more easily (my Java roots are showing) and second, which is much more > >> selfish at this point, is that Buildr does recompilation checks based on > >> file timestamps and the existence of a corresponding .class file in the > >> target directory and so it would help Buildr avoid recompiling everything > >> all the time even though nothing has really changed. > > >> (I do realize practically nobody besides me uses Buildr in the Lift > >> community at this point but I do intend to demonstrate that it's a great > >> alternative to Maven. And no, I'm not trying to replace or eradicate > >> Maven, > >> I'm just trying to make my own life simpler and share the results. I also > >> realize that it's likely scalac will have better recompilation detection in > >> the future that may make the second reason for this request irrelevant, > >> although I think the first reason is sufficient) > > >> What do you think? > > > Because there is no API breakage for doing this, go right ahead. > > >> alex > > > -- > > 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: Lift Authentication
Chad, We have HTTP Basic Auth and HTTP Digest Auth support in Lift. The authentication is implemented as a partial function that you implement like so: LiftRules.httpAuthProtectedResource.prepend { case (ParsePath("api" :: _, _, _, _)) => Full(AuthRole("admin")) } LiftRules.authentication = HttpBasicAuthentication("lift") { case (username, password, req) => { User.find(By(User.username, username)) match { case Full(user) if user.password.match_?(password) => { userRoles(AuthRole("admin")) true } case _ => false } } } Does that make things clearer for you? Essentially what happens is this: user request (no auth) ==> challenge user request (with auth) ==> sucsess (or challenge if incorrect) HTTP Digest is a lot more complex, if you need info on that, let me know. Thanks Tim On Mar 25, 2:42 pm, Chad Skinner wrote: > Humm, I am learning something about HttpBasicAuthentication and need to look > into this more. Is this method called for every request ... even before the > user fills out the login form? --~--~-~--~~~---~--~~ 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: File <-> Class naming
I'll wait a little more before I commit the changes in case others have feedback. I'm working my way through building each project with Buildr... and I'll give everybody a heads-up before I commit the changes. I suspect it will affect between 15-25 files overall. alex 2009/3/25 David Pollak > > > On Tue, Mar 24, 2009 at 11:04 PM, Alex Boisvert wrote: > >> Hi Lifters, >> >> How would you feel about renaming .scala files to match the main >> class/trait in them? >> >> Let me give you a few examples, >> >> lift/src/main/scala/net/liftweb/http/auth/Authentication.scala >> currently holds a trait named HttpAuthentication. >> I'd like to rename it HttpAuthentication.scala >> >> lift/src/main/scala/net/liftweb/http/Stateful.scala >> currently holds the StatefulSnippet trait, >> so I'd like to rename it StatefulSnippet.scala >> >> lift/src/main/scala/net/liftweb/http/Vars.scala >> contains many things but the main class is AnyVar >> so I'd like to rename it AnyVar.scala >> >> and so on... >> >> There are two reasons I'd like to make these changes. First, I think it's >> a good convention and it makes it easier to locate some of the main classes >> more easily (my Java roots are showing) and second, which is much more >> selfish at this point, is that Buildr does recompilation checks based on >> file timestamps and the existence of a corresponding .class file in the >> target directory and so it would help Buildr avoid recompiling everything >> all the time even though nothing has really changed. >> >> (I do realize practically nobody besides me uses Buildr in the Lift >> community at this point but I do intend to demonstrate that it's a great >> alternative to Maven. And no, I'm not trying to replace or eradicate Maven, >> I'm just trying to make my own life simpler and share the results. I also >> realize that it's likely scalac will have better recompilation detection in >> the future that may make the second reason for this request irrelevant, >> although I think the first reason is sufficient) >> >> What do you think? > > > Because there is no API breakage for doing this, go right ahead. > > >> >> >> alex >> >> >> >> > > > -- > 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: Lift Authentication
Humm, I am learning something about HttpBasicAuthentication and need to look into this more. Is this method called for every request ... even before the user fills out the login form? On Wed, Mar 25, 2009 at 9:26 AM, Derek Chen-Becker wrote: > Take a look at the HttpBasicAuthentication class: > > > http://scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scaladocs/net/liftweb/http/auth/HttpBasicAuthentication.html > > The constructor func you provide takes a (username : String, password : > String, req : Req) and returns a boolean. You should be able to use > Req.cookies to get at the passed cookies to determine if the user is logged > in. Let us know if that's not what you need. > > Derek > > > > On Wed, Mar 25, 2009 at 8:30 AM, Chad Skinner wrote: > >> I have been reading about Lift Authentication and the Authentication >> mechanism in OSGi and have a couple of questions and possibly feature >> requests. >> Is it possible to inspect a request to perform authentication before >> sending the 401 if a user is not authenticated? >> >> We use an authentication server that when a user logs in sets a cookie for >> our domain. I would like to be able to write a module that would inspect the >> users request to find this cookie and if found perform a call to the >> authentication server to determine if the user is still authenticated. If >> the user is authenticated I would like to be able to get the user's roles >> from the authentication and bypass the authentication request and grant >> access. If the user is not authenticated then they would be prompted for >> their username and password and the authentication would be handled by the >> authentication server. >> >> Basically, what this provides is a mechanism where you can integrate the >> authentication into single sign on systems (Glassfish allows you to do >> something similar with JSR-196). >> >> Thanks, >> -- Chad >> >> >> > > > > --~--~-~--~~~---~--~~ 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: State and binding
So, are the sessions replicated or do you lose active connections if a node goes down? I agree I don't have a problem with server session state ... the only problem I have is we originally used JSF for a number of our applications and I hate the reliance on POST in order to submit the serialized state. There is no reason in my mind not to support GET and keep the session information on the server .. For this LIFT seems a good fit. Not lift related, but does anyone know of an inexpensive load balancer that works well and would support session affinity? The only reason I ask is that I would like to replace our current software LB with a hardware device and with the budget cuts due to the economy I need something that will work well with relatively small loads and that is cost effective. -- Chad On Wed, Mar 25, 2009 at 8:58 AM, Viktor Klang wrote: > Hi Chad! > > Lift is intended to be clustered using a load-balancer with > session-affinity, which means that no session replication is needed unless a > node goes down. > > From only having almost a decade of web-framework development experience, I > fully support the notion of having the session state serverside for highly > interactive rich internet applications. > Not only does it simplify development and enhance security, but it enables > a whole lot of shortcuts not available for share-nothing approaches. > > That being said, I am a very big proponent for the REST model, which Lift > is _very_ competent in providing an API for you to use, for ROA/REST needs. > > From what you may gather from this e-mail, I strongly believe in using the > right tools for each job. > > Does this answer help you? > > Cheers, > Viktor > > > On Wed, Mar 25, 2009 at 2:46 PM, Chad Skinner wrote: > >> Not know much about lift yet and wanting to learn more, what is stored in the server session for a simple application? I am assuming it is used by the binder to store the generated form field names so the submitted fields can be rebound ... what other state does the framework store in it? >>> >>> Any SessionVars are held in Session state. Bindings from HTML elements >>> to functions are held in Session state. Bindings between Comet Actors and >>> the HTML the represents them in held in Session state. >>> >>> >> >> Thanks for the information, I believe that the documentation states that >> lift has its own session system and that it does not use the servers session >> ... if this is true and you are running two redundant servers, will the >> servers session replication / clustering copy the Lift session? >> >> State/session replication in a large cluster can cause problems, but for >> our situation I don't see server state as being a problem as long as it is >> minimal and replicates in clusters. >> >> I went to the Colorado Software Summit last year and went to a couple of >> presentations by Yan Pujante and was very impressed by what they are doing >> at linked-in. He presented a couple of sessions one on OSGi and the issues >> they are solving or hoping to solve with it as well as the obstacles they >> have encountered. Also, he did a presentation on their new security / >> authentication system which was very interesting. One thing he mentioned was >> that they were moving to a stateless environment, where the only state that >> is maintained is that of the authenticated user object. >> >> Working for a school district I can say that Linked-in's world is ... well >> different ... they have over 400 developers we have 2 ... they have I >> believe he said 600 web servers ... we have two. Server state for us ... not >> really a problem and I'd be happy if my development is easier, quicker and I >> can better meet the needs of our users in a timely fashion. >> >> >> > > > -- > Viktor Klang > Senior Systems Analyst > > > > > --~--~-~--~~~---~--~~ 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: lift:Menu.group
Please don't shoot me for bringing this up again. I still don't think the current behavior of Menu.item makes sense. If the user doesn't want that link to appear on the page, then they shouldn't include in its source. Most people put text around their link: | | which, on foo2, would render as _foo1_ | | _foo3_ or For a good time click here. For a not so good time click here. which, on foo2, would render as For a good time _click here_. For a not so good time . Regards, Bradford On Mar 25, 7:53 am, bradford wrote: > David, you're right that needing to surround the element text of a > with span is a unique case and should be a custom snippet. I've > removed the span now and think that Derek's addition of "always" would > be just what I need. Adding group="foo" to Menu.builder would suffice > as well. > > Thanks for the tips, Chas. > > Derek, if you do add "always" can you please let me know so that I can > update my code. > > Thanks, > Bradford > > On Mar 24, 10:37 pm, Derek Chen-Becker wrote: > > > The general case is that a page won't link to itself, I think, which is why > > the default isn't to show it when the page matches. Unless anyone has > > objections I can add an "always" attribute. As for #1, the Menu.item makes a > > link using whatever the contents of the Menu.item tag are for the link text: > > > Go here > > > should become > > > Go here > > > Am I misunderstanding what you're looking for there? As for #2, you should > > be able to add a class using the prefixed attribute: > > > > > > In this context, li_item is the menu item that matches the current page. > > With Menu.group, you can specify the binding template: > > > > > > > > > > > > > > But there's no provision to do anything special for the current page. > > > Let me know if that's not sufficient or if I'm misunderstanding your > > requirement. > > > Derek > > > On Tue, Mar 24, 2009 at 3:50 PM, bradford wrote: > > > > Thanks for the clarification, David, and for your snippet, Derek. > > > > I think adding an "always" attribute to Menu.item would be very > > > beneficial. I still don't understand why that's not its default > > > behavior. > > > > It looks like I will not be able to use any of lift's Menu tags at > > > this time, because 1) I need to surround the item text with span and > > > 2) I need a way to add class="active" to the li_item. Both are not > > > possible with Menu.item, Menu.group, or Menu.builder. Let me know if > > > I am mistaken. If I am not not, may I put in a feature request for > > > these items. For the time being I will just hard code it as follows > > > (which is not a big deal to me at this time): > > > > > > > Foo1 > > > Foo2 > > > Foo3 > > > > > > > Thanks again for the great support :) > > > > Bradford > > > > On Mar 24, 12:08 pm, David Pollak > > > wrote: > > > > On Tue, Mar 24, 2009 at 9:02 AM, Charles F. Munat > > > wrote: > > > > > > David Pollak wrote: > > > > > > What's the best practice: > > > > > > > For more information about . For > > > more > > > > > > information about . > > > > > > > Or > > > > > > > For more information about foo1. For more > > > > > > information about foo2. > > > > > > > The latter. This allows you to move the pages around on the > > > filesystem > > > > > > without having to grep through all you source files looking for what > > > > > > needs to be changed. > > > > > > Am I missing something, or did you mean the former? > > > > > D'oh! That brain-finger connection is always getting messed up. I > > > > meant > > > > the former. Thanks for correcting me! > > > > > > Chas. > > > > > -- > > > > 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: File <-> Class naming
Same here; I like the convenience of placing various related classes in the same file. alex 2009/3/25 Derek Chen-Becker > I think that it's a good idea. I actually like the Java convention of > naming the source file after the main class for the reason you mention > (locating code). I do, however, like the flexibility that Scala has about > being able to put minor classes along in the same file, so I wouldn't want > to make the requirement as strict as Java does. > > Derek > > > On Wed, Mar 25, 2009 at 1:04 AM, Alex Boisvert wrote: > >> Hi Lifters, >> >> How would you feel about renaming .scala files to match the main >> class/trait in them? >> >> Let me give you a few examples, >> >> lift/src/main/scala/net/liftweb/http/auth/Authentication.scala >> currently holds a trait named HttpAuthentication. >> I'd like to rename it HttpAuthentication.scala >> >> lift/src/main/scala/net/liftweb/http/Stateful.scala >> currently holds the StatefulSnippet trait, >> so I'd like to rename it StatefulSnippet.scala >> >> lift/src/main/scala/net/liftweb/http/Vars.scala >> contains many things but the main class is AnyVar >> so I'd like to rename it AnyVar.scala >> >> and so on... >> >> There are two reasons I'd like to make these changes. First, I think it's >> a good convention and it makes it easier to locate some of the main classes >> more easily (my Java roots are showing) and second, which is much more >> selfish at this point, is that Buildr does recompilation checks based on >> file timestamps and the existence of a corresponding .class file in the >> target directory and so it would help Buildr avoid recompiling everything >> all the time even though nothing has really changed. >> >> (I do realize practically nobody besides me uses Buildr in the Lift >> community at this point but I do intend to demonstrate that it's a great >> alternative to Maven. And no, I'm not trying to replace or eradicate Maven, >> I'm just trying to make my own life simpler and share the results. I also >> realize that it's likely scalac will have better recompilation detection in >> the future that may make the second reason for this request irrelevant, >> although I think the first reason is sufficient) >> >> What do you think? >> >> alex >> >> >> >> > > > > --~--~-~--~~~---~--~~ 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: Lift Authentication
Take a look at the HttpBasicAuthentication class: http://scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scaladocs/net/liftweb/http/auth/HttpBasicAuthentication.html The constructor func you provide takes a (username : String, password : String, req : Req) and returns a boolean. You should be able to use Req.cookies to get at the passed cookies to determine if the user is logged in. Let us know if that's not what you need. Derek On Wed, Mar 25, 2009 at 8:30 AM, Chad Skinner wrote: > I have been reading about Lift Authentication and the Authentication > mechanism in OSGi and have a couple of questions and possibly feature > requests. > Is it possible to inspect a request to perform authentication before > sending the 401 if a user is not authenticated? > > We use an authentication server that when a user logs in sets a cookie for > our domain. I would like to be able to write a module that would inspect the > users request to find this cookie and if found perform a call to the > authentication server to determine if the user is still authenticated. If > the user is authenticated I would like to be able to get the user's roles > from the authentication and bypass the authentication request and grant > access. If the user is not authenticated then they would be prompted for > their username and password and the authentication would be handled by the > authentication server. > > Basically, what this provides is a mechanism where you can integrate the > authentication into single sign on systems (Glassfish allows you to do > something similar with JSR-196). > > Thanks, > -- Chad > > > > --~--~-~--~~~---~--~~ 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: File <-> Class naming
I think that it's a good idea. I actually like the Java convention of naming the source file after the main class for the reason you mention (locating code). I do, however, like the flexibility that Scala has about being able to put minor classes along in the same file, so I wouldn't want to make the requirement as strict as Java does. Derek On Wed, Mar 25, 2009 at 1:04 AM, Alex Boisvert wrote: > Hi Lifters, > > How would you feel about renaming .scala files to match the main > class/trait in them? > > Let me give you a few examples, > > lift/src/main/scala/net/liftweb/http/auth/Authentication.scala > currently holds a trait named HttpAuthentication. > I'd like to rename it HttpAuthentication.scala > > lift/src/main/scala/net/liftweb/http/Stateful.scala > currently holds the StatefulSnippet trait, > so I'd like to rename it StatefulSnippet.scala > > lift/src/main/scala/net/liftweb/http/Vars.scala > contains many things but the main class is AnyVar > so I'd like to rename it AnyVar.scala > > and so on... > > There are two reasons I'd like to make these changes. First, I think it's > a good convention and it makes it easier to locate some of the main classes > more easily (my Java roots are showing) and second, which is much more > selfish at this point, is that Buildr does recompilation checks based on > file timestamps and the existence of a corresponding .class file in the > target directory and so it would help Buildr avoid recompiling everything > all the time even though nothing has really changed. > > (I do realize practically nobody besides me uses Buildr in the Lift > community at this point but I do intend to demonstrate that it's a great > alternative to Maven. And no, I'm not trying to replace or eradicate Maven, > I'm just trying to make my own life simpler and share the results. I also > realize that it's likely scalac will have better recompilation detection in > the future that may make the second reason for this request irrelevant, > although I think the first reason is sufficient) > > What do you think? > > alex > > > > > --~--~-~--~~~---~--~~ 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: JPA Archetype error
That's a really weird error. Could you post up the XHTML source that you're getting so we can try to find what the parse error is? Thanks, Derek On Tue, Mar 24, 2009 at 10:49 PM, Randinn wrote: > > I fetched the JPA Archetype, maven installed it, cd'd to web, did a > mvn jetty:run and got this error in firefox. So in got into Netbeans > and did the same thing, I know I did something wrong, just what. > > > XML Parsing Error: junk after document element > Location: http://localhost:9090/ > Line Number 4, Column 3:Welcome to the super duper > catalog! > ^ > > > > --~--~-~--~~~---~--~~ 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: What a difference a CPU makes
Yeah, the iostat indicates very little disk activity, and since my machine is running servers for web, email and VPN what I'm seeing could be entirely unrelated to the build. As a comparison, my laptop (Dell Precision M4300) with an Intel Core Duo T7700 and 4GB of memory builds in about 8:30. That's a 32-bit JVM, so maybe I should run 32 bit on my desktop to see if that makes a difference. My suspicion is that because the Athlon X2 4200+ has no L3 cache (128K L1, 512K L2) it's having to go to main memory a lot. The T7700 has 4MB L2 per core and the Phenom has 6MB L3 shared across cores. How does my current 7 minute build time compare with other people's experience? Derek On Wed, Mar 25, 2009 at 8:52 AM, David Pollak wrote: > Weird. My 2133 is running at 1.2 Ghz and has an 800Mhz (at best) memory > speed. My experience with Lift builds on machines with a lot of memory is > that there's almost no disk access... everything is cached. > > > On Wed, Mar 25, 2009 at 6:32 AM, Derek Chen-Becker > wrote: > >> Ubuntu 8.10 x64. Java is >> >> java version "1.6.0_12" >> Java(TM) SE Runtime Environment (build 1.6.0_12-b04) >> Java HotSpot(TM) 64-Bit Server VM (build 11.2-b01, mixed mode) >> >> Here's AMD's rundown of the difference between the CPUs: >> >> http://products.amd.com/en-us/DesktopCPUSideBySide.aspx?id=522&id=59 >> >> Note that I'm still using the original AM2 motherboard with the same >> DDR2-800 memory. The fact that it's AM2 means that the Phenom is downgrading >> its HyperTransport to the same speed as the Athlon X2 for bus access. >> >> I suppose I could benchmark it to see how it performs for other tasks. I'm >> not sure how much an SSD would help. I'll run a build and monitor iostat to >> see how much data transfer goes to/from the HDDs, but my machine typically >> runs a file cache of about 800-900MB of memory (6GB total), so I would >> suspect that most of what maven needs gets sucked into the cache. >> >> Derek >> >> On Wed, Mar 25, 2009 at 6:38 AM, David Pollak < >> feeder.of.the.be...@gmail.com> wrote: >> >>> Derek, >>> What OS are you running? The old numbers are worse than my HP 2133 >>> Netbook which clocks in at 15 minutes for a full Lift build. >>> >>> Thanks, >>> >>> David >>> >>> On Tue, Mar 24, 2009 at 7:42 PM, Derek Chen-Becker < >>> dchenbec...@gmail.com> wrote: >>> I just wanted to throw this out there in case anyone else is considering new hardware. I had an Athlon X2 4200+ powering my dev box (6GB of ram, 2 x RAID 1 SATA drives) and average build time for a "mvn clean install" for the entire liftweb project was roughly 17 minutes and 45 seconds. I just upgraded to a Phenom X3 720 (no change in any other hardware) and my build times are now about 7 minutes! I'm guessing that the L3 cache on the Phenom is a huge part of that, but I'm sure that the increased clock and newer core are helping a bit. Derek >>> >>> >>> -- >>> 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 >>> >>> >>> >> >> >> > > > -- > 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: State and binding
Hi Chad! Lift is intended to be clustered using a load-balancer with session-affinity, which means that no session replication is needed unless a node goes down. >From only having almost a decade of web-framework development experience, I fully support the notion of having the session state serverside for highly interactive rich internet applications. Not only does it simplify development and enhance security, but it enables a whole lot of shortcuts not available for share-nothing approaches. That being said, I am a very big proponent for the REST model, which Lift is _very_ competent in providing an API for you to use, for ROA/REST needs. >From what you may gather from this e-mail, I strongly believe in using the right tools for each job. Does this answer help you? Cheers, Viktor On Wed, Mar 25, 2009 at 2:46 PM, Chad Skinner wrote: > >>> Not know much about lift yet and wanting to learn more, what is stored in >>> the server session for a simple application? I am assuming it is used by the >>> binder to store the generated form field names so the submitted fields can >>> be rebound ... what other state does the framework store in it? >>> >> >> Any SessionVars are held in Session state. Bindings from HTML elements to >> functions are held in Session state. Bindings between Comet Actors and the >> HTML the represents them in held in Session state. >> >> > > Thanks for the information, I believe that the documentation states that > lift has its own session system and that it does not use the servers session > ... if this is true and you are running two redundant servers, will the > servers session replication / clustering copy the Lift session? > > State/session replication in a large cluster can cause problems, but for > our situation I don't see server state as being a problem as long as it is > minimal and replicates in clusters. > > I went to the Colorado Software Summit last year and went to a couple of > presentations by Yan Pujante and was very impressed by what they are doing > at linked-in. He presented a couple of sessions one on OSGi and the issues > they are solving or hoping to solve with it as well as the obstacles they > have encountered. Also, he did a presentation on their new security / > authentication system which was very interesting. One thing he mentioned was > that they were moving to a stateless environment, where the only state that > is maintained is that of the authenticated user object. > > Working for a school district I can say that Linked-in's world is ... well > different ... they have over 400 developers we have 2 ... they have I > believe he said 600 web servers ... we have two. Server state for us ... not > really a problem and I'd be happy if my development is easier, quicker and I > can better meet the needs of our users in a timely fashion. > > > > -- Viktor Klang Senior Systems Analyst --~--~-~--~~~---~--~~ 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: What a difference a CPU makes
Weird. My 2133 is running at 1.2 Ghz and has an 800Mhz (at best) memory speed. My experience with Lift builds on machines with a lot of memory is that there's almost no disk access... everything is cached. On Wed, Mar 25, 2009 at 6:32 AM, Derek Chen-Becker wrote: > Ubuntu 8.10 x64. Java is > > java version "1.6.0_12" > Java(TM) SE Runtime Environment (build 1.6.0_12-b04) > Java HotSpot(TM) 64-Bit Server VM (build 11.2-b01, mixed mode) > > Here's AMD's rundown of the difference between the CPUs: > > http://products.amd.com/en-us/DesktopCPUSideBySide.aspx?id=522&id=59 > > Note that I'm still using the original AM2 motherboard with the same > DDR2-800 memory. The fact that it's AM2 means that the Phenom is downgrading > its HyperTransport to the same speed as the Athlon X2 for bus access. > > I suppose I could benchmark it to see how it performs for other tasks. I'm > not sure how much an SSD would help. I'll run a build and monitor iostat to > see how much data transfer goes to/from the HDDs, but my machine typically > runs a file cache of about 800-900MB of memory (6GB total), so I would > suspect that most of what maven needs gets sucked into the cache. > > Derek > > On Wed, Mar 25, 2009 at 6:38 AM, David Pollak < > feeder.of.the.be...@gmail.com> wrote: > >> Derek, >> What OS are you running? The old numbers are worse than my HP 2133 >> Netbook which clocks in at 15 minutes for a full Lift build. >> >> Thanks, >> >> David >> >> On Tue, Mar 24, 2009 at 7:42 PM, Derek Chen-Becker > > wrote: >> >>> I just wanted to throw this out there in case anyone else is considering >>> new hardware. I had an Athlon X2 4200+ powering my dev box (6GB of ram, 2 x >>> RAID 1 SATA drives) and average build time for a "mvn clean install" for the >>> entire liftweb project was roughly 17 minutes and 45 seconds. I just >>> upgraded to a Phenom X3 720 (no change in any other hardware) and my build >>> times are now about 7 minutes! I'm guessing that the L3 cache on the Phenom >>> is a huge part of that, but I'm sure that the increased clock and newer core >>> are helping a bit. >>> >>> Derek >>> >>> >>> >> >> >> -- >> 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 >> >> >> > > > > -- 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: State and binding
> > >> Not know much about lift yet and wanting to learn more, what is stored in >> the server session for a simple application? I am assuming it is used by the >> binder to store the generated form field names so the submitted fields can >> be rebound ... what other state does the framework store in it? >> > > Any SessionVars are held in Session state. Bindings from HTML elements to > functions are held in Session state. Bindings between Comet Actors and the > HTML the represents them in held in Session state. > > Thanks for the information, I believe that the documentation states that lift has its own session system and that it does not use the servers session ... if this is true and you are running two redundant servers, will the servers session replication / clustering copy the Lift session? State/session replication in a large cluster can cause problems, but for our situation I don't see server state as being a problem as long as it is minimal and replicates in clusters. I went to the Colorado Software Summit last year and went to a couple of presentations by Yan Pujante and was very impressed by what they are doing at linked-in. He presented a couple of sessions one on OSGi and the issues they are solving or hoping to solve with it as well as the obstacles they have encountered. Also, he did a presentation on their new security / authentication system which was very interesting. One thing he mentioned was that they were moving to a stateless environment, where the only state that is maintained is that of the authenticated user object. Working for a school district I can say that Linked-in's world is ... well different ... they have over 400 developers we have 2 ... they have I believe he said 600 web servers ... we have two. Server state for us ... not really a problem and I'd be happy if my development is easier, quicker and I can better meet the needs of our users in a timely fashion. --~--~-~--~~~---~--~~ 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] Lift Authentication
I have been reading about Lift Authentication and the Authentication mechanism in OSGi and have a couple of questions and possibly feature requests. Is it possible to inspect a request to perform authentication before sending the 401 if a user is not authenticated? We use an authentication server that when a user logs in sets a cookie for our domain. I would like to be able to write a module that would inspect the users request to find this cookie and if found perform a call to the authentication server to determine if the user is still authenticated. If the user is authenticated I would like to be able to get the user's roles from the authentication and bypass the authentication request and grant access. If the user is not authenticated then they would be prompted for their username and password and the authentication would be handled by the authentication server. Basically, what this provides is a mechanism where you can integrate the authentication into single sign on systems (Glassfish allows you to do something similar with JSR-196). Thanks, -- Chad --~--~-~--~~~---~--~~ 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: What a difference a CPU makes
Oh, here's a reactor summary for the build, too: [INFO] [INFO] [INFO] Reactor Summary: [INFO] [INFO] Lift .. SUCCESS [3.498s] [INFO] Lift Utils SUCCESS [1:01.814s] [INFO] Lift WebKit ... SUCCESS [49.402s] [INFO] Lift Mapper ... SUCCESS [1:00.879s] [INFO] Lift Machine .. SUCCESS [10.671s] [INFO] Lift Record ... SUCCESS [14.150s] [INFO] Lift Textile .. SUCCESS [25.412s] [INFO] Lift Facebook . SUCCESS [12.501s] [INFO] Lift AMQP . SUCCESS [4.882s] [INFO] Lift XMPP . SUCCESS [6.818s] [INFO] Lift Widgets .. SUCCESS [22.352s] [INFO] Lift OpenID ... SUCCESS [8.920s] [INFO] Lift OAuth SUCCESS [0.432s] [INFO] Lift PayPal ... SUCCESS [10.385s] [INFO] Lift TestKit .. SUCCESS [9.351s] [INFO] Lift Core (full lift) . SUCCESS [0.638s] [INFO] Lift Sites SUCCESS [0.405s] [INFO] Lift Example .. SUCCESS [29.820s] [INFO] Skittr Example SUCCESS [13.762s] [INFO] HelloLift example application . SUCCESS [9.769s] [INFO] HelloDarwin tutorial application .. SUCCESS [11.500s] [INFO] JPA Demo Master ... SUCCESS [0.209s] [INFO] JPADemo-spa ... SUCCESS [15.445s] [INFO] JPADemo-web ... SUCCESS [13.409s] [INFO] HTTP Authentication example ... SUCCESS [5.147s] [INFO] lift-archetype-blank .. SUCCESS [17.842s] [INFO] lift-archetype-basic .. SUCCESS [21.273s] [INFO] lift-archetype-jpa-basic .. SUCCESS [0.452s] [INFO] [INFO] [INFO] BUILD SUCCESSFUL [INFO] [INFO] Total time: 7 minutes 23 seconds [INFO] Finished at: Wed Mar 25 06:35:34 MST 2009 [INFO] Final Memory: 80M/488M [INFO] de...@rocky:/home/software/liftweb$ Lift webkit, utils and mapper are by far the biggest chunks of the build. Derek On Wed, Mar 25, 2009 at 7:32 AM, Derek Chen-Becker wrote: > Ubuntu 8.10 x64. Java is > > java version "1.6.0_12" > Java(TM) SE Runtime Environment (build 1.6.0_12-b04) > Java HotSpot(TM) 64-Bit Server VM (build 11.2-b01, mixed mode) > > Here's AMD's rundown of the difference between the CPUs: > > http://products.amd.com/en-us/DesktopCPUSideBySide.aspx?id=522&id=59 > > Note that I'm still using the original AM2 motherboard with the same > DDR2-800 memory. The fact that it's AM2 means that the Phenom is downgrading > its HyperTransport to the same speed as the Athlon X2 for bus access. > > I suppose I could benchmark it to see how it performs for other tasks. I'm > not sure how much an SSD would help. I'll run a build and monitor iostat to > see how much data transfer goes to/from the HDDs, but my machine typically > runs a file cache of about 800-900MB of memory (6GB total), so I would > suspect that most of what maven needs gets sucked into the cache. > > Derek > > > On Wed, Mar 25, 2009 at 6:38 AM, David Pollak < > feeder.of.the.be...@gmail.com> wrote: > >> Derek, >> What OS are you running? The old numbers are worse than my HP 2133 >> Netbook which clocks in at 15 minutes for a full Lift build. >> >> Thanks, >> >> David >> >> On Tue, Mar 24, 2009 at 7:42 PM, Derek Chen-Becker > > wrote: >> >>> I just wanted to throw this out there in case anyone else is considering >>> new hardware. I had an Athlon X2 4200+ powering my dev box (6GB of ram, 2 x >>> RAID 1 SATA drives) and average build time for a "mvn clean install" for the >>> entire liftweb project was roughly 17 minutes and 45 seconds. I just >>> upgraded to a Phenom X3 720 (no change in any other hardware) and my build >>> times are now about 7 minutes! I'm guessing that the L3 cache on the Phenom >>> is a huge part of that, but I'm sure that the increased clock and newer core >>> are helping a bit. >>> >>> Derek >>> >>> >>> >
[Lift] Re: What a difference a CPU makes
Ubuntu 8.10 x64. Java is java version "1.6.0_12" Java(TM) SE Runtime Environment (build 1.6.0_12-b04) Java HotSpot(TM) 64-Bit Server VM (build 11.2-b01, mixed mode) Here's AMD's rundown of the difference between the CPUs: http://products.amd.com/en-us/DesktopCPUSideBySide.aspx?id=522&id=59 Note that I'm still using the original AM2 motherboard with the same DDR2-800 memory. The fact that it's AM2 means that the Phenom is downgrading its HyperTransport to the same speed as the Athlon X2 for bus access. I suppose I could benchmark it to see how it performs for other tasks. I'm not sure how much an SSD would help. I'll run a build and monitor iostat to see how much data transfer goes to/from the HDDs, but my machine typically runs a file cache of about 800-900MB of memory (6GB total), so I would suspect that most of what maven needs gets sucked into the cache. Derek On Wed, Mar 25, 2009 at 6:38 AM, David Pollak wrote: > Derek, > What OS are you running? The old numbers are worse than my HP 2133 Netbook > which clocks in at 15 minutes for a full Lift build. > > Thanks, > > David > > On Tue, Mar 24, 2009 at 7:42 PM, Derek Chen-Becker > wrote: > >> I just wanted to throw this out there in case anyone else is considering >> new hardware. I had an Athlon X2 4200+ powering my dev box (6GB of ram, 2 x >> RAID 1 SATA drives) and average build time for a "mvn clean install" for the >> entire liftweb project was roughly 17 minutes and 45 seconds. I just >> upgraded to a Phenom X3 720 (no change in any other hardware) and my build >> times are now about 7 minutes! I'm guessing that the L3 cache on the Phenom >> is a huge part of that, but I'm sure that the increased clock and newer core >> are helping a bit. >> >> Derek >> >> >> > > > -- > 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: State and binding
On Wed, Mar 25, 2009 at 6:15 AM, Chad Skinner wrote: > So, in my experience and to my mind, the "tenet" of minimizing server-side >> state is broken and wrong. State should placed where it is (1) most secure >> and (2) leads to the most responsive apps. >> > > Not know much about lift yet and wanting to learn more, what is stored in > the server session for a simple application? I am assuming it is used by the > binder to store the generated form field names so the submitted fields can > be rebound ... what other state does the framework store in it? > Any SessionVars are held in Session state. Bindings from HTML elements to functions are held in Session state. Bindings between Comet Actors and the HTML the represents them in held in Session state. > > > > -- 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: State and binding
> > So, in my experience and to my mind, the "tenet" of minimizing server-side > state is broken and wrong. State should placed where it is (1) most secure > and (2) leads to the most responsive apps. > Not know much about lift yet and wanting to learn more, what is stored in the server session for a simple application? I am assuming it is used by the binder to store the generated form field names so the submitted fields can be rebound ... what other state does the framework store in it? --~--~-~--~~~---~--~~ 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: AJAX and IE6. No love.
Wow! Great write-up. I think this has applicability in a number of my other projects. :-) On Tue, Mar 24, 2009 at 8:53 PM, Daniel Mueller wrote: > > I'm not sure that this is of any help or even applies to lift, but we > had once a very similar situation with a corporate application. > Difference was that the problem occurred when you were working slower. > Here's the description of the problem and what the reason was. When we > ran our application in on dev servers, everything was working fine, > never any problems, never the server unavailable message. Even on the > test servers for the client there was never any problem and everything > was working fine, even though this time the app was using HTTPS. When > we put the application into production (HTTPS as well), we received > complaints similar to yours. Ok, differences between dev/test and > prod? Almost none, server setup the same (tomcat/apache at the time), > same OS, same build. Differences were only in network routing and that > the production was using a loadbalancer. Now that load balancer was a > pretty expensive piece of hardware, we used sticky sessions and the > app was built that it should even be able to handle session failover > gracefully (only cashing stuff in the session). And strangely we still > couldn't reproduce the bug even though the allowed us to test in the > production environment... > Now the fun started. It took some time to actually reproduce the bug, > because it happened only if you waited long enough on a page that is > using AJAX. It took a couple of minutes of waiting (doing nothing that > triggers AJAX) on a page before you could get the server unavailable > message when starting to use AJAX again which had to timeout as well > first. The wait time is not completely unreasonable (if you got a > complex form to fill, that's a reasonable time, depending on how your > site is structured) and after that, the AJAX part of the page was dead > (only reload could get you going again). > After being able to reproduce the bug, we set to find the source of > the problem. It turned out that the following things happened: Apache > has a configured connection pool and a configured connection keepalive > (sent in HTTP response header). It doesn't honor the keepalive though, > as long as you have enough spare connections in the pool (it'll simply > keep the timed out connections active). The loadbalancer on the other > hand is not that friendly and shuts the connections down after the > configured keepalive times out. That's the reason why it never showed > in dev and test and only with the loadbalancer (which is advertised as > being transparent) in place. > Ok, interesting story so far, but why does IE6 barf on it, connection > closing shouldn't be the end of the world, it happens often enough. > The problem is that IE6 automatic removal of SSLd keepalive > connections is seriously broken. It actually tries to reuse timed out > connections from the internal connection pool (IIRC, also see [1], or > google), which will not get you anywhere on the server, because the > connection has been shut down. > Resolution for us was to set the keepalive to a high value (half an > hour or so, the default is 300/5 minutes). This was also partially > because we were not allowed to touch the configuration of the > loadbalancer. [1] describes a different solution. > To find the problem we used SysInternals TCPView (free) to find out > what the issue was on the network, but that got us only that far. The > missing piece was SysInternals TDIMon (free), that showed us IE6s > internal connection pool events. TDIMon seems to be discontinued (at > least I couldn't find it on the site), and I haven't had to use it in > a while, so I don't know which application is actually filling the gap > or whether you can download it somewhere else (I don't know if the old > version is Vista compatible but it worked fine on XP). > > Hope that helps and that you find a solution (that was one of the > harder bugs I ever had to track down, thus the extensive writeup). > > Cheers, > -D > > [1] http://extjs.com/forum/showthread.php?t=45673 > [2] http://technet.microsoft.com/en-us/sysinternals/default.aspx > > On Mar 25, 2:22 am, "Charles F. Munat" wrote: > > I have a survey online that updates the server via AJAX when individual > > form fields are blurred. Works beautifully in Firefox, Opera, IE7, etc. > > > > But in IE6 there are some serious problems. Unfortunately, the users of > > this survey are corporate, and some of them are forced to use IE6 (DEATH > > to lazy sysadmins!). What happens is that the saves sometimes work, and > > other times do not. Occasionally, a "server unavailable message" pops > > up, and after that nothing seems to work. I have a couple of customers > > who are very seriously pissed off because they've had to re-enter data > > four and five times. > > > > I suspect that this has something to do with IE6 limitations wrt number > > of browse
[Lift] Re: newbie issue
thanks! --~--~-~--~~~---~--~~ 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: Absolute Beginner
On Tue, Mar 24, 2009 at 9:35 PM, Randinn wrote: > > Are there any plans for some tutorials/info for people that have no > programming experience (at least none in the last decade)? Sorry. Lift requires basic knowledge of Scala as well as some ability to do stuff at the command line. > > > > > -- 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: File <-> Class naming
On Tue, Mar 24, 2009 at 11:04 PM, Alex Boisvert wrote: > Hi Lifters, > > How would you feel about renaming .scala files to match the main > class/trait in them? > > Let me give you a few examples, > > lift/src/main/scala/net/liftweb/http/auth/Authentication.scala > currently holds a trait named HttpAuthentication. > I'd like to rename it HttpAuthentication.scala > > lift/src/main/scala/net/liftweb/http/Stateful.scala > currently holds the StatefulSnippet trait, > so I'd like to rename it StatefulSnippet.scala > > lift/src/main/scala/net/liftweb/http/Vars.scala > contains many things but the main class is AnyVar > so I'd like to rename it AnyVar.scala > > and so on... > > There are two reasons I'd like to make these changes. First, I think it's > a good convention and it makes it easier to locate some of the main classes > more easily (my Java roots are showing) and second, which is much more > selfish at this point, is that Buildr does recompilation checks based on > file timestamps and the existence of a corresponding .class file in the > target directory and so it would help Buildr avoid recompiling everything > all the time even though nothing has really changed. > > (I do realize practically nobody besides me uses Buildr in the Lift > community at this point but I do intend to demonstrate that it's a great > alternative to Maven. And no, I'm not trying to replace or eradicate Maven, > I'm just trying to make my own life simpler and share the results. I also > realize that it's likely scalac will have better recompilation detection in > the future that may make the second reason for this request irrelevant, > although I think the first reason is sufficient) > > What do you think? Because there is no API breakage for doing this, go right ahead. > > > alex > > > > > -- 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: State and binding
On Tue, Mar 24, 2009 at 5:38 PM, Alex wrote: > With Lift > > 1) Form submits: B2345235DSFGA = "Long agonizing post" > 2) Function mapping has been cleared. Application panics and has no > idea what that junk was. > 1. This is an empirically wrong statement. Test it out. 2. A fair number of Lift apps are in the wild and the kind of problem that you're imaging is very rare. 3. When this kind of problem does happen (the front page of the travel site which is a stateless page rather than something that is part of a user's session), there are simple ways to deal with the situation, but these are exceptions rather than the rule. 4. There is nothing in Lift that stops you from putting stable form field names on a page and extracting them with S.param(field_name) 5. This is Lift's design... to make the common things easier and to allow the developer to fall back to guts of HTTP when necessary. 6. This list is for helping newbies become seasoned and for learning from people's real-world use to Lift in order to enhance Lift. 7. I'd suggest not pushing on this issue any more until you've built an app and seen how Lift works in practice. Thanks, David -- 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: What a difference a CPU makes
Derek, What OS are you running? The old numbers are worse than my HP 2133 Netbook which clocks in at 15 minutes for a full Lift build. Thanks, David On Tue, Mar 24, 2009 at 7:42 PM, Derek Chen-Becker wrote: > I just wanted to throw this out there in case anyone else is considering > new hardware. I had an Athlon X2 4200+ powering my dev box (6GB of ram, 2 x > RAID 1 SATA drives) and average build time for a "mvn clean install" for the > entire liftweb project was roughly 17 minutes and 45 seconds. I just > upgraded to a Phenom X3 720 (no change in any other hardware) and my build > times are now about 7 minutes! I'm guessing that the L3 cache on the Phenom > is a huge part of that, but I'm sure that the increased clock and newer core > are helping a bit. > > Derek > > > > -- 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: lift:Menu.group
David, you're right that needing to surround the element text of a with span is a unique case and should be a custom snippet. I've removed the span now and think that Derek's addition of "always" would be just what I need. Adding group="foo" to Menu.builder would suffice as well. Thanks for the tips, Chas. Derek, if you do add "always" can you please let me know so that I can update my code. Thanks, Bradford On Mar 24, 10:37 pm, Derek Chen-Becker wrote: > The general case is that a page won't link to itself, I think, which is why > the default isn't to show it when the page matches. Unless anyone has > objections I can add an "always" attribute. As for #1, the Menu.item makes a > link using whatever the contents of the Menu.item tag are for the link text: > > Go here > > should become > > Go here > > Am I misunderstanding what you're looking for there? As for #2, you should > be able to add a class using the prefixed attribute: > > > > In this context, li_item is the menu item that matches the current page. > With Menu.group, you can specify the binding template: > > > > > > > > But there's no provision to do anything special for the current page. > > Let me know if that's not sufficient or if I'm misunderstanding your > requirement. > > Derek > > On Tue, Mar 24, 2009 at 3:50 PM, bradford wrote: > > > Thanks for the clarification, David, and for your snippet, Derek. > > > I think adding an "always" attribute to Menu.item would be very > > beneficial. I still don't understand why that's not its default > > behavior. > > > It looks like I will not be able to use any of lift's Menu tags at > > this time, because 1) I need to surround the item text with span and > > 2) I need a way to add class="active" to the li_item. Both are not > > possible with Menu.item, Menu.group, or Menu.builder. Let me know if > > I am mistaken. If I am not not, may I put in a feature request for > > these items. For the time being I will just hard code it as follows > > (which is not a big deal to me at this time): > > > > > Foo1 > > Foo2 > > Foo3 > > > > > Thanks again for the great support :) > > > Bradford > > > On Mar 24, 12:08 pm, David Pollak > > wrote: > > > On Tue, Mar 24, 2009 at 9:02 AM, Charles F. Munat > > wrote: > > > > > David Pollak wrote: > > > > > What's the best practice: > > > > > > For more information about . For > > more > > > > > information about . > > > > > > Or > > > > > > For more information about foo1. For more > > > > > information about foo2. > > > > > > The latter. This allows you to move the pages around on the > > filesystem > > > > > without having to grep through all you source files looking for what > > > > > needs to be changed. > > > > > Am I missing something, or did you mean the former? > > > > D'oh! That brain-finger connection is always getting messed up. I meant > > > the former. Thanks for correcting me! > > > > > Chas. > > > > -- > > > 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: What a difference a CPU makes
I've wanted to try a solid-state disk for a while. All but the cheapest systems you can buy these days are Core 2 Duo with 2+ GB of decently fast RAM (i.e. you can get a decent dual-core laptop with 2 GB of RAM that will run Ubuntu like a champ for ~$500). It seems like the real way to boost performance on a machine like that is to get a much faster disk. Warren On Tue, Mar 24, 2009 at 7:42 PM, Derek Chen-Becker wrote: > I just wanted to throw this out there in case anyone else is considering new > hardware. --~--~-~--~~~---~--~~ 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] Absolute Beginner
Are there any plans for some tutorials/info for people that have no programming experience (at least none in the last decade)? --~--~-~--~~~---~--~~ 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: AJAX and IE6. No love.
I'm not sure that this is of any help or even applies to lift, but we had once a very similar situation with a corporate application. Difference was that the problem occurred when you were working slower. Here's the description of the problem and what the reason was. When we ran our application in on dev servers, everything was working fine, never any problems, never the server unavailable message. Even on the test servers for the client there was never any problem and everything was working fine, even though this time the app was using HTTPS. When we put the application into production (HTTPS as well), we received complaints similar to yours. Ok, differences between dev/test and prod? Almost none, server setup the same (tomcat/apache at the time), same OS, same build. Differences were only in network routing and that the production was using a loadbalancer. Now that load balancer was a pretty expensive piece of hardware, we used sticky sessions and the app was built that it should even be able to handle session failover gracefully (only cashing stuff in the session). And strangely we still couldn't reproduce the bug even though the allowed us to test in the production environment... Now the fun started. It took some time to actually reproduce the bug, because it happened only if you waited long enough on a page that is using AJAX. It took a couple of minutes of waiting (doing nothing that triggers AJAX) on a page before you could get the server unavailable message when starting to use AJAX again which had to timeout as well first. The wait time is not completely unreasonable (if you got a complex form to fill, that's a reasonable time, depending on how your site is structured) and after that, the AJAX part of the page was dead (only reload could get you going again). After being able to reproduce the bug, we set to find the source of the problem. It turned out that the following things happened: Apache has a configured connection pool and a configured connection keepalive (sent in HTTP response header). It doesn't honor the keepalive though, as long as you have enough spare connections in the pool (it'll simply keep the timed out connections active). The loadbalancer on the other hand is not that friendly and shuts the connections down after the configured keepalive times out. That's the reason why it never showed in dev and test and only with the loadbalancer (which is advertised as being transparent) in place. Ok, interesting story so far, but why does IE6 barf on it, connection closing shouldn't be the end of the world, it happens often enough. The problem is that IE6 automatic removal of SSLd keepalive connections is seriously broken. It actually tries to reuse timed out connections from the internal connection pool (IIRC, also see [1], or google), which will not get you anywhere on the server, because the connection has been shut down. Resolution for us was to set the keepalive to a high value (half an hour or so, the default is 300/5 minutes). This was also partially because we were not allowed to touch the configuration of the loadbalancer. [1] describes a different solution. To find the problem we used SysInternals TCPView (free) to find out what the issue was on the network, but that got us only that far. The missing piece was SysInternals TDIMon (free), that showed us IE6s internal connection pool events. TDIMon seems to be discontinued (at least I couldn't find it on the site), and I haven't had to use it in a while, so I don't know which application is actually filling the gap or whether you can download it somewhere else (I don't know if the old version is Vista compatible but it worked fine on XP). Hope that helps and that you find a solution (that was one of the harder bugs I ever had to track down, thus the extensive writeup). Cheers, -D [1] http://extjs.com/forum/showthread.php?t=45673 [2] http://technet.microsoft.com/en-us/sysinternals/default.aspx On Mar 25, 2:22 am, "Charles F. Munat" wrote: > I have a survey online that updates the server via AJAX when individual > form fields are blurred. Works beautifully in Firefox, Opera, IE7, etc. > > But in IE6 there are some serious problems. Unfortunately, the users of > this survey are corporate, and some of them are forced to use IE6 (DEATH > to lazy sysadmins!). What happens is that the saves sometimes work, and > other times do not. Occasionally, a "server unavailable message" pops > up, and after that nothing seems to work. I have a couple of customers > who are very seriously pissed off because they've had to re-enter data > four and five times. > > I suspect that this has something to do with IE6 limitations wrt number > of browser connections available to AJAX. If they slow down a little, > the problem diminishes. > > Anyone ever try something like this before? Anyone have any suggestions? > Why only IE6? Is there a workaround? (I can't afford to rebuild the > whole thing for one or two people.) > > Thanks! > > Chas. --~--~-
[Lift] JPA Archetype error
I fetched the JPA Archetype, maven installed it, cd'd to web, did a mvn jetty:run and got this error in firefox. So in got into Netbeans and did the same thing, I know I did something wrong, just what. XML Parsing Error: junk after document element Location: http://localhost:9090/ Line Number 4, Column 3:Welcome to the super duper catalog! ^ --~--~-~--~~~---~--~~ 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: State and binding
> > I agree that this is a nasty behavior. One could say that it's the > user's responsibility to keep track of their session time, but I don't > subscribe to that. I try to make my sites as user friendly as possible. Try telling anyone in marketing, user experience, or anyone not in tech that it's user's fault they didn't keep track of their session. ick. If 100ms load time can affect stickiness (as studies have revealed) imagine what returning an error or no results from a search just because the user didn't search in time. I for one know I dumped several travel sites because of their poor behavior in this regard. > > Another scenario is that the session doesn't expire, and the user walks > away from the terminal without closing the browser. You still expire the session and force the user to login. You just avoid losing their work. > There is no reason you can't temporarily store form data -- if I can > store a GET, you can store a POST -- and then if the user chooses to log > back in, redirect and repopulate the form ... Why more sites don't do this is > beyond me. It's not a difficult > programming task. As far as I can tell, this is not possible with lift. The association of the POST data with any particular object or field is gone once the session expires so the submitted values are useless. > > Another option is to store form data as it's entered. I have a survey > site that does this right now (albeit with some bugginess). Put it in a > temporary table. Then when the user logs back in, give him the option to > return to the form and complete it, or delete the partial form data, or > leave it for later. Auto-save or manually saving to a database is fine, but I don't think it address the issue. --~--~-~--~~~---~--~~ 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: State and binding
> State is maintained on the app server, not pawned > off to some other place. This leads to better scalability characteristics. > The developer deals with higher level abstractions than dissecting the HTTP > request and reconstituting state. I have just seen to many "Sorry your session expired and we lost everything" messages in my lifetime. Those result in lost sales, lost leads, lost posts, lost users, and just general pain, and they are usually unnecessary since there is often very little state. I would love to be able to work the way Lift is designed - it's definitely better for the developer. It's that I want to be forgiving to the way the web works. With lift the state doesn't seem recoverable, even in cases where it is trivial to do so, or where the entire interesting state was an empty object. > PS -- The reason that everybody hits a wall with moderate volume Rails apps > is that the fantasy of stateless stacks devolve into a pile of dog poop when > actually tested against the amazingly fragile run-time that is Ruby. I came to Scala because I didn't like Rails or Ruby, so no argument about that part. I did like Merb though. Most apps I have written were stateless inasmuch as they could be. I agree it's not always fun, but it makes things far more reliable. I can go back to a form generated 2 weeks ago and submit it and it still works. You don't always want that but usually you do. For instance, if I'm on the home page of a reservation system and haven't reloaded for 2 weeks, I put in my dates of travel and cities, I want it to work. I don't want an error page and then have it be incapable of even redisplaying the form with my fields filled out. You will lose a large percentage of users at that point. Unfortunately that's the way most travel sites work. Believe me, I would love the above to not be the case or if there is some workaround you can suggest. I love Scala and I like a lot of things about Lift so far. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---