SlideShare a Scribd company logo
Introducing Lift Web Framework




       Rishi Khandelwal
       Software Consultant
       Knoldus Software LLP
       Email : rishi@knoldus.com
Introduction

    Lift is a free web application framework.

    It was originally created by David Pollack

    It provides web application developers tools to make writing
    security, interacting, scalable web applications easier

    Lift uses Scala as programming language.

    It does not use MVC pattern.

    It uses View first approach.
Design goals

SECURITY : Whenever you make an AJAX call, use Comet, or even build a
           simple form, Lift replaces input names and URLs with opaque
           GUIDs that reference specific functions on the server.


CONCISENESS : As Lift uses Scala as a programming laguage, and scala's
              code is very concise. So Lift has this property


PERFORMANCE : It is very quick. Using the basic Lift project, you can expect
              upward of 300 requests per second on a machine with only
              1 GB of RAM and a middle-of-the-road processor.
View-first design

    Lift’s view-first approach does the complete opposite of MVC pattern

    It first chooses the view and then determines what dynamic content needs
    to be included on that page.

    The three component parts are view, snippet, and model—VSM for short


    Execute command                                Apply / commit
                                  Snippet

                    Change Notification     Error notices

            View                                            Model

.
Continued...
View :     It refers primarily to the HTML content served for a page request.
           Within any given Lift application, you can have two types of view:
           1. Template views that bind dynamic content into a predefined
              markup template
           2. Generated views in which dynamic content is created, typically
              with Scala XML literals

Snippet : Snippets are rendering functions that take XML input from within a
           given page template and then transform that input based upon the
           logic within the snippet function.


Model :    For most applications, it will represent a model of persistence or
           Data. You ask the model for value x, and it returns it.
Lift Sub-projects

Lift is broken down into three top-level subprojects:
Lift Core and Lift Web, Lift Persistence, and Lift Modules.

1.. Lift Core and Lift Web :

    The Core consists of four projects that build to separate libraries that you
    can use both with and without Lift’s Web module.

    The Web module itself builds upon the Core.

    The Web module itself is made up of three projects: the base web systems
    and two additional projects that provide specialized helpers.
Continued...
  Lift Web
             Wizard                     TestKit

                          Webkit


 Lift Core
              Utilities
                                 JSON
                Actor

                        Common
Continued...
LIFT COMMON :

    It contains a few base classes that are common to everything else within
    Lift.

   Probably most important of all, Lift Common can be used in projects
that aren’t even web applications.

LIFT ACTOR :

    Actors are a model for concurrent programming whereby asynchronous
    messaging is used in place of directly working with threads and locks.

    Lift has its own for the specific domain of web development.

    Lift Actor provides concrete implementations of the base actor traits that are
    found within Lift Common
Continued...
LIFT UTILITIES :

    Lift Utilities is a collection of classes, traits, and objects that are designed to
    save you time or provide convenience mechanisms for dealing with
    common paradigms.

LIFT JSON :

    Lift JSON provides an almost standalone package for handling JSON in
    highly performant way.

    The parser included within Lift JSON is approximately 350 times faster than
    the JSON parser that’s included in the Scala standard library

LIFT WEBKIT :

    The WebKit module is where Lift holds its entire pipeline, from request
    processing right down to localization and template rendering.
2. Lift Persistence :

    It is some kind of backend storage.

    It provides you with a number of options for saving your data,whether it’s a
    relational database management system (RDBMS) or one of the new
    NoSQL solutions.

    There are three foundations for persistence :

LIFT DB AND MAPPER :

    It provides communication with an RDBMS of some description,

    Mapper provides you with an object-relational mapping (ORM)
    implementation that handles all the usual relationship tasks
Continued...
eg. User.find(By(User.email, "foo@bar.com"))
    User.find(By(User.birthday, new Date("Jan 4, 1975")))


LIFT JPA :

    It is Java Persistence API.

    This module was added to Lift’s persistence options to wrap the JPA API
    and give it a more idiomatic Scala feel

LIFT RECORD :

    Record was designed with the idea that persistence has common idioms no
    matter what the actual backend implementation was doing to interact with
    the data.
Continued...
Record is a layer that gives users create, read, update, and delete (CRUD)
  semantics and a set of helpers for displaying form fields, operating
  validation, and so forth.

