SlideShare ist ein Scribd-Unternehmen logo
1 von 19
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

Weitere ähnliche Inhalte

Was ist angesagt?

Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVCJohn Lewis
 
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 clientSebastiano Armeli
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring FrameworkASG
 
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 styleIvano Malavolta
 
Marlabs - ASP.NET Concepts
Marlabs - ASP.NET ConceptsMarlabs - ASP.NET Concepts
Marlabs - ASP.NET ConceptsMarlabs
 
Introduction to Ibatis by Rohit
Introduction to Ibatis by RohitIntroduction to Ibatis by Rohit
Introduction to Ibatis by RohitRohit Prabhakar
 
Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011grandyho
 
Leverage Hibernate and Spring Features Together
Leverage Hibernate and Spring Features TogetherLeverage Hibernate and Spring Features Together
Leverage Hibernate and Spring Features TogetherEdureka!
 
Introducing Ruby/MVC/RoR
Introducing Ruby/MVC/RoRIntroducing Ruby/MVC/RoR
Introducing Ruby/MVC/RoRSumanth krishna
 
Java Basics
Java BasicsJava Basics
Java BasicsKhan625
 

Was ist angesagt? (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
 

Andere mochten auch

FitNesse With Scala
FitNesse With ScalaFitNesse With Scala
FitNesse With ScalaKnoldus Inc.
 
Testing akka-actors
Testing akka-actorsTesting akka-actors
Testing akka-actorsKnoldus 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 ScalaKnoldus 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 AureliaJsKnoldus Inc.
 
Intoduction to Play Framework
Intoduction to Play FrameworkIntoduction to Play Framework
Intoduction to Play FrameworkKnoldus Inc.
 
Purely Functional Data Structures in Scala
Purely Functional Data Structures in ScalaPurely Functional Data Structures in Scala
Purely Functional Data Structures in ScalaVladimir Kostyukov
 
Functional programming in Javascript
Functional programming in JavascriptFunctional programming in Javascript
Functional programming in JavascriptKnoldus Inc.
 
Domain-driven design
Domain-driven designDomain-driven design
Domain-driven designKnoldus Inc.
 
Advanced Functional Programming in Scala
Advanced Functional Programming in ScalaAdvanced Functional Programming in Scala
Advanced Functional Programming in ScalaPatrick Nicolas
 
Functors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In ScalaFunctors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In ScalaKnoldus Inc.
 

Andere mochten auch (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
 

Ähnlich wie 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#arpGary Pedretti
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applicationshchen1
 
.NET,ASP .NET, Angular Js,LinQ
.NET,ASP .NET, Angular Js,LinQ.NET,ASP .NET, Angular Js,LinQ
.NET,ASP .NET, Angular Js,LinQAvijit Shaw
 
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 SiddheshSiddhesh 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 RailsJose de Leon
 
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
 
&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
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshareSaleemMalik52
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN StackRob Davarnia
 
Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatiasapientindia
 
Code igniter - A brief introduction
Code igniter - A brief introductionCode igniter - A brief introduction
Code igniter - A brief introductionCommit University
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technologyMinal Maniar
 
Ruby On Rails Basics
Ruby On Rails BasicsRuby On Rails Basics
Ruby On Rails BasicsAmit Solanki
 
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 DevelopmentSonia Simi
 

Ähnlich wie 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
 
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>
 
&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" />
 
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
 

Mehr von Knoldus Inc.

Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML ParsingMastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML ParsingKnoldus Inc.
 
Akka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On IntroductionAkka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On IntroductionKnoldus Inc.
 
Entity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptxEntity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptxKnoldus Inc.
 
Introduction to Redis and its features.pptx
Introduction to Redis and its features.pptxIntroduction to Redis and its features.pptx
Introduction to Redis and its features.pptxKnoldus Inc.
 
GraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfGraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfKnoldus Inc.
 
NuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptxNuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptxKnoldus Inc.
 
Data Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable TestingData Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable TestingKnoldus Inc.
 
K8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose KubernetesK8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose KubernetesKnoldus Inc.
 
Introduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptxIntroduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptxKnoldus Inc.
 
Robusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptxRobusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptxKnoldus Inc.
 
Optimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptxOptimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptxKnoldus Inc.
 
Azure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptxAzure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptxKnoldus Inc.
 
CQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptxCQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptxKnoldus Inc.
 
ETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake PresentationETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake PresentationKnoldus Inc.
 
Scripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics PresentationScripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics PresentationKnoldus Inc.
 
Getting started with dotnet core Web APIs
Getting started with dotnet core Web APIsGetting started with dotnet core Web APIs
Getting started with dotnet core Web APIsKnoldus Inc.
 
Introduction To Rust part II Presentation
Introduction To Rust part II PresentationIntroduction To Rust part II Presentation
Introduction To Rust part II PresentationKnoldus Inc.
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Configuring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRAConfiguring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRAKnoldus Inc.
 
Advanced Python (with dependency injection and hydra configuration packages)
Advanced Python (with dependency injection and hydra configuration packages)Advanced Python (with dependency injection and hydra configuration packages)
Advanced Python (with dependency injection and hydra configuration packages)Knoldus Inc.
 

Mehr von Knoldus Inc. (20)

Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML ParsingMastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
 
Akka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On IntroductionAkka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On Introduction
 
Entity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptxEntity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptx
 
Introduction to Redis and its features.pptx
Introduction to Redis and its features.pptxIntroduction to Redis and its features.pptx
Introduction to Redis and its features.pptx
 
GraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfGraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdf
 
NuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptxNuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptx
 
Data Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable TestingData Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable Testing
 
K8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose KubernetesK8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose Kubernetes
 
Introduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptxIntroduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptx
 
Robusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptxRobusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptx
 
Optimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptxOptimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptx
 
Azure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptxAzure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptx
 
CQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptxCQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptx
 
ETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake PresentationETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake Presentation
 
Scripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics PresentationScripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics Presentation
 
Getting started with dotnet core Web APIs
Getting started with dotnet core Web APIsGetting started with dotnet core Web APIs
Getting started with dotnet core Web APIs
 
Introduction To Rust part II Presentation
Introduction To Rust part II PresentationIntroduction To Rust part II Presentation
Introduction To Rust part II Presentation
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Configuring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRAConfiguring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRA
 
Advanced Python (with dependency injection and hydra configuration packages)
Advanced Python (with dependency injection and hydra configuration packages)Advanced Python (with dependency injection and hydra configuration packages)
Advanced Python (with dependency injection and hydra configuration packages)
 

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") } }

Hinweis der Redaktion

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