Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Lift evolved: New in 2.4 and the road ahead

Lift evolved: New in 2.4 and the road ahead

Lift presentation at Scala Days 2012 (18/04/2012 @ London)

Indrajit Raychaudhuri

April 18, 2012
Tweet

More Decks by Indrajit Raychaudhuri

Other Decks in Technology

Transcript

  1. Retaining NodeSeq helps in secure type-safe transformation Page generation is

    functional and type-safe Simple transformation as NodeSeq => NodeSeq And not, say, just () => String Lift: The Scala Companion
  2. But dive deeper and deal with HTTP and HTML Higher

    Level Abstraction Page compositions UI behaviors Helpers Lift: The Scala Companion
  3. Simple ≠ Easy after all, ‘tis about correctness Steeper Learning

    Curve (compared to MVC based frameworks) But you cruise once you hit the plateau Lift: The Scala Companion
  4. Grab the readily available ones, or build your own Lift:

    The Core Tenets Lift's Abstraction are generalized With sane readily usable defaults
  5. Lift: The Core Tenets Lift's Responses are XSS Safe ".name

    *" #> "<script>alert('hi');</script>"
  6. Lift: The Core Tenets Elegant Comet support Requests multiplexed through

    single request Requests are versioned Auto-detects containers for best fit
  7. Lift: The Core Tenets Secure and maintainable REST support object

    MyRestHelper extends RestHelper { serve { case "api" :: "user" :: AsLong(id) :: _ XmlGet _ => <b>ID:{id}</b> case "api" :: "user" :: AsLong(id) :: _ JsonGet _ => JInt(id) case "api" :: "user" :: AsLong(id) :: _ XmlGet _ => RestContinuation.async { reply => for { i <- lengthyCompute(id) } reply(<x>{i}</x>) } }
  8. Lift: The Core Tenets Secure and maintainable REST support //

    Stateful LiftRules.dispatch.append(MyRestHandler) // Stateless (choose one!) LiftRules.statelessDispatch.append(MyRestHandler)
  9. Lift: The Core Tenets Designer friendly Templates <!DOCTYPE html> <html>

    <head><title>Home</title></head> <body> <div class="lift:surround?with=default;at=content"> <h2>Welcome to Awesome website!</h2> <div class="lift:helloWorld.howdy"> Current time: <span id="time">Time goes here</span> </div> </div> </body> </html>
  10. Lift: The Core Tenets Designer friendly Templates class HelloWorld {

    def howdy = "#time" #> Helpers.formattedTimeNow }
  11. Lift: Evolved in 2.4 CSS Selector Transforms got better syntax

    <span><span id="event"/></span> "#event" #> "Scaladays 2012" <span>Scala Days 2012</span>
  12. Lift: Evolved in 2.4 CSS Selector Transforms got better syntax

    <span><span id="event"/></span> "#event *" #> "Scala Days 2012" <span><span id="event">Scala Days 2012</span></span>
  13. Lift: Evolved in 2.4 CSS Selector Transforms got better syntax

    <a href="#" id="event">Scala Days 2012</a> "#event [href]" #> "http://days2012.scala-lang.org" <a href="http://days2012.scala-lang.org" id="event">Scala Days 2012</a>
  14. Lift: Evolved in 2.4 CSS Selector Transforms got better syntax

    <span class="cool" id="event">Scala Days 2012</span> "#event [class+]" #> "fancy" <span class="cool fancy" id="event">Scala Days 2012</span>
  15. Lift: Evolved in 2.4 CSS Selector Transforms got better syntax

    <span><span id="event"/></span> "#event" #> List("Scala ", "Days ", "2012") <span>Scala Days 2012</span>
  16. Lift: Evolved in 2.4 CSS Selector Transforms got better syntax

    <table><tr class="r"><td class="c">???</td></tr></table> ".r *" #> (".c *" #> "Scala") <table><tr class="r"><td class="c">Scala</td></tr></table>
  17. Lift: Evolved in 2.4 Stateless or Stateful – you decide

    trait StatelessBehavior { def statelessDispatch: PartialFunction[String, NodeSeq => NodeSeq] }
  18. Lift: Evolved in 2.4 Utilities and Helper updates JSON Serializer

    improvements Mailer improvements BsonDSL additions to JsonDSL Build system on SBT
  19. Lift: The Upcoming Refinements Netty support giter8, lifty templates Explore

    Scala 2.10 support Likely have to drop 2.8 support
  20. Lift: The Upcoming Moar Refinements Modules’ owned and supported by

    community Comply with upstream libraries Long deprecation for bolted-in JS libraries H5BP, Bootstrap support