Record has 3 backend implementation modules as part of the framework:
1. NoSQL document-orientated storage system CouchDB
2. second for the NoSQL data store MongoDB
3.layer on top of Squeryl ,the highly sophisticated functional persistence library.

3. Lift Modules :

Lift Modules is where the project houses all the extensions to the core
    framework.
Unlike the other groups of subprojects within Lift, the modules are more
    organic and have little or no relation to one another.
Each module is generally self-contained regarding the functionality it provides.
Project structure
project
src
 main
  scala
     bootstrap
       liftweb
         Boot.scala
     code
      comet
      lib
      model
      snippet
      view
  resources
  webapp
    WEB-INF/web.xml
    css
    images
    templates-hidden
    index.html
 test
Boot.scala
class Boot {
 def boot {
   // where to search snippet
   LiftRules.addToPackages("code")

  // Build SiteMap
  val entries = List(
    Menu.i("Home") / "index", // the simple way to declare a menu

   // more complex because this menu allows anything in the
   // /static path to be visible
   Menu(Loc("Static", Link(List("static"), true, "/static/index"),
         "Static Content")))

  // set the sitemap. Note if you don't want access control for
  // each page, just comment this line out.
  LiftRules.setSiteMap(SiteMap(entries:_*))

  //Show the spinny image when an Ajax call starts
  LiftRules.ajaxStart =
    Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd)
Continued...

 // Make the spinny image go away when it ends
    LiftRules.ajaxEnd =
     Full(() => LiftRules.jsArtifacts.hide("ajax-loader").cmd)


         // Force the request to be UTF-8
         LiftRules.early.append(_.setCharacterEncoding("UTF-8"))

         // Use HTML5 for rendering
         LiftRules.htmlProperties.default.set((r: Req) =>
           new Html5Properties(r.userAgent))

         //Init the jQuery module, see http://liftweb.net/jquery for more information.
         LiftRules.jsArtifacts = JQueryArtifacts
         JQueryModule.InitParam.JQuery=JQueryModule.JQuery172
         JQueryModule.init()
     }
 }
Index.html
<div id="main" class="lift:surround?with=default;at=content">
    <form class="lift:Process?form=post">
            Name: <input id="name"><br> Age: <input id="age"
                value="0"><br> <input type="submit" value="Submit"
                id="submit">
    </form>
</div>

default.html
<span class="lift:Menu.builder"></span>

<div class="lift:Msgs?showAll=true"></div>

<div class="column span-17 last">
     <div id="content">The main content will get bound here</div>
</div>
Process.scala
object Process {

 var name = ""
 var age = "0"
 def render = {

     // define some variables to put our values into

     "#name" #> SHtml.text(name, name = _) & // set the name

      // set the age variable if we can convert to an Int
      "#age" #> SHtml.text(age, age = _) &

      // when the form is submitted, process the variable
      "#submit" #> SHtml.onSubmitUnit(process)
 }
Continued...

// process the form
  private def process() =
   asInt(age) match {
     case Full(a) if a < 13 => S.error("Too young!")
     case Full(a) => {
       S.notice("Name: " + name)
       S.notice("Age: " + a)
     }
     case _ => S.error("Age doesn't parse as a number")
   }

}
Intro lift

More Related Content

What's hot

Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVC
John Lewis
 
Spring MVC 5 & Hibernate 5 Integration
Spring MVC 5 & Hibernate 5 IntegrationSpring MVC 5 & Hibernate 5 Integration
Spring MVC 5 & Hibernate 5 Integration
Majurageerthan Arumugathasan
 
26 top angular 8 interview questions to know in 2020 [www.full stack.cafe]
26 top angular 8 interview questions to know in 2020   [www.full stack.cafe]26 top angular 8 interview questions to know in 2020   [www.full stack.cafe]
26 top angular 8 interview questions to know in 2020 [www.full stack.cafe]
Alex Ershov
 
MVC on the server and on the client
MVC on the server and on the clientMVC on the server and on the client
MVC on the server and on the client
Sebastiano Armeli
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
ASG
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
NexThoughts Technologies
 
Next stop: Spring 4
Next stop: Spring 4Next stop: Spring 4
Next stop: Spring 4
Oleg Tsal-Tsalko
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
tola99
 
[2015/2016] The REST architectural style
[2015/2016] The REST architectural style[2015/2016] The REST architectural style
[2015/2016] The REST architectural style
Ivano Malavolta
 
Marlabs - ASP.NET Concepts
Marlabs - ASP.NET ConceptsMarlabs - ASP.NET Concepts
Marlabs - ASP.NET Concepts
Marlabs
 
Introduction to Ibatis by Rohit
Introduction to Ibatis by RohitIntroduction to Ibatis by Rohit
Introduction to Ibatis by Rohit
Rohit Prabhakar
 
jsf2 Notes
jsf2 Notesjsf2 Notes
jsf2 Notes
Rajiv Gupta
 
Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011
grandyho
 
Leverage Hibernate and Spring Features Together
Leverage Hibernate and Spring Features TogetherLeverage Hibernate and Spring Features Together
Leverage Hibernate and Spring Features Together
Edureka!
 
Spring notes
Spring notesSpring notes
Spring notes
Rajeev Uppala
 
Angularj2.0
Angularj2.0Angularj2.0
Angularj2.0
Mallikarjuna G D
 
Jspprogramming
JspprogrammingJspprogramming
Jspprogramming
Mallikarjuna G D
 
Jsp with mvc
Jsp with mvcJsp with mvc
Jsp with mvc
vamsitricks
 
Introducing Ruby/MVC/RoR
Introducing Ruby/MVC/RoRIntroducing Ruby/MVC/RoR
Introducing Ruby/MVC/RoR
Sumanth krishna
 
Java Basics
Java BasicsJava Basics
Java Basics
Khan625
 

What's hot (20)

Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVC
 
Spring MVC 5 & Hibernate 5 Integration
Spring MVC 5 & Hibernate 5 IntegrationSpring MVC 5 & Hibernate 5 Integration
Spring MVC 5 & Hibernate 5 Integration
 
26 top angular 8 interview questions to know in 2020 [www.full stack.cafe]
26 top angular 8 interview questions to know in 2020   [www.full stack.cafe]26 top angular 8 interview questions to know in 2020   [www.full stack.cafe]
26 top angular 8 interview questions to know in 2020 [www.full stack.cafe]
 
MVC on the server and on the client
MVC on the server and on the clientMVC on the server and on the client
MVC on the server and on the client
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
 
Next stop: Spring 4
Next stop: Spring 4Next stop: Spring 4
Next stop: Spring 4
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
 
[2015/2016] The REST architectural style
[2015/2016] The REST architectural style[2015/2016] The REST architectural style
[2015/2016] The REST architectural style
 
Marlabs - ASP.NET Concepts
Marlabs - ASP.NET ConceptsMarlabs - ASP.NET Concepts
Marlabs - ASP.NET Concepts
 
Introduction to Ibatis by Rohit
Introduction to Ibatis by RohitIntroduction to Ibatis by Rohit
Introduction to Ibatis by Rohit
 
jsf2 Notes
jsf2 Notesjsf2 Notes
jsf2 Notes
 
Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011
 
Leverage Hibernate and Spring Features Together
Leverage Hibernate and Spring Features TogetherLeverage Hibernate and Spring Features Together
Leverage Hibernate and Spring Features Together
 
Spring notes
Spring notesSpring notes
Spring notes
 
Angularj2.0
Angularj2.0Angularj2.0
Angularj2.0
 
Jspprogramming
JspprogrammingJspprogramming
Jspprogramming
 
Jsp with mvc
Jsp with mvcJsp with mvc
Jsp with mvc
 
Introducing Ruby/MVC/RoR
Introducing Ruby/MVC/RoRIntroducing Ruby/MVC/RoR
Introducing Ruby/MVC/RoR
 
Java Basics
Java BasicsJava Basics
Java Basics
 

Viewers also liked

FitNesse With Scala
FitNesse With ScalaFitNesse With Scala
FitNesse With Scala
Knoldus Inc.
 
Scala style-guide
Scala style-guideScala style-guide
Scala style-guide
Knoldus Inc.
 
Testing akka-actors
Testing akka-actorsTesting akka-actors
Testing akka-actors
Knoldus Inc.
 
Fitnesse Testing Framework
Fitnesse Testing Framework Fitnesse Testing Framework
Fitnesse Testing Framework
Ajit Koti
 
Data Structures In Scala
Data Structures In ScalaData Structures In Scala
Data Structures In Scala
Knoldus Inc.
 
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
Knoldus Inc.
 
Getting Started With AureliaJs
Getting Started With AureliaJsGetting Started With AureliaJs
Getting Started With AureliaJs
Knoldus Inc.
 
Intoduction to Play Framework
Intoduction to Play FrameworkIntoduction to Play Framework
Intoduction to Play Framework
Knoldus Inc.
 
Purely Functional Data Structures in Scala
Purely Functional Data Structures in ScalaPurely Functional Data Structures in Scala
Purely Functional Data Structures in Scala
Vladimir Kostyukov
 
Functional programming in Javascript
Functional programming in JavascriptFunctional programming in Javascript
Functional programming in Javascript
Knoldus Inc.
 
Domain-driven design
Domain-driven designDomain-driven design
Domain-driven design
Knoldus Inc.
 
Advanced Functional Programming in Scala
Advanced Functional Programming in ScalaAdvanced Functional Programming in Scala
Advanced Functional Programming in Scala
Patrick Nicolas
 
Functors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In ScalaFunctors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In Scala
Knoldus Inc.
 

Viewers also liked (13)

FitNesse With Scala
FitNesse With ScalaFitNesse With Scala
FitNesse With Scala
 
Scala style-guide
Scala style-guideScala style-guide
Scala style-guide
 
Testing akka-actors
Testing akka-actorsTesting akka-actors
Testing akka-actors
 
Fitnesse Testing Framework
Fitnesse Testing Framework Fitnesse Testing Framework
Fitnesse Testing Framework
 
Data Structures In Scala
Data Structures In ScalaData Structures In Scala
Data Structures In Scala
 
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
 
Getting Started With AureliaJs
Getting Started With AureliaJsGetting Started With AureliaJs
Getting Started With AureliaJs
 
Intoduction to Play Framework
Intoduction to Play FrameworkIntoduction to Play Framework
Intoduction to Play Framework
 
Purely Functional Data Structures in Scala
Purely Functional Data Structures in ScalaPurely Functional Data Structures in Scala
Purely Functional Data Structures in Scala
 
Functional programming in Javascript
Functional programming in JavascriptFunctional programming in Javascript
Functional programming in Javascript
 
Domain-driven design
Domain-driven designDomain-driven design
Domain-driven design
 
Advanced Functional Programming in Scala
Advanced Functional Programming in ScalaAdvanced Functional Programming in Scala
Advanced Functional Programming in Scala
 
Functors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In ScalaFunctors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In Scala
 

Similar to Intro lift

Lightning web components
Lightning web components Lightning web components
Lightning web components
Cloud Analogy
 
Onion Architecture with S#arp
Onion Architecture with S#arpOnion Architecture with S#arp
Onion Architecture with S#arp
Gary Pedretti
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
hchen1
 
.NET,ASP .NET, Angular Js,LinQ
.NET,ASP .NET, Angular Js,LinQ.NET,ASP .NET, Angular Js,LinQ
.NET,ASP .NET, Angular Js,LinQ
Avijit Shaw
 
Synopsis
SynopsisSynopsis
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
GDSC UofT Mississauga
 
Ruby On Rails Siddhesh
Ruby On Rails SiddheshRuby On Rails Siddhesh
Ruby On Rails Siddhesh
Siddhesh Bhobe
 
iPhone Web Development and Ruby On Rails
iPhone Web Development and Ruby On RailsiPhone Web Development and Ruby On Rails
iPhone Web Development and Ruby On Rails
Jose de Leon
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
tutorialsruby
 
Build Comet applications using Scala, Lift, and &lt;b>jQuery&lt;/b>
Build Comet applications using Scala, Lift, and &lt;b>jQuery&lt;/b>Build Comet applications using Scala, Lift, and &lt;b>jQuery&lt;/b>
Build Comet applications using Scala, Lift, and &lt;b>jQuery&lt;/b>
tutorialsruby
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
SaleemMalik52
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
Balint Erdi
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
Rob Davarnia
 
Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatia
sapientindia
 
Code igniter - A brief introduction
Code igniter - A brief introductionCode igniter - A brief introduction
Code igniter - A brief introduction
Commit University
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technology
Minal Maniar
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails Basics
Amit Solanki
 
Rails interview questions
Rails interview questionsRails interview questions
Rails interview questions
Durgesh Tripathi
 
Building reusable components as micro frontends with glimmer js and webcompo...
Building reusable components as micro frontends  with glimmer js and webcompo...Building reusable components as micro frontends  with glimmer js and webcompo...
Building reusable components as micro frontends with glimmer js and webcompo...
Andrei Sebastian Cîmpean
 
Ruby Rails Web Development
Ruby Rails Web DevelopmentRuby Rails Web Development
Ruby Rails Web Development
Sonia Simi
 

Similar to Intro lift (20)

Lightning web components
Lightning web components Lightning web components
Lightning web components
 
Onion Architecture with S#arp
Onion Architecture with S#arpOnion Architecture with S#arp
Onion Architecture with S#arp
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
.NET,ASP .NET, Angular Js,LinQ
.NET,ASP .NET, Angular Js,LinQ.NET,ASP .NET, Angular Js,LinQ
.NET,ASP .NET, Angular Js,LinQ
 
Synopsis
SynopsisSynopsis
Synopsis
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
 
Ruby On Rails Siddhesh
Ruby On Rails SiddheshRuby On Rails Siddhesh
Ruby On Rails Siddhesh
 
iPhone Web Development and Ruby On Rails
iPhone Web Development and Ruby On RailsiPhone Web Development and Ruby On Rails
iPhone Web Development and Ruby On Rails
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
Build Comet applications using Scala, Lift, and &lt;b>jQuery&lt;/b>
Build Comet applications using Scala, Lift, and &lt;b>jQuery&lt;/b>Build Comet applications using Scala, Lift, and &lt;b>jQuery&lt;/b>
Build Comet applications using Scala, Lift, and &lt;b>jQuery&lt;/b>
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
 
Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatia
 
Code igniter - A brief introduction
Code igniter - A brief introductionCode igniter - A brief introduction
Code igniter - A brief introduction
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technology
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails Basics
 
Rails interview questions
Rails interview questionsRails interview questions
Rails interview questions
 
Building reusable components as micro frontends with glimmer js and webcompo...
Building reusable components as micro frontends  with glimmer js and webcompo...Building reusable components as micro frontends  with glimmer js and webcompo...
Building reusable components as micro frontends with glimmer js and webcompo...
 
Ruby Rails Web Development
Ruby Rails Web DevelopmentRuby Rails Web Development
Ruby Rails Web Development
 

More from Knoldus Inc.

Managing State & HTTP Requests In Ionic.
Managing State & HTTP Requests In Ionic.Managing State & HTTP Requests In Ionic.
Managing State & HTTP Requests In Ionic.
Knoldus Inc.
 
Facilitation Skills - When to Use and Why.pptx
Facilitation Skills - When to Use and Why.pptxFacilitation Skills - When to Use and Why.pptx
Facilitation Skills - When to Use and Why.pptx
Knoldus Inc.
 
Performance Testing at Scale Techniques for High-Volume Services
Performance Testing at Scale Techniques for High-Volume ServicesPerformance Testing at Scale Techniques for High-Volume Services
Performance Testing at Scale Techniques for High-Volume Services
Knoldus Inc.
 
Snowflake and its features (Presentation)
Snowflake and its features (Presentation)Snowflake and its features (Presentation)
Snowflake and its features (Presentation)
Knoldus Inc.
 
Terratest - Automation testing of infrastructure
Terratest - Automation testing of infrastructureTerratest - Automation testing of infrastructure
Terratest - Automation testing of infrastructure
Knoldus Inc.
 
Getting Started with Apache Spark (Scala)
Getting Started with Apache Spark (Scala)Getting Started with Apache Spark (Scala)
Getting Started with Apache Spark (Scala)
Knoldus Inc.
 
Secure practices with dot net services.pptx
Secure practices with dot net services.pptxSecure practices with dot net services.pptx
Secure practices with dot net services.pptx
Knoldus Inc.
 
Distributed Cache with dot microservices
Distributed Cache with dot microservicesDistributed Cache with dot microservices
Distributed Cache with dot microservices
Knoldus Inc.
 
Introduction to gRPC Presentation (Java)
Introduction to gRPC Presentation (Java)Introduction to gRPC Presentation (Java)
Introduction to gRPC Presentation (Java)
Knoldus Inc.
 
Using InfluxDB for real-time monitoring in Jmeter
Using InfluxDB for real-time monitoring in JmeterUsing InfluxDB for real-time monitoring in Jmeter
Using InfluxDB for real-time monitoring in Jmeter
Knoldus Inc.
 
Intoduction to KubeVela Presentation (DevOps)
Intoduction to KubeVela Presentation (DevOps)Intoduction to KubeVela Presentation (DevOps)
Intoduction to KubeVela Presentation (DevOps)
Knoldus Inc.
 
Stakeholder Management (Project Management) Presentation
Stakeholder Management (Project Management) PresentationStakeholder Management (Project Management) Presentation
Stakeholder Management (Project Management) Presentation
Knoldus Inc.
 
Introduction To Kaniko (DevOps) Presentation
Introduction To Kaniko (DevOps) PresentationIntroduction To Kaniko (DevOps) Presentation
Introduction To Kaniko (DevOps) Presentation
Knoldus Inc.
 
Efficient Test Environments with Infrastructure as Code (IaC)
Efficient Test Environments with Infrastructure as Code (IaC)Efficient Test Environments with Infrastructure as Code (IaC)
Efficient Test Environments with Infrastructure as Code (IaC)
Knoldus Inc.
 
Exploring Terramate DevOps (Presentation)
Exploring Terramate DevOps (Presentation)Exploring Terramate DevOps (Presentation)
Exploring Terramate DevOps (Presentation)
Knoldus Inc.
 
Clean Code in Test Automation Differentiating Between the Good and the Bad
Clean Code in Test Automation  Differentiating Between the Good and the BadClean Code in Test Automation  Differentiating Between the Good and the Bad
Clean Code in Test Automation Differentiating Between the Good and the Bad
Knoldus Inc.
 
Integrating AI Capabilities in Test Automation
Integrating AI Capabilities in Test AutomationIntegrating AI Capabilities in Test Automation
Integrating AI Capabilities in Test Automation
Knoldus Inc.
 
State Management with NGXS in Angular.pptx
State Management with NGXS in Angular.pptxState Management with NGXS in Angular.pptx
State Management with NGXS in Angular.pptx
Knoldus Inc.
 
Authentication in Svelte using cookies.pptx
Authentication in Svelte using cookies.pptxAuthentication in Svelte using cookies.pptx
Authentication in Svelte using cookies.pptx
Knoldus Inc.
 
OAuth2 Implementation Presentation (Java)
OAuth2 Implementation Presentation (Java)OAuth2 Implementation Presentation (Java)
OAuth2 Implementation Presentation (Java)
Knoldus Inc.
 

More from Knoldus Inc. (20)

Managing State & HTTP Requests In Ionic.
Managing State & HTTP Requests In Ionic.Managing State & HTTP Requests In Ionic.
Managing State & HTTP Requests In Ionic.
 
Facilitation Skills - When to Use and Why.pptx
Facilitation Skills - When to Use and Why.pptxFacilitation Skills - When to Use and Why.pptx
Facilitation Skills - When to Use and Why.pptx
 
Performance Testing at Scale Techniques for High-Volume Services
Performance Testing at Scale Techniques for High-Volume ServicesPerformance Testing at Scale Techniques for High-Volume Services
Performance Testing at Scale Techniques for High-Volume Services
 
Snowflake and its features (Presentation)
Snowflake and its features (Presentation)Snowflake and its features (Presentation)
Snowflake and its features (Presentation)
 
Terratest - Automation testing of infrastructure
Terratest - Automation testing of infrastructureTerratest - Automation testing of infrastructure
Terratest - Automation testing of infrastructure
 
Getting Started with Apache Spark (Scala)
Getting Started with Apache Spark (Scala)Getting Started with Apache Spark (Scala)
Getting Started with Apache Spark (Scala)
 
Secure practices with dot net services.pptx
Secure practices with dot net services.pptxSecure practices with dot net services.pptx
Secure practices with dot net services.pptx
 
Distributed Cache with dot microservices
Distributed Cache with dot microservicesDistributed Cache with dot microservices
Distributed Cache with dot microservices
 
Introduction to gRPC Presentation (Java)
Introduction to gRPC Presentation (Java)Introduction to gRPC Presentation (Java)
Introduction to gRPC Presentation (Java)
 
Using InfluxDB for real-time monitoring in Jmeter
Using InfluxDB for real-time monitoring in JmeterUsing InfluxDB for real-time monitoring in Jmeter
Using InfluxDB for real-time monitoring in Jmeter
 
Intoduction to KubeVela Presentation (DevOps)
Intoduction to KubeVela Presentation (DevOps)Intoduction to KubeVela Presentation (DevOps)
Intoduction to KubeVela Presentation (DevOps)
 
Stakeholder Management (Project Management) Presentation
Stakeholder Management (Project Management) PresentationStakeholder Management (Project Management) Presentation
Stakeholder Management (Project Management) Presentation
 
Introduction To Kaniko (DevOps) Presentation
Introduction To Kaniko (DevOps) PresentationIntroduction To Kaniko (DevOps) Presentation
Introduction To Kaniko (DevOps) Presentation
 
Efficient Test Environments with Infrastructure as Code (IaC)
Efficient Test Environments with Infrastructure as Code (IaC)Efficient Test Environments with Infrastructure as Code (IaC)
Efficient Test Environments with Infrastructure as Code (IaC)
 
Exploring Terramate DevOps (Presentation)
Exploring Terramate DevOps (Presentation)Exploring Terramate DevOps (Presentation)
Exploring Terramate DevOps (Presentation)
 
Clean Code in Test Automation Differentiating Between the Good and the Bad
Clean Code in Test Automation  Differentiating Between the Good and the BadClean Code in Test Automation  Differentiating Between the Good and the Bad
Clean Code in Test Automation Differentiating Between the Good and the Bad
 
Integrating AI Capabilities in Test Automation
Integrating AI Capabilities in Test AutomationIntegrating AI Capabilities in Test Automation
Integrating AI Capabilities in Test Automation
 
State Management with NGXS in Angular.pptx
State Management with NGXS in Angular.pptxState Management with NGXS in Angular.pptx
State Management with NGXS in Angular.pptx
 
Authentication in Svelte using cookies.pptx
Authentication in Svelte using cookies.pptxAuthentication in Svelte using cookies.pptx
Authentication in Svelte using cookies.pptx
 
OAuth2 Implementation Presentation (Java)
OAuth2 Implementation Presentation (Java)OAuth2 Implementation Presentation (Java)
OAuth2 Implementation Presentation (Java)
 

Intro lift

  • 1. Introducing Lift Web Framework Rishi Khandelwal Software Consultant Knoldus Software LLP Email : rishi@knoldus.com
  • 2. Introduction  Lift is a free web application framework.  It was originally created by David Pollack  It provides web application developers tools to make writing security, interacting, scalable web applications easier  Lift uses Scala as programming language.  It does not use MVC pattern.  It uses View first approach.
  • 3. Design goals SECURITY : Whenever you make an AJAX call, use Comet, or even build a simple form, Lift replaces input names and URLs with opaque GUIDs that reference specific functions on the server. CONCISENESS : As Lift uses Scala as a programming laguage, and scala's code is very concise. So Lift has this property PERFORMANCE : It is very quick. Using the basic Lift project, you can expect upward of 300 requests per second on a machine with only 1 GB of RAM and a middle-of-the-road processor.
  • 4. View-first design  Lift’s view-first approach does the complete opposite of MVC pattern  It first chooses the view and then determines what dynamic content needs to be included on that page.  The three component parts are view, snippet, and model—VSM for short Execute command Apply / commit Snippet Change Notification Error notices View Model .
  • 5. Continued... View : It refers primarily to the HTML content served for a page request. Within any given Lift application, you can have two types of view: 1. Template views that bind dynamic content into a predefined markup template 2. Generated views in which dynamic content is created, typically with Scala XML literals Snippet : Snippets are rendering functions that take XML input from within a given page template and then transform that input based upon the logic within the snippet function. Model : For most applications, it will represent a model of persistence or Data. You ask the model for value x, and it returns it.
  • 6. Lift Sub-projects Lift is broken down into three top-level subprojects: Lift Core and Lift Web, Lift Persistence, and Lift Modules. 1.. Lift Core and Lift Web :  The Core consists of four projects that build to separate libraries that you can use both with and without Lift’s Web module.  The Web module itself builds upon the Core.  The Web module itself is made up of three projects: the base web systems and two additional projects that provide specialized helpers.
  • 7. Continued... Lift Web Wizard TestKit Webkit Lift Core Utilities JSON Actor Common
  • 8. Continued... LIFT COMMON :  It contains a few base classes that are common to everything else within Lift.  Probably most important of all, Lift Common can be used in projects that aren’t even web applications. LIFT ACTOR :  Actors are a model for concurrent programming whereby asynchronous messaging is used in place of directly working with threads and locks.  Lift has its own for the specific domain of web development.  Lift Actor provides concrete implementations of the base actor traits that are found within Lift Common
  • 9. Continued... LIFT UTILITIES :  Lift Utilities is a collection of classes, traits, and objects that are designed to save you time or provide convenience mechanisms for dealing with common paradigms. LIFT JSON :  Lift JSON provides an almost standalone package for handling JSON in highly performant way.  The parser included within Lift JSON is approximately 350 times faster than the JSON parser that’s included in the Scala standard library LIFT WEBKIT :  The WebKit module is where Lift holds its entire pipeline, from request processing right down to localization and template rendering.
  • 10. 2. Lift Persistence :  It is some kind of backend storage.  It provides you with a number of options for saving your data,whether it’s a relational database management system (RDBMS) or one of the new NoSQL solutions.  There are three foundations for persistence : LIFT DB AND MAPPER :  It provides communication with an RDBMS of some description,  Mapper provides you with an object-relational mapping (ORM) implementation that handles all the usual relationship tasks
  • 11. Continued... eg. User.find(By(User.email, "foo@bar.com")) User.find(By(User.birthday, new Date("Jan 4, 1975"))) LIFT JPA :  It is Java Persistence API.  This module was added to Lift’s persistence options to wrap the JPA API and give it a more idiomatic Scala feel LIFT RECORD :  Record was designed with the idea that persistence has common idioms no matter what the actual backend implementation was doing to interact with the data.
  • 12. Continued... Record is a layer that gives users create, read, update, and delete (CRUD) semantics and a set of helpers for displaying form fields, operating validation, and so forth. Record has 3 backend implementation modules as part of the framework: 1. NoSQL document-orientated storage system CouchDB 2. second for the NoSQL data store MongoDB 3.layer on top of Squeryl ,the highly sophisticated functional persistence library. 3. Lift Modules : Lift Modules is where the project houses all the extensions to the core framework. Unlike the other groups of subprojects within Lift, the modules are more organic and have little or no relation to one another. Each module is generally self-contained regarding the functionality it provides.
  • 13. Project structure project src main scala bootstrap liftweb Boot.scala code comet lib model snippet view resources webapp WEB-INF/web.xml css images templates-hidden index.html test
  • 14. Boot.scala class Boot { def boot { // where to search snippet LiftRules.addToPackages("code") // Build SiteMap val entries = List( Menu.i("Home") / "index", // the simple way to declare a menu // more complex because this menu allows anything in the // /static path to be visible Menu(Loc("Static", Link(List("static"), true, "/static/index"), "Static Content"))) // set the sitemap. Note if you don't want access control for // each page, just comment this line out. LiftRules.setSiteMap(SiteMap(entries:_*)) //Show the spinny image when an Ajax call starts LiftRules.ajaxStart = Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd)
  • 15. Continued... // Make the spinny image go away when it ends LiftRules.ajaxEnd = Full(() => LiftRules.jsArtifacts.hide("ajax-loader").cmd) // Force the request to be UTF-8 LiftRules.early.append(_.setCharacterEncoding("UTF-8")) // Use HTML5 for rendering LiftRules.htmlProperties.default.set((r: Req) => new Html5Properties(r.userAgent)) //Init the jQuery module, see http://liftweb.net/jquery for more information. LiftRules.jsArtifacts = JQueryArtifacts JQueryModule.InitParam.JQuery=JQueryModule.JQuery172 JQueryModule.init() } }
  • 16. Index.html <div id="main" class="lift:surround?with=default;at=content"> <form class="lift:Process?form=post"> Name: <input id="name"><br> Age: <input id="age" value="0"><br> <input type="submit" value="Submit" id="submit"> </form> </div> default.html <span class="lift:Menu.builder"></span> <div class="lift:Msgs?showAll=true"></div> <div class="column span-17 last"> <div id="content">The main content will get bound here</div> </div>
  • 17. Process.scala object Process { var name = "" var age = "0" def render = { // define some variables to put our values into "#name" #> SHtml.text(name, name = _) & // set the name // set the age variable if we can convert to an Int "#age" #> SHtml.text(age, age = _) & // when the form is submitted, process the variable "#submit" #> SHtml.onSubmitUnit(process) }
  • 18. Continued... // process the form private def process() = asInt(age) match { case Full(a) if a < 13 => S.error("Too young!") case Full(a) => { S.notice("Name: " + name) S.notice("Age: " + a) } case _ => S.error("Age doesn't parse as a number") } }

Editor's Notes

  1. &quot;net.liftmodules&quot; %% &quot;widgets&quot; % (liftVersion+&quot;-1.2&quot;) % &quot;compile-&gt;default&quot;,