SlideShare une entreprise Scribd logo
1  sur  127
Télécharger pour lire hors ligne
GeLiftete Web-Applikation mit Scala
                                JAX 2009



                              Tobias Joch
                              inovex GmbH




 Wir nutzen Technologien, um unsere Kunden glücklich zu machen. Und uns selbst.
Scala
Lift
  Grundlagen
    Architektur Überblick
    Module
    Template Verarbeitung
    Tags und Snippets
    Head Merge
    Scopes
    I18n
    Persistenz
    AJAX
  in Action
  Fazit / Ausblick / weiterführende Informationen
                                                    2
3
Scala = SCAlable LAnguage




                            4
Scala = SCAlable LAnguage
wächst mit den Bedürfnissen der User
kleine Skripte bis hin zu großen und komplexen
Systemen
Multiparadigmensprache
  verbindet objektorientierte (imperative) und funktionale
  Programmierung
pragmatisch, typsicher, strikt objektorientiert
interoperabel mit Standard Plattformen (Java, .NET)          4
Wurzeln reichen zurück in das Jahr 1995
Philip Wadler und Martin Odersky
  Funktionale Programmiersprachen für die JVM
     Pizza
     GJ (Generic Language Extension für Java)
     javac
     Java Generics
1999 verfolgte Martin Odersky das Ziel funktionale mit
OO Programmierung zu kombinieren
  Funnel
  Scala
     *2001, 2003 erstes Public Release, 2006 Version 2.0,
     aktuell 2.7.4 RC1                                      5
Ziel von Scala:
Das Beste aus beiden Welten (OO und FP)
  Statisch typisiert + Typinferenz
  Funktionen höherer Ordnung
  Traits, Mixin-Komposition
  Option-Klasse (None und Some vs. null)
  Pattern Matching
  Algebraische Typen
  Native XML-Unterstützung inkl. XPath Unterstützung (Bibliothek)
  Actor Model
  Currying
  Anonyme Funktionen
  Parametrische Polymorphie                                         6
Einige reservierte Schlüsselwörter in Scala
  class, case class, object
  new
  with
  extends
  abstract
  sealed
  trait
  def, var, val
  override
  match, case
                                              7
in Action ;)




               8
Scala Shell
  Interactive Ruby Shell (IRB)
  ./scala
  Optimal für schnelle Tests




                                 9
Scala Shell
  Interactive Ruby Shell (IRB)
  ./scala
  Optimal für schnelle Tests




                                 9
Scala Shell
  Interactive Ruby Shell (IRB)
  ./scala
  Optimal für schnelle Tests




                                 9
Imperative vs. funktionale Programmierung (I)
 public class Example1 {
 	 public static void main(String[] args) {
 	 	 for (String arg : args) {
 	 	 	 System.out.println(arg);
 	 	 }
 	 }
 }




                                                10
Imperative vs. funktionale Programmierung (I)
 public class Example1 {
 	 public static void main(String[] args) {
 	 	 for (String arg : args) {
 	 	 	 System.out.println(arg);
 	 	 }
 	 }
 }


 object Example1 {
    def main(args: Array[String]) {
       args.foreach(println)
    }
 }
                                                10
Imperative vs. funktionale Programmierung (II)
  public class Example2 {
  	 public static void main(String[] args) {
  	 	 for (String arg : args) {
  	 	 	 if (arg.startsWith("JAX09")) {
  	 	 	 	 System.out.println(arg);
  	 	 	 }
  	 	 }
  	 }
  }




                                                 11
Imperative vs. funktionale Programmierung (II)
  public class Example2 {
  	 public static void main(String[] args) {
  	 	 for (String arg : args) {
  	 	 	 if (arg.startsWith("JAX09")) {
  	 	 	 	 System.out.println(arg);
  	 	 	 }
  	 	 }
  	 }
  }

  object Example2 {
    def main(args: Array[String]) {
      args.filter(_.startsWith("JAX09")).foreach(println)
    }
  }                                                         11
Imperative vs. funktionale Programmierung (III)
  public class Example3 {
  	   public static void main(String[] args) {
  	   	   boolean exists = false;
  	   	   for (String arg : args) {
  	   	   	   if (arg.startsWith("JAX09")) {
  	   	   	   	   exists = true;
  	   	   	   	   break;
  	   	   	   }
  	   	   }
  	   	   System.out.print(exists);
  	   }
  }




                                                  12
Imperative vs. funktionale Programmierung (III)
  public class Example3 {
  	   public static void main(String[] args) {
  	   	   boolean exists = false;
  	   	   for (String arg : args) {
  	   	   	   if (arg.startsWith("JAX09")) {
  	   	   	   	   exists = true;
  	   	   	   	   break;
  	   	   	   }
  	   	   }
  	   	   System.out.print(exists);
  	   }
  }

  object Example3 {
    def main(args: Array[String]) {
      print(args.exists(_.startsWith("JAX09")))
    }
  }                                               12
Grundlagen
             13
David Pollak
  Gründer von Lift
  Kommerzielle Softwareentwicklung seit 1977
  Web-Applikationen seit 1996
15. Februar 2007:
Initial Import (GitHub) in der Version 0.1.0
Gründung von Lift als OS Projekt in 2007
26. Februar 2009:
Lift 1.0
Aktuelles Lift-Team besteht aus 13 Comitter
Aktive Community
  http://groups.google.com/group/liftweb       14
„Best of all“
Scala als zugrundeliegende Sprache
  nativer XML-Support (XHTML nativ innerhalb von Snippets!)
  Scala Actors für mächtige Comet-Anwendungen
fein granulare Sessions und Security (Seaside)
schnelles Projektsetup durch „convention over
configuration“ + geringe Turnaround-Zeiten (Rails)
Django's "more than just CRUD is included"
Designer freundliche Templates (Wicket / Lift View First)
Offen für die Nutzung von zahlreichen OSS-Bibliotheken
(Java)
Etablierte Deployment-Prozesse (JEE / Java)                   15
Weitere Eigenschaften / Ziele von Lift
  Sicherheit
     XSS, replay Attacken, Parameter tampering
  Wartbarkeit
  Skalierbarkeit
  Performance
  Hohe Produktivität
  Einfach
  Convention over configuration
  DRY

                                                 16
„View First“ Design-Prinzip
     Templates enthalten keinen Code
     Pures XHTML
     Können mit Standard Design-Werkzeugen bearbeitet
     werden
     Frontend ist ohne Scala-Kenntnisse von einem Designer
     realisierbar

    <lift:surround with="default" at="content">
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>


                                                             17
Architektur Überblick
                        18
Lift-Framework




                 19
Lift-Framework




                 Scala Framework
                                   19
Lift-Framework




                  Lift-Framework

                 Scala Framework
                                   19
Lift-Framework




                 Lift Core
                    Lift-Framework

                  Scala Framework
                                     19
LiftSession

                                                               LiftRules

                                                              LiftResponse
                                                                             Lift-Framework


                                                                   S


                                                                 SHtml


                                                                JS API




                                    Lift Core
                                                Lift Webkit     SiteMap

                                                              Menu, Msgs,



                   Lift-Framework

 Scala Framework
                                                                 CSS

                                                              HTTP Auth


                                                                Comet
19
LiftSession

                                                               LiftRules


                                                                             Mapper
                                                              LiftResponse
                                                                                      Lift-Framework


                                                                   S


                                                                 SHtml
                                                                             Record




                                                                JS API




                                    Lift Core
                                                Lift Webkit     SiteMap

                                                              Menu, Msgs,



                   Lift-Framework

 Scala Framework
                                                                 CSS

                                                              HTTP Auth


                                                                Comet
19
Lift-Framework

              Mapper                               Record                                     Testkit
                              LiftResponse




                                                                               Menu, Msgs,
    LiftSession




                                                                                             HTTP Auth
                  LiftRules




                                                                     SiteMap
                                                            JS API
                                                 SHtml




                                                                                                         Comet
                                                                                  CSS
                                             S




                                                 Lift Webkit




                                                  Lift Core
                                                          Lift-Framework

                                                         Scala Framework
                                                                                                                 19
Lift-Framework

              Mapper                               Record                                     Testkit
                              LiftResponse




                                                                               Menu, Msgs,
    LiftSession




                                                                                             HTTP Auth
                  LiftRules




                                                                     SiteMap
                                                            JS API
                                                 SHtml




                                                                                                         Comet
                                                                                  CSS
                                             S




                                                 Lift Webkit


                                                    Lift Util

                                                  Lift Core
                                                          Lift-Framework

                                                         Scala Framework
                                                                                                                 19
Lift-Framework
                                                                                                                  Lift XMPP
              Mapper                               Record                                     Testkit

                                                                                                                 Lift Facebook
                              LiftResponse




                                                                               Menu, Msgs,
    LiftSession




                                                                                             HTTP Auth
                                                                                                                 Lift Widgets
                  LiftRules




                                                                     SiteMap
                                                            JS API
                                                 SHtml




                                                                                                         Comet
                                                                                  CSS
                                             S




                                                                                                                  Lift OpenId

                                                 Lift Webkit                                                      Lift OAuth


                                                    Lift Util                                                     Lift Paypal

                                                  Lift Core                                                       Lift AMQP

                                                          Lift-Framework

                                                         Scala Framework
                                                                                                                                 19
Grobe Architektur einer Lift-Applikation




                                           20
Grobe Architektur einer Lift-Applikation




                       Java Virtual Machine
                                              20
Grobe Architektur einer Lift-Applikation




                 Servlet Container (e.g. Jetty or Tomcat)

                           Java Virtual Machine
                                                            20
Grobe Architektur einer Lift-Applikation




                                   Lift Framework




                 Servlet Container (e.g. Jetty or Tomcat)

                           Java Virtual Machine
                                                            20
Grobe Architektur einer Lift-Applikation
                                      Templates




                                   Lift Framework




                 Servlet Container (e.g. Jetty or Tomcat)

                           Java Virtual Machine
                                                            20
Grobe Architektur einer Lift-Applikation
                                      Templates



                                      Snippets




                                   Lift Framework




                 Servlet Container (e.g. Jetty or Tomcat)

                           Java Virtual Machine
                                                            20
Grobe Architektur einer Lift-Applikation
                                      Templates



                                      Snippets



                                        Views




                                   Lift Framework




                 Servlet Container (e.g. Jetty or Tomcat)

                           Java Virtual Machine
                                                            20
Grobe Architektur einer Lift-Applikation
                                        Templates



                                        Snippets



                                          Views



                                Boot.scala (LiftRules etc,)


                                    Lift Framework




                 Servlet Container (e.g. Jetty or Tomcat)

                           Java Virtual Machine
                                                              20
Grobe Architektur einer Lift-Applikation
                                        Templates



                                        Snippets




                                                              Model
                                          Views



                                Boot.scala (LiftRules etc,)


                                    Lift Framework




                 Servlet Container (e.g. Jetty or Tomcat)

                           Java Virtual Machine
                                                                      20
Grobe Architektur einer Lift-Applikation
                                                   Templates



                                                   Snippets




                                                                         Model
               LiftFilter



                                                     Views



                                           Boot.scala (LiftRules etc,)


                                               Lift Framework




                            Servlet Container (e.g. Jetty or Tomcat)

                                      Java Virtual Machine
                                                                                 20
Grobe Architektur einer Lift-Applikation
                                                           Templates



                                                           Snippets



                                 LiftServlet




                                                                                 Model
               LiftFilter



                                                             Views



                                                   Boot.scala (LiftRules etc,)


                                                       Lift Framework




                            Servlet Container (e.g. Jetty or Tomcat)

                                               Java Virtual Machine
                                                                                         20
Grobe Architektur einer Lift-Applikation
                                                           Templates



                                                           Snippets



                                 LiftServlet




                                                                                 Model
               LiftFilter



                                                             Views



                                                   Boot.scala (LiftRules etc,)


                                                       Lift Framework

                                                        DefaultServlet

                            Servlet Container (e.g. Jetty or Tomcat)

                                               Java Virtual Machine
                                                                                         20
Grober Ablauf einer Anfragenbearbeitung




Request   URL rewrite              custom dispatch          Template              View   Response
                        Response




                                                 Response




                                                                       Response



                                                                                                    21
Grober Ablauf einer Anfragenbearbeitung

                                                                       Template


Request   URL rewrite              custom dispatch                        View    Response
                        Response




                                                 Response




                                                            Response



                                                                                             21
Template




Template Verarbeitung
  Request Mapping nach folgendem Schema




                                          22
Template




Template Verarbeitung
  Request Mapping nach folgendem Schema

<path>[_<language, optional>][.<suffix>]




                                           22
Template




Template Verarbeitung
  Request Mapping nach folgendem Schema

<path>[_<language, optional>][.<suffix>]

Lift wählt die passende Sprache und Endung




                                             22
Template




Template Verarbeitung
  Request Mapping nach folgendem Schema

<path>[_<language, optional>][.<suffix>]

Lift wählt die passende Sprache und Endung
  Links ohne Sprache und Endung angeben




                                             22
Template




Template Verarbeitung
  Request Mapping nach folgendem Schema

<path>[_<language, optional>][.<suffix>]

Lift wählt die passende Sprache und Endung
  Links ohne Sprache und Endung angeben
Lift versteckt Templates und
Ressourcen in Verzeichnissen
welche als Endung -hidden im
Namen tragen
                                             22
Template




Template Verarbeitung
  Request Mapping nach folgendem Schema

<path>[_<language, optional>][.<suffix>]

Lift wählt die passende Sprache und Endung
  Links ohne Sprache und Endung angeben
Lift versteckt Templates und
Ressourcen in Verzeichnissen
welche als Endung -hidden im
Namen tragen
                                             22
Template




           23
Template




Templates = Content + Tags + Snippets




                                        23
Template




Templates = Content + Tags + Snippets
Tags = Lift spezifische Funktionen
  surround
  bind
  embed
  comet
  loc




                                        23
Template




Templates = Content + Tags + Snippets
Tags = Lift spezifische Funktionen
  surround
  bind
  embed
  comet
  loc
Snippets
  vergleichbar mit Taglibs
  <lift:snippet type=Jax:render />
  <lift:Jax.render />
  <lift:Jax />                          23
›
                          Template




    Template Verarbeitung von Außen nach Innen




                                                 24
›
                                    Template




    Template Verarbeitung von Außen nach Innen
/index.html

        <lift:surround with="default" at="content">
    	   	 <h2>Welcome to your project!</h2>
    	   	 <p><lift:HelloWorld.howdy /></p>
        </lift:surround>




                                                      24
›
                                    Template




    Template Verarbeitung von Außen nach Innen
/index.html

        <lift:surround with="default" at="content">
    	   	 <h2>Welcome to your project!</h2>
    	   	 <p><lift:HelloWorld.howdy /></p>
        </lift:surround>

/templates-hidden/default.html

    <html xmlns="..." xmlns:lift="http://liftweb.net/">
      <head>...</head>
      <body>
       ...
       <lift:bind name="content" />
      </body>
    </html>

                                                          24
›
                                    Template




    Template Verarbeitung von Außen nach Innen
/index.html

        <lift:surround with="default" at="content">
    	   	 <h2>Welcome to your project!</h2>
    	   	 <p><lift:HelloWorld.howdy /></p>
        </lift:surround>

/templates-hidden/default.html

    <html xmlns="..." xmlns:lift="http://liftweb.net/">
      <head>...</head>
      <body>
       ...
       <lift:bind name="content" />
      </body>
    </html>

        Ausführung von HelloWorld#howdy                   24
Template




Head Merge




                        25
Template




  Head Merge
/index.html

   <lift:surround with="default" at="content">
      <head><script type="text/javascript">...</script>...</head>
      <h2>Welcome to your project!</h2>
      <p><lift:helloWorld.howdy /></p>
   </lift:surround>




                                                                    25
Template




  Head Merge
/index.html

   <lift:surround with="default" at="content">
      <head><script type="text/javascript">...</script>...</head>
      <h2>Welcome to your project!</h2>
      <p><lift:helloWorld.howdy /></p>
   </lift:surround>


/templates-hidden/default.html

 <html xmlns="..." xmlns:lift="http://liftweb.net/">
   <head>...</head>
   <body>
    ...
    <lift:bind name="content" />
   </body>
 </html>
                                                                    25
Template




  Head Merge
/index.html

   <lift:surround with="default" at="content">
      <head><script type="text/javascript">...</script>...</head>
      <h2>Welcome to your project!</h2>
      <p><lift:helloWorld.howdy /></p>
   </lift:surround>


/templates-hidden/default.html

 <html xmlns="..." xmlns:lift="http://liftweb.net/">
   <head>...</head>
   <body>
    ...
    <lift:bind name="content" />
   </body>
 </html>
                                                                    25
Scopes
  S
  Stateful Snippet
  RequestVar
  SessionVar
  Scala Object (Singleton)




                             26
Internationalisierung / I18n
   java.util.Locale
   java.util.ResourceBundle
      LiftRules.resourceNames
Ermittlung der aktuellen Sprache
   LiftRules.localeCalculator
      Request-Header
      Fallback: Locale.getDefault()
Snippets
   S.?
Templates
<lift:loc locid="lift">Aufzug</lift:loc>
<lift:loc>lift</lift:loc>                  27
Persistenz in Lift
  Mapper
  Record
  JPA
  JDO
  Hibernate
  ...
Lift selbst ist Persistenz agnostisch



                                        28
AJAX in Lift
    SHtml
        ajaxButton
        ajaxText
        ajaxCheckbox
        ...


def render(in: NodeSeq): NodeSeq =
    SHtml.ajaxButton("Click me ;)", () => {
	   	   println("Yes, thanks!")
	   	   JsCmds.SetHtml("click-div", Text("Yes, thanks!"))
    })



                                                            29
in Action ;)
               30
Entwicklungsumgebung
  Java (>= 5)
  Maven (>= 2.0.9)
  Web-Container (Jetty, Tomcat, ...)
Optional, aber nützlich
  JavaRebel (JVM Plugin / Java Agent)
  IDE mit Scala Support / Plugin (Eclipse, IDEA,
  Netbeans, ...)
     http://www.scala-lang.org/scala-eclipse-plugin



                                                      31
Projekt anlegen




                  32
Projekt anlegen
$mvn archetype:generate -U
 -DarchetypeGroupId=net.liftweb
 -DarchetypeArtifactId=lift-archetype-basic
 -DarchetypeVersion=1.0
 -DgroupId=de.inovex.jax2009.lift
 -DartifactId=lift-demo




                                              32
Projekt anlegen
$mvn archetype:generate -U
 -DarchetypeGroupId=net.liftweb
 -DarchetypeArtifactId=lift-archetype-basic
 -DarchetypeVersion=1.0
 -DgroupId=de.inovex.jax2009.lift
 -DartifactId=lift-demo


Import in Eclipse vorbereiten

$cd lift-demo && mvn eclipse:eclipse
                                              32
Projektlayout




                33
Projektlayout




                33
Projektlayout




                33
Ausführen




            34
Ausführen

$mvn jetty:run




                 34
Ausführen

$mvn jetty:run




                 34
index.html




             35
index.html
    <lift:surround with="default" at="content">
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>




                                                  35
index.html
    <lift:surround with="default" at="content">
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>



    HelloWorld.scala




                                                  35
index.html
    <lift:surround with="default" at="content">
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>



    HelloWorld.scala
    import java.util.Date

    class HelloWorld {
       def howdy = <span>Welcome to lift-demo at {new Date}</span>
    }



                                                                     35
index.html
    <lift:surround with="default" at="content">
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>



    HelloWorld.scala
    import java.util.Date

    class HelloWorld {
       def howdy = <span>Welcome to lift-demo at {new Date}</span>
    }



                                                                     35
index.html
    <lift:surround with="default" at="content">
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>



    HelloWorld.scala
    import java.util.Date

    class HelloWorld {
       def howdy = <span>Welcome to lift-demo at {new Date}</span>
    }



                                                                     35
index.html
    <lift:surround with="default" at="content">
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>



    HelloWorld.scala
    import java.util.Date

    class HelloWorld {
       def howdy = <span>Welcome to lift-demo at {new Date}</span>
    }



                                                                     35
index.html
    <lift:surround with="default" at="content">
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>



    HelloWorld.scala
    import java.util.Date

    class HelloWorld {
       def howdy = <span>Welcome to lift-demo at {new Date}</span>
    }



                                                                     35
index.html
    <lift:surround with="default" at="content">
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>



    HelloWorld.scala
    import java.util.Date

    class HelloWorld {
       def howdy = <span>Welcome to lift-demo at {new Date}</span>
    }



                                                                     35
index.html
    <lift:surround with="default" at="content">
	   	 <h2>Welcome to your project!</h2>
	   	 <p><lift:helloWorld.howdy /></p>
    </lift:surround>



    HelloWorld.scala
    import java.util.Date

    class HelloWorld {
       def howdy = <span>Welcome to lift-demo at {new Date}</span>
    }



                                                                     35
default.html




               36
default.html
    <div class="container">
      <div class="column span-12 last" style="text-align: right">
        <h1 class="alt">lift-demo
             <img id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px"
                  src="/images/ajax-loader.gif"/></h1>
      </div>
      <hr/>
      <div class="column span-6 colborder sidebar">
        <hr class="space" />
        <lift:Menu.builder /> 	
        <div>
          <lift:snippet type="msgs"/>
          <hr class="space" />
        </div>
      </div>
      <div class="column span-17 last">
        <lift:bind name="content" />
      </div>
      <hr />
      <div class="column span-23 last" style="text-align: center">
        <h4 class="alt">
           <a href="http://liftweb.net"><i>Lift</i></a>
	      is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4>
      </div>
    </div>
                                                                                                           36
default.html
    <div class="container">
      <div class="column span-12 last" style="text-align: right">
        <h1 class="alt">lift-demo
             <img id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px"
                  src="/images/ajax-loader.gif"/></h1>
      </div>
      <hr/>
      <div class="column span-6 colborder sidebar">
        <hr class="space" />
        <lift:Menu.builder /> 	
        <div>
          <lift:snippet type="msgs"/>
          <hr class="space" />
        </div>
      </div>
      <div class="column span-17 last">
        <lift:bind name="content" />
      </div>
      <hr />
      <div class="column span-23 last" style="text-align: center">
        <h4 class="alt">
           <a href="http://liftweb.net"><i>Lift</i></a>
	      is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4>
      </div>
    </div>
                                                                                                           36
default.html
    <div class="container">
      <div class="column span-12 last" style="text-align: right">
        <h1 class="alt">lift-demo
             <img id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px"
                  src="/images/ajax-loader.gif"/></h1>
      </div>
      <hr/>
      <div class="column span-6 colborder sidebar">
        <hr class="space" />
        <lift:Menu.builder /> 	
        <div>
          <lift:snippet type="msgs"/>
          <hr class="space" />
        </div>
      </div>
      <div class="column span-17 last">
        <lift:bind name="content" />
      </div>
      <hr />
      <div class="column span-23 last" style="text-align: center">
        <h4 class="alt">
           <a href="http://liftweb.net"><i>Lift</i></a>
	      is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4>
      </div>
    </div>
                                                                                                           36
default.html
    <div class="container">
      <div class="column span-12 last" style="text-align: right">
        <h1 class="alt">lift-demo
             <img id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px"
                  src="/images/ajax-loader.gif"/></h1>
      </div>
      <hr/>
      <div class="column span-6 colborder sidebar">
        <hr class="space" />
        <lift:Menu.builder /> 	
        <div>
          <lift:snippet type="msgs"/>
          <hr class="space" />
        </div>
      </div>
      <div class="column span-17 last">
        <lift:bind name="content" />
      </div>
      <hr />
      <div class="column span-23 last" style="text-align: center">
        <h4 class="alt">
           <a href="http://liftweb.net"><i>Lift</i></a>
	      is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4>
      </div>
    </div>
                                                                                                           36
default.html
    <div class="container">
      <div class="column span-12 last" style="text-align: right">
        <h1 class="alt">lift-demo
             <img id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px"
                  src="/images/ajax-loader.gif"/></h1>
      </div>
      <hr/>
      <div class="column span-6 colborder sidebar">
        <hr class="space" />
        <lift:Menu.builder /> 	
        <div>
          <lift:snippet type="msgs"/>
          <hr class="space" />
        </div>
      </div>
      <div class="column span-17 last">
        <lift:bind name="content" />
      </div>
      <hr />
      <div class="column span-23 last" style="text-align: center">
        <h4 class="alt">
           <a href="http://liftweb.net"><i>Lift</i></a>
	      is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4>
      </div>
    </div>
                                                                                                           36
default.html
    <div class="container">
      <div class="column span-12 last" style="text-align: right">
        <h1 class="alt">lift-demo
             <img id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px"
                  src="/images/ajax-loader.gif"/></h1>
      </div>
      <hr/>
      <div class="column span-6 colborder sidebar">
        <hr class="space" />
        <lift:Menu.builder /> 	
        <div>
          <lift:snippet type="msgs"/>
          <hr class="space" />
        </div>
      </div>
      <div class="column span-17 last">
        <lift:bind name="content" />
      </div>
      <hr />
      <div class="column span-23 last" style="text-align: center">
        <h4 class="alt">
           <a href="http://liftweb.net"><i>Lift</i></a>
	      is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4>
      </div>
    </div>
                                                                                                           36
Boot.scala




             37
Boot.scala
     def boot {
         if (!DB.jndiJdbcConnAvailable_?)
           DB.defineConnectionManager(DefaultConnectionIdentifier, DBVendor)

        // where to search snippet
        LiftRules.addToPackages("de.inovex.jax2009.lift")

        // create or update the database schema
        Schemifier.schemify(true, Log.infoF _, User)

        // build site map
        val entries = Menu(Loc("Home", List("index"), "Home")) :: User.sitemap
        LiftRules.setSiteMap(SiteMap(entries:_*))

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

        // 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(makeUtf8)

         S.addAround(DB.buildLoanWrapper)
 }                                                                                        37
Rekursive Template Komposition




                                 38
Rekursive Template Komposition

class HelloWorld {
    def howdy = <span>Welcome to lift-demo at
                      {new Date} at <lift:helloWorld.howdy2 /></span>
    def howdy2 = <span>JAX 2009!</span>
}




                                                                        38
Rekursive Template Komposition

class HelloWorld {
    def howdy = <span>Welcome to lift-demo at
                      {new Date} at <lift:helloWorld.howdy2 /></span>
    def howdy2 = <span>JAX 2009!</span>
}




                                                                        38
Rekursive Template Komposition

class HelloWorld {
    def howdy = <span>Welcome to lift-demo at
                      {new Date} at <lift:helloWorld.howdy2 /></span>
    def howdy2 = <span>JAX 2009!</span>
}




                                                                        38
Rekursive Template Komposition

class HelloWorld {
    def howdy = <span>Welcome to lift-demo at
                      {new Date} at <lift:helloWorld.howdy2 /></span>
    def howdy2 = <span>JAX 2009!</span>
}




                                                                        38
Formulare
    <lift:surround with="default" at="content">
       <h2>Very first form example:</h2>
       <p>
	         <lift:FormExample form="POST">
	    	      <f:name><input type="text"/></f:name>
	    	      <input type="submit" value="Post"/>
	         </lift:FormExample>
       </p>
    </lift:surround>




                                                    39
Formulare
    <lift:surround with="default" at="content">
       <h2>Very first form example:</h2>
       <p>
	         <lift:FormExample form="POST">
	    	      <f:name><input type="text"/></f:name>
	    	      <input type="submit" value="Post"/>
	         </lift:FormExample>
       </p>
    </lift:surround>



    class FormExample {
      def render(xhtml: NodeSeq) = {
         bind("f", xhtml, "name" -> text("", println(_)))
      }
    }




                                                            39
Formulare
    <lift:surround with="default" at="content">
       <h2>Very first form example:</h2>
       <p>
	         <lift:FormExample form="POST">
	    	      <f:name><input type="text"/></f:name>
	    	      <input type="submit" value="Post"/>
	         </lift:FormExample>
       </p>
    </lift:surround>



    class FormExample {
      def render(xhtml: NodeSeq) = {
         bind("f", xhtml, "name" -> text("", println(_)))
      }
    }




                                                            39
Formulare
    <lift:surround with="default" at="content">
       <h2>Very first form example:</h2>
       <p>
	         <lift:FormExample form="POST">
	    	      <f:name><input type="text"/></f:name>
	    	      <input type="submit" value="Post"/>
	         </lift:FormExample>
       </p>
    </lift:surround>



    class FormExample {
      def render(xhtml: NodeSeq) = {
         bind("f", xhtml, "name" -> text("", println(_)))
      }
    }




                                                            39
Formulare
    <lift:surround with="default" at="content">
       <h2>Very first form example:</h2>
       <p>
	         <lift:FormExample form="POST">
	    	      <f:name><input type="text"/></f:name>
	    	      <input type="submit" value="Post"/>
	         </lift:FormExample>
       </p>
    </lift:surround>



    class FormExample {
      def render(xhtml: NodeSeq) = {
         bind("f", xhtml, "name" -> text("", println(_)))
      }
    }




                                                            39
Formulare
    <lift:surround with="default" at="content">
       <h2>Very first form example:</h2>
       <p>
	         <lift:FormExample form="POST">
	    	      <f:name><input type="text"/></f:name>
	    	      <input type="submit" value="Post"/>
	         </lift:FormExample>
       </p>
    </lift:surround>



    class FormExample {
      def render(xhtml: NodeSeq) = {
         bind("f", xhtml, "name" -> text("", println(_)))
      }
    }


    // in boot.scala:
    val entries = Menu(Loc("Home", List("index"), "Home")) ::
                  Menu(Loc("form1", List("veryFirstForm"), "Example")) ::
                  User.sitemap
    LiftRules.setSiteMap(SiteMap(entries:_*))                               39
Formulare
    <lift:surround with="default" at="content">
       <h2>Very first form example:</h2>
       <p>
	         <lift:FormExample form="POST">
	    	      <f:name><input type="text"/></f:name>
	    	      <input type="submit" value="Post"/>
	         </lift:FormExample>
       </p>
    </lift:surround>



    class FormExample {
      def render(xhtml: NodeSeq) = {
         bind("f", xhtml, "name" -> text("", println(_)))
      }
    }


    // in boot.scala:
    val entries = Menu(Loc("Home", List("index"), "Home")) ::
                  Menu(Loc("form1", List("veryFirstForm"), "Example")) ::
                  User.sitemap
    LiftRules.setSiteMap(SiteMap(entries:_*))                               39
Formulare




            40
Formulare




            40
Formulare




JAX 2009!
INFO - Service request (POST) /veryFirstForm took 61 Milliseconds

                                                                    40
Formulare




JAX 2009!
INFO - Service request (POST) /veryFirstForm took 61 Milliseconds

                                                                    40
more in Action ;)
                    41
Beispiel-Applikation(en)
  Scala Actors / Comet
  Modelle / OR-Mapping
  SiteMap
  Messages
  ...




                           42
Beispiel-Applikation(en)
  Scala Actors / Comet
  Modelle / OR-Mapping
  SiteMap
  Messages
  ...


              Demo !
                           42
Zusammenfassung
                  43
44
Pro
  Sehr schicke Sprachfeatures
  „Best of all“ Prinzip
  Junge und dynamische Community
  Sehr gut für interaktive Webbapplikationen („Real time web“)
  Native, volle JVM Geschwindigkeit
  100% kompatibel mit Java
  Läuft auf Standard Servlet-Container (Jetty, Tomcat, ...)




                                                                 44
Pro
  Sehr schicke Sprachfeatures
  „Best of all“ Prinzip
  Junge und dynamische Community
  Sehr gut für interaktive Webbapplikationen („Real time web“)
  Native, volle JVM Geschwindigkeit
  100% kompatibel mit Java
  Läuft auf Standard Servlet-Container (Jetty, Tomcat, ...)
Cons
  Steile Lernkurve
  Wenig Scala Ressourcen am Markt verfügbar (XING: 164)
  Noch weniger Lift Ressourcen verfügbar (XING: 3)
  Keine mir bekannten große Installationen aktuell vorzeigbar    44
Aktuell Roadmap 1.1 (Auszug der Lift Newsgroup)
   Improved documentation: better VScalaDoc coverage as well as better tutorial and
   cook-book documentation.
   Improved J2EE support including JTA and Portlets.
   Finish Record/Field code with backing store including JDBC, JPA and Goat Rodeo
   (what's Goat Rodeo? http://goatrodeo.org)
   Improved client-side JavaScript support and better JavaScript abstractions.
   Client/Server data synchronization (integrated with Record/Field)
   Improved support for REST.
   Improved performance including caching templates when running in production
   mode.
   OSGi support.
   Improved testing framework and better testing support when running in "test" mode.
   Implement Servlet 3.0 support.
   HTML 5 and Web Sockets support and integration with Kaazing's Web Sockets
   server. Also, sensing which browser is making the request and performing
   optimizations based on that browser's characteristics (specifically, Chrome and
   Firefox 3.1 support)                                                               45
Ressourcen im Netz
  Scala
     http://scala-lang.org
  Lift
     http://liftweb.net/
     http://liftweb.net/docs/getting_started.html
     http://wiki.liftweb.net/
     http://github.com/dpp/liftweb
  Lift Buch: „Exploring Lift“
     http://groups.google.com/group/the-lift-book
     http://github.com/tjweir/liftbook/

                                                    46
Exploring Lift
      Mail 2009, oder LyX Version!
      Derek Chen-Becker,
      Tyler Weir, Marius Danciu
Beginning Scala
      Mail 2009
      David Pollak
Programming in Scala
      Martin Odersky,
      Lex Spoon, and Bill Venners
...
                                     47
Fragen & Antworten



                        Tobias Joch
                        System Architecture
                        Project Management


                        inovex GmbH
                        Karlsruher Straße 71
                        75179 Pforzheim

                        0173.3181 004
                        tobias.joch@inovex.de
                        www.inovex.de




Wir nutzen Technologien, um unsere Kunden glücklich zu machen. Und uns selbst.
Vielen Dank! ;)



                        Tobias Joch
                        System Architecture
                        Project Management


                        inovex GmbH
                        Karlsruher Straße 71
                        75179 Pforzheim

                        0173.3181 004
                        tobias.joch@inovex.de
                        www.inovex.de




Wir nutzen Technologien, um unsere Kunden glücklich zu machen. Und uns selbst.

Contenu connexe

En vedette

En vedette (17)

Músculos del miembro pelviano (reconocimiento)
Músculos del miembro pelviano (reconocimiento)Músculos del miembro pelviano (reconocimiento)
Músculos del miembro pelviano (reconocimiento)
 
Biciplan Monterrey - Gestión social y comunicación
Biciplan Monterrey - Gestión social y comunicaciónBiciplan Monterrey - Gestión social y comunicación
Biciplan Monterrey - Gestión social y comunicación
 
BNG 2015 Annual Report
BNG 2015 Annual ReportBNG 2015 Annual Report
BNG 2015 Annual Report
 
Los andes 2[1]
Los andes 2[1]Los andes 2[1]
Los andes 2[1]
 
Diseño grafico tapicarpas
Diseño grafico tapicarpasDiseño grafico tapicarpas
Diseño grafico tapicarpas
 
Researching Social Media
Researching Social MediaResearching Social Media
Researching Social Media
 
Unitary Patent System
Unitary Patent SystemUnitary Patent System
Unitary Patent System
 
Digestión
Digestión Digestión
Digestión
 
INTRODUCCIÓN AL LIDERAZGO INNOVADOR 4h (parte 2de2)
INTRODUCCIÓN AL LIDERAZGO INNOVADOR 4h (parte 2de2)INTRODUCCIÓN AL LIDERAZGO INNOVADOR 4h (parte 2de2)
INTRODUCCIÓN AL LIDERAZGO INNOVADOR 4h (parte 2de2)
 
Web services, the ws stack, and research prospects a survey
Web services, the ws stack, and research prospects   a surveyWeb services, the ws stack, and research prospects   a survey
Web services, the ws stack, and research prospects a survey
 
04 clean techalps
04 clean techalps04 clean techalps
04 clean techalps
 
Eva gomez orea_unidad_2
Eva gomez orea_unidad_2Eva gomez orea_unidad_2
Eva gomez orea_unidad_2
 
La rana saltarina de Thales
La rana saltarina de ThalesLa rana saltarina de Thales
La rana saltarina de Thales
 
Metallica black album (guitar tabs)
Metallica   black album (guitar tabs)Metallica   black album (guitar tabs)
Metallica black album (guitar tabs)
 
02.security systems
02.security systems02.security systems
02.security systems
 
05 yoigo
05 yoigo05 yoigo
05 yoigo
 
Compendium urinalysis
Compendium urinalysisCompendium urinalysis
Compendium urinalysis
 

Similaire à Jax2009 inovex-tjoch-lift-20090423

Lift scaffolding from existing database
Lift scaffolding from existing databaseLift scaffolding from existing database
Lift scaffolding from existing databasetalexandre
 
Scala overview
Scala overviewScala overview
Scala overviewSteve Min
 
Scala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJSScala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJSAlberto Paro
 
Alberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsAlberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsScala Italy
 
Scala, Akka, and Play: An Introduction on Heroku
Scala, Akka, and Play: An Introduction on HerokuScala, Akka, and Play: An Introduction on Heroku
Scala, Akka, and Play: An Introduction on HerokuHavoc Pennington
 
Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019
Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019
Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019Thomas Weise
 
Martin Odersky: What's next for Scala
Martin Odersky: What's next for ScalaMartin Odersky: What's next for Scala
Martin Odersky: What's next for ScalaMarakana Inc.
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js frameworkBen Lin
 
Introducing eclipse rap
Introducing eclipse rapIntroducing eclipse rap
Introducing eclipse rapOwen Ou
 
Extending Oracle E-Business Suite with Ruby on Rails
Extending Oracle E-Business Suite with Ruby on RailsExtending Oracle E-Business Suite with Ruby on Rails
Extending Oracle E-Business Suite with Ruby on RailsRaimonds Simanovskis
 
Scala4sling
Scala4slingScala4sling
Scala4slingday
 
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
 

Similaire à Jax2009 inovex-tjoch-lift-20090423 (20)

Lift scaffolding from existing database
Lift scaffolding from existing databaseLift scaffolding from existing database
Lift scaffolding from existing database
 
Scala overview
Scala overviewScala overview
Scala overview
 
Intro lift
Intro liftIntro lift
Intro lift
 
Full Stack Scala
Full Stack ScalaFull Stack Scala
Full Stack Scala
 
GlassFish v3 : En Route Java EE 6
GlassFish v3 : En Route Java EE 6GlassFish v3 : En Route Java EE 6
GlassFish v3 : En Route Java EE 6
 
Scala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJSScala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJS
 
Alberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsAlberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.js
 
Scala, Akka, and Play: An Introduction on Heroku
Scala, Akka, and Play: An Introduction on HerokuScala, Akka, and Play: An Introduction on Heroku
Scala, Akka, and Play: An Introduction on Heroku
 
Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019
Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019
Python Streaming Pipelines on Flink - Beam Meetup at Lyft 2019
 
Java 8 Lambda
Java 8 LambdaJava 8 Lambda
Java 8 Lambda
 
Martin Odersky: What's next for Scala
Martin Odersky: What's next for ScalaMartin Odersky: What's next for Scala
Martin Odersky: What's next for Scala
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js framework
 
Introducing eclipse rap
Introducing eclipse rapIntroducing eclipse rap
Introducing eclipse rap
 
Extending Oracle E-Business Suite with Ruby on Rails
Extending Oracle E-Business Suite with Ruby on RailsExtending Oracle E-Business Suite with Ruby on Rails
Extending Oracle E-Business Suite with Ruby on Rails
 
Devoxx
DevoxxDevoxx
Devoxx
 
Scala4sling
Scala4slingScala4sling
Scala4sling
 
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" />
 
Prototype-1
Prototype-1Prototype-1
Prototype-1
 
Prototype-1
Prototype-1Prototype-1
Prototype-1
 

Plus de inovex GmbH

lldb – Debugger auf Abwegen
lldb – Debugger auf Abwegenlldb – Debugger auf Abwegen
lldb – Debugger auf Abwegeninovex GmbH
 
Are you sure about that?! Uncertainty Quantification in AI
Are you sure about that?! Uncertainty Quantification in AIAre you sure about that?! Uncertainty Quantification in AI
Are you sure about that?! Uncertainty Quantification in AIinovex GmbH
 
Why natural language is next step in the AI evolution
Why natural language is next step in the AI evolutionWhy natural language is next step in the AI evolution
Why natural language is next step in the AI evolutioninovex GmbH
 
Network Policies
Network PoliciesNetwork Policies
Network Policiesinovex GmbH
 
Interpretable Machine Learning
Interpretable Machine LearningInterpretable Machine Learning
Interpretable Machine Learninginovex GmbH
 
Jenkins X – CI/CD in wolkigen Umgebungen
Jenkins X – CI/CD in wolkigen UmgebungenJenkins X – CI/CD in wolkigen Umgebungen
Jenkins X – CI/CD in wolkigen Umgebungeninovex GmbH
 
AI auf Edge-Geraeten
AI auf Edge-GeraetenAI auf Edge-Geraeten
AI auf Edge-Geraeteninovex GmbH
 
Prometheus on Kubernetes
Prometheus on KubernetesPrometheus on Kubernetes
Prometheus on Kubernetesinovex GmbH
 
Deep Learning for Recommender Systems
Deep Learning for Recommender SystemsDeep Learning for Recommender Systems
Deep Learning for Recommender Systemsinovex GmbH
 
Representation Learning von Zeitreihen
Representation Learning von ZeitreihenRepresentation Learning von Zeitreihen
Representation Learning von Zeitreiheninovex GmbH
 
Talk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale AssistentenTalk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale Assistenteninovex GmbH
 
Künstlich intelligent?
Künstlich intelligent?Künstlich intelligent?
Künstlich intelligent?inovex GmbH
 
Das Android Open Source Project
Das Android Open Source ProjectDas Android Open Source Project
Das Android Open Source Projectinovex GmbH
 
Machine Learning Interpretability
Machine Learning InterpretabilityMachine Learning Interpretability
Machine Learning Interpretabilityinovex GmbH
 
Performance evaluation of GANs in a semisupervised OCR use case
Performance evaluation of GANs in a semisupervised OCR use casePerformance evaluation of GANs in a semisupervised OCR use case
Performance evaluation of GANs in a semisupervised OCR use caseinovex GmbH
 
People & Products – Lessons learned from the daily IT madness
People & Products – Lessons learned from the daily IT madnessPeople & Products – Lessons learned from the daily IT madness
People & Products – Lessons learned from the daily IT madnessinovex GmbH
 
Infrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with PulumiInfrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with Pulumiinovex GmbH
 

Plus de inovex GmbH (20)

lldb – Debugger auf Abwegen
lldb – Debugger auf Abwegenlldb – Debugger auf Abwegen
lldb – Debugger auf Abwegen
 
Are you sure about that?! Uncertainty Quantification in AI
Are you sure about that?! Uncertainty Quantification in AIAre you sure about that?! Uncertainty Quantification in AI
Are you sure about that?! Uncertainty Quantification in AI
 
Why natural language is next step in the AI evolution
Why natural language is next step in the AI evolutionWhy natural language is next step in the AI evolution
Why natural language is next step in the AI evolution
 
WWDC 2019 Recap
WWDC 2019 RecapWWDC 2019 Recap
WWDC 2019 Recap
 
Network Policies
Network PoliciesNetwork Policies
Network Policies
 
Interpretable Machine Learning
Interpretable Machine LearningInterpretable Machine Learning
Interpretable Machine Learning
 
Jenkins X – CI/CD in wolkigen Umgebungen
Jenkins X – CI/CD in wolkigen UmgebungenJenkins X – CI/CD in wolkigen Umgebungen
Jenkins X – CI/CD in wolkigen Umgebungen
 
AI auf Edge-Geraeten
AI auf Edge-GeraetenAI auf Edge-Geraeten
AI auf Edge-Geraeten
 
Prometheus on Kubernetes
Prometheus on KubernetesPrometheus on Kubernetes
Prometheus on Kubernetes
 
Deep Learning for Recommender Systems
Deep Learning for Recommender SystemsDeep Learning for Recommender Systems
Deep Learning for Recommender Systems
 
Azure IoT Edge
Azure IoT EdgeAzure IoT Edge
Azure IoT Edge
 
Representation Learning von Zeitreihen
Representation Learning von ZeitreihenRepresentation Learning von Zeitreihen
Representation Learning von Zeitreihen
 
Talk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale AssistentenTalk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale Assistenten
 
Künstlich intelligent?
Künstlich intelligent?Künstlich intelligent?
Künstlich intelligent?
 
Dev + Ops = Go
Dev + Ops = GoDev + Ops = Go
Dev + Ops = Go
 
Das Android Open Source Project
Das Android Open Source ProjectDas Android Open Source Project
Das Android Open Source Project
 
Machine Learning Interpretability
Machine Learning InterpretabilityMachine Learning Interpretability
Machine Learning Interpretability
 
Performance evaluation of GANs in a semisupervised OCR use case
Performance evaluation of GANs in a semisupervised OCR use casePerformance evaluation of GANs in a semisupervised OCR use case
Performance evaluation of GANs in a semisupervised OCR use case
 
People & Products – Lessons learned from the daily IT madness
People & Products – Lessons learned from the daily IT madnessPeople & Products – Lessons learned from the daily IT madness
People & Products – Lessons learned from the daily IT madness
 
Infrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with PulumiInfrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with Pulumi
 

Dernier

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 

Dernier (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Jax2009 inovex-tjoch-lift-20090423

  • 1. GeLiftete Web-Applikation mit Scala JAX 2009 Tobias Joch inovex GmbH Wir nutzen Technologien, um unsere Kunden glücklich zu machen. Und uns selbst.
  • 2. Scala Lift Grundlagen Architektur Überblick Module Template Verarbeitung Tags und Snippets Head Merge Scopes I18n Persistenz AJAX in Action Fazit / Ausblick / weiterführende Informationen 2
  • 3. 3
  • 4. Scala = SCAlable LAnguage 4
  • 5. Scala = SCAlable LAnguage wächst mit den Bedürfnissen der User kleine Skripte bis hin zu großen und komplexen Systemen Multiparadigmensprache verbindet objektorientierte (imperative) und funktionale Programmierung pragmatisch, typsicher, strikt objektorientiert interoperabel mit Standard Plattformen (Java, .NET) 4
  • 6. Wurzeln reichen zurück in das Jahr 1995 Philip Wadler und Martin Odersky Funktionale Programmiersprachen für die JVM Pizza GJ (Generic Language Extension für Java) javac Java Generics 1999 verfolgte Martin Odersky das Ziel funktionale mit OO Programmierung zu kombinieren Funnel Scala *2001, 2003 erstes Public Release, 2006 Version 2.0, aktuell 2.7.4 RC1 5
  • 7. Ziel von Scala: Das Beste aus beiden Welten (OO und FP) Statisch typisiert + Typinferenz Funktionen höherer Ordnung Traits, Mixin-Komposition Option-Klasse (None und Some vs. null) Pattern Matching Algebraische Typen Native XML-Unterstützung inkl. XPath Unterstützung (Bibliothek) Actor Model Currying Anonyme Funktionen Parametrische Polymorphie 6
  • 8. Einige reservierte Schlüsselwörter in Scala class, case class, object new with extends abstract sealed trait def, var, val override match, case 7
  • 10. Scala Shell Interactive Ruby Shell (IRB) ./scala Optimal für schnelle Tests 9
  • 11. Scala Shell Interactive Ruby Shell (IRB) ./scala Optimal für schnelle Tests 9
  • 12. Scala Shell Interactive Ruby Shell (IRB) ./scala Optimal für schnelle Tests 9
  • 13. Imperative vs. funktionale Programmierung (I) public class Example1 { public static void main(String[] args) { for (String arg : args) { System.out.println(arg); } } } 10
  • 14. Imperative vs. funktionale Programmierung (I) public class Example1 { public static void main(String[] args) { for (String arg : args) { System.out.println(arg); } } } object Example1 { def main(args: Array[String]) { args.foreach(println) } } 10
  • 15. Imperative vs. funktionale Programmierung (II) public class Example2 { public static void main(String[] args) { for (String arg : args) { if (arg.startsWith("JAX09")) { System.out.println(arg); } } } } 11
  • 16. Imperative vs. funktionale Programmierung (II) public class Example2 { public static void main(String[] args) { for (String arg : args) { if (arg.startsWith("JAX09")) { System.out.println(arg); } } } } object Example2 { def main(args: Array[String]) { args.filter(_.startsWith("JAX09")).foreach(println) } } 11
  • 17. Imperative vs. funktionale Programmierung (III) public class Example3 { public static void main(String[] args) { boolean exists = false; for (String arg : args) { if (arg.startsWith("JAX09")) { exists = true; break; } } System.out.print(exists); } } 12
  • 18. Imperative vs. funktionale Programmierung (III) public class Example3 { public static void main(String[] args) { boolean exists = false; for (String arg : args) { if (arg.startsWith("JAX09")) { exists = true; break; } } System.out.print(exists); } } object Example3 { def main(args: Array[String]) { print(args.exists(_.startsWith("JAX09"))) } } 12
  • 20. David Pollak Gründer von Lift Kommerzielle Softwareentwicklung seit 1977 Web-Applikationen seit 1996 15. Februar 2007: Initial Import (GitHub) in der Version 0.1.0 Gründung von Lift als OS Projekt in 2007 26. Februar 2009: Lift 1.0 Aktuelles Lift-Team besteht aus 13 Comitter Aktive Community http://groups.google.com/group/liftweb 14
  • 21. „Best of all“ Scala als zugrundeliegende Sprache nativer XML-Support (XHTML nativ innerhalb von Snippets!) Scala Actors für mächtige Comet-Anwendungen fein granulare Sessions und Security (Seaside) schnelles Projektsetup durch „convention over configuration“ + geringe Turnaround-Zeiten (Rails) Django's "more than just CRUD is included" Designer freundliche Templates (Wicket / Lift View First) Offen für die Nutzung von zahlreichen OSS-Bibliotheken (Java) Etablierte Deployment-Prozesse (JEE / Java) 15
  • 22. Weitere Eigenschaften / Ziele von Lift Sicherheit XSS, replay Attacken, Parameter tampering Wartbarkeit Skalierbarkeit Performance Hohe Produktivität Einfach Convention over configuration DRY 16
  • 23. „View First“ Design-Prinzip Templates enthalten keinen Code Pures XHTML Können mit Standard Design-Werkzeugen bearbeitet werden Frontend ist ohne Scala-Kenntnisse von einem Designer realisierbar <lift:surround with="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> 17
  • 26. Lift-Framework Scala Framework 19
  • 27. Lift-Framework Lift-Framework Scala Framework 19
  • 28. Lift-Framework Lift Core Lift-Framework Scala Framework 19
  • 29. LiftSession LiftRules LiftResponse Lift-Framework S SHtml JS API Lift Core Lift Webkit SiteMap Menu, Msgs, Lift-Framework Scala Framework CSS HTTP Auth Comet 19
  • 30. LiftSession LiftRules Mapper LiftResponse Lift-Framework S SHtml Record JS API Lift Core Lift Webkit SiteMap Menu, Msgs, Lift-Framework Scala Framework CSS HTTP Auth Comet 19
  • 31. Lift-Framework Mapper Record Testkit LiftResponse Menu, Msgs, LiftSession HTTP Auth LiftRules SiteMap JS API SHtml Comet CSS S Lift Webkit Lift Core Lift-Framework Scala Framework 19
  • 32. Lift-Framework Mapper Record Testkit LiftResponse Menu, Msgs, LiftSession HTTP Auth LiftRules SiteMap JS API SHtml Comet CSS S Lift Webkit Lift Util Lift Core Lift-Framework Scala Framework 19
  • 33. Lift-Framework Lift XMPP Mapper Record Testkit Lift Facebook LiftResponse Menu, Msgs, LiftSession HTTP Auth Lift Widgets LiftRules SiteMap JS API SHtml Comet CSS S Lift OpenId Lift Webkit Lift OAuth Lift Util Lift Paypal Lift Core Lift AMQP Lift-Framework Scala Framework 19
  • 34. Grobe Architektur einer Lift-Applikation 20
  • 35. Grobe Architektur einer Lift-Applikation Java Virtual Machine 20
  • 36. Grobe Architektur einer Lift-Applikation Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 37. Grobe Architektur einer Lift-Applikation Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 38. Grobe Architektur einer Lift-Applikation Templates Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 39. Grobe Architektur einer Lift-Applikation Templates Snippets Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 40. Grobe Architektur einer Lift-Applikation Templates Snippets Views Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 41. Grobe Architektur einer Lift-Applikation Templates Snippets Views Boot.scala (LiftRules etc,) Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 42. Grobe Architektur einer Lift-Applikation Templates Snippets Model Views Boot.scala (LiftRules etc,) Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 43. Grobe Architektur einer Lift-Applikation Templates Snippets Model LiftFilter Views Boot.scala (LiftRules etc,) Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 44. Grobe Architektur einer Lift-Applikation Templates Snippets LiftServlet Model LiftFilter Views Boot.scala (LiftRules etc,) Lift Framework Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 45. Grobe Architektur einer Lift-Applikation Templates Snippets LiftServlet Model LiftFilter Views Boot.scala (LiftRules etc,) Lift Framework DefaultServlet Servlet Container (e.g. Jetty or Tomcat) Java Virtual Machine 20
  • 46. Grober Ablauf einer Anfragenbearbeitung Request URL rewrite custom dispatch Template View Response Response Response Response 21
  • 47. Grober Ablauf einer Anfragenbearbeitung Template Request URL rewrite custom dispatch View Response Response Response Response 21
  • 48. Template Template Verarbeitung Request Mapping nach folgendem Schema 22
  • 49. Template Template Verarbeitung Request Mapping nach folgendem Schema <path>[_<language, optional>][.<suffix>] 22
  • 50. Template Template Verarbeitung Request Mapping nach folgendem Schema <path>[_<language, optional>][.<suffix>] Lift wählt die passende Sprache und Endung 22
  • 51. Template Template Verarbeitung Request Mapping nach folgendem Schema <path>[_<language, optional>][.<suffix>] Lift wählt die passende Sprache und Endung Links ohne Sprache und Endung angeben 22
  • 52. Template Template Verarbeitung Request Mapping nach folgendem Schema <path>[_<language, optional>][.<suffix>] Lift wählt die passende Sprache und Endung Links ohne Sprache und Endung angeben Lift versteckt Templates und Ressourcen in Verzeichnissen welche als Endung -hidden im Namen tragen 22
  • 53. Template Template Verarbeitung Request Mapping nach folgendem Schema <path>[_<language, optional>][.<suffix>] Lift wählt die passende Sprache und Endung Links ohne Sprache und Endung angeben Lift versteckt Templates und Ressourcen in Verzeichnissen welche als Endung -hidden im Namen tragen 22
  • 54. Template 23
  • 55. Template Templates = Content + Tags + Snippets 23
  • 56. Template Templates = Content + Tags + Snippets Tags = Lift spezifische Funktionen surround bind embed comet loc 23
  • 57. Template Templates = Content + Tags + Snippets Tags = Lift spezifische Funktionen surround bind embed comet loc Snippets vergleichbar mit Taglibs <lift:snippet type=Jax:render /> <lift:Jax.render /> <lift:Jax /> 23
  • 58. Template Template Verarbeitung von Außen nach Innen 24
  • 59. Template Template Verarbeitung von Außen nach Innen /index.html <lift:surround with="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:HelloWorld.howdy /></p> </lift:surround> 24
  • 60. Template Template Verarbeitung von Außen nach Innen /index.html <lift:surround with="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:HelloWorld.howdy /></p> </lift:surround> /templates-hidden/default.html <html xmlns="..." xmlns:lift="http://liftweb.net/"> <head>...</head> <body> ... <lift:bind name="content" /> </body> </html> 24
  • 61. Template Template Verarbeitung von Außen nach Innen /index.html <lift:surround with="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:HelloWorld.howdy /></p> </lift:surround> /templates-hidden/default.html <html xmlns="..." xmlns:lift="http://liftweb.net/"> <head>...</head> <body> ... <lift:bind name="content" /> </body> </html> Ausführung von HelloWorld#howdy 24
  • 63. Template Head Merge /index.html <lift:surround with="default" at="content"> <head><script type="text/javascript">...</script>...</head> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> 25
  • 64. Template Head Merge /index.html <lift:surround with="default" at="content"> <head><script type="text/javascript">...</script>...</head> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> /templates-hidden/default.html <html xmlns="..." xmlns:lift="http://liftweb.net/"> <head>...</head> <body> ... <lift:bind name="content" /> </body> </html> 25
  • 65. Template Head Merge /index.html <lift:surround with="default" at="content"> <head><script type="text/javascript">...</script>...</head> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> /templates-hidden/default.html <html xmlns="..." xmlns:lift="http://liftweb.net/"> <head>...</head> <body> ... <lift:bind name="content" /> </body> </html> 25
  • 66. Scopes S Stateful Snippet RequestVar SessionVar Scala Object (Singleton) 26
  • 67. Internationalisierung / I18n java.util.Locale java.util.ResourceBundle LiftRules.resourceNames Ermittlung der aktuellen Sprache LiftRules.localeCalculator Request-Header Fallback: Locale.getDefault() Snippets S.? Templates <lift:loc locid="lift">Aufzug</lift:loc> <lift:loc>lift</lift:loc> 27
  • 68. Persistenz in Lift Mapper Record JPA JDO Hibernate ... Lift selbst ist Persistenz agnostisch 28
  • 69. AJAX in Lift SHtml ajaxButton ajaxText ajaxCheckbox ... def render(in: NodeSeq): NodeSeq = SHtml.ajaxButton("Click me ;)", () => { println("Yes, thanks!") JsCmds.SetHtml("click-div", Text("Yes, thanks!")) }) 29
  • 71. Entwicklungsumgebung Java (>= 5) Maven (>= 2.0.9) Web-Container (Jetty, Tomcat, ...) Optional, aber nützlich JavaRebel (JVM Plugin / Java Agent) IDE mit Scala Support / Plugin (Eclipse, IDEA, Netbeans, ...) http://www.scala-lang.org/scala-eclipse-plugin 31
  • 73. Projekt anlegen $mvn archetype:generate -U -DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype-basic -DarchetypeVersion=1.0 -DgroupId=de.inovex.jax2009.lift -DartifactId=lift-demo 32
  • 74. Projekt anlegen $mvn archetype:generate -U -DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype-basic -DarchetypeVersion=1.0 -DgroupId=de.inovex.jax2009.lift -DartifactId=lift-demo Import in Eclipse vorbereiten $cd lift-demo && mvn eclipse:eclipse 32
  • 82. index.html <lift:surround with="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> 35
  • 83. index.html <lift:surround with="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> HelloWorld.scala 35
  • 84. index.html <lift:surround with="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> HelloWorld.scala import java.util.Date class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date}</span> } 35
  • 85. index.html <lift:surround with="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> HelloWorld.scala import java.util.Date class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date}</span> } 35
  • 86. index.html <lift:surround with="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> HelloWorld.scala import java.util.Date class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date}</span> } 35
  • 87. index.html <lift:surround with="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> HelloWorld.scala import java.util.Date class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date}</span> } 35
  • 88. index.html <lift:surround with="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> HelloWorld.scala import java.util.Date class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date}</span> } 35
  • 89. index.html <lift:surround with="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> HelloWorld.scala import java.util.Date class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date}</span> } 35
  • 90. index.html <lift:surround with="default" at="content"> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> HelloWorld.scala import java.util.Date class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date}</span> } 35
  • 92. default.html <div class="container"> <div class="column span-12 last" style="text-align: right"> <h1 class="alt">lift-demo <img id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px" src="/images/ajax-loader.gif"/></h1> </div> <hr/> <div class="column span-6 colborder sidebar"> <hr class="space" /> <lift:Menu.builder /> <div> <lift:snippet type="msgs"/> <hr class="space" /> </div> </div> <div class="column span-17 last"> <lift:bind name="content" /> </div> <hr /> <div class="column span-23 last" style="text-align: center"> <h4 class="alt"> <a href="http://liftweb.net"><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  • 93. default.html <div class="container"> <div class="column span-12 last" style="text-align: right"> <h1 class="alt">lift-demo <img id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px" src="/images/ajax-loader.gif"/></h1> </div> <hr/> <div class="column span-6 colborder sidebar"> <hr class="space" /> <lift:Menu.builder /> <div> <lift:snippet type="msgs"/> <hr class="space" /> </div> </div> <div class="column span-17 last"> <lift:bind name="content" /> </div> <hr /> <div class="column span-23 last" style="text-align: center"> <h4 class="alt"> <a href="http://liftweb.net"><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  • 94. default.html <div class="container"> <div class="column span-12 last" style="text-align: right"> <h1 class="alt">lift-demo <img id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px" src="/images/ajax-loader.gif"/></h1> </div> <hr/> <div class="column span-6 colborder sidebar"> <hr class="space" /> <lift:Menu.builder /> <div> <lift:snippet type="msgs"/> <hr class="space" /> </div> </div> <div class="column span-17 last"> <lift:bind name="content" /> </div> <hr /> <div class="column span-23 last" style="text-align: center"> <h4 class="alt"> <a href="http://liftweb.net"><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  • 95. default.html <div class="container"> <div class="column span-12 last" style="text-align: right"> <h1 class="alt">lift-demo <img id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px" src="/images/ajax-loader.gif"/></h1> </div> <hr/> <div class="column span-6 colborder sidebar"> <hr class="space" /> <lift:Menu.builder /> <div> <lift:snippet type="msgs"/> <hr class="space" /> </div> </div> <div class="column span-17 last"> <lift:bind name="content" /> </div> <hr /> <div class="column span-23 last" style="text-align: center"> <h4 class="alt"> <a href="http://liftweb.net"><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  • 96. default.html <div class="container"> <div class="column span-12 last" style="text-align: right"> <h1 class="alt">lift-demo <img id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px" src="/images/ajax-loader.gif"/></h1> </div> <hr/> <div class="column span-6 colborder sidebar"> <hr class="space" /> <lift:Menu.builder /> <div> <lift:snippet type="msgs"/> <hr class="space" /> </div> </div> <div class="column span-17 last"> <lift:bind name="content" /> </div> <hr /> <div class="column span-23 last" style="text-align: center"> <h4 class="alt"> <a href="http://liftweb.net"><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  • 97. default.html <div class="container"> <div class="column span-12 last" style="text-align: right"> <h1 class="alt">lift-demo <img id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px" src="/images/ajax-loader.gif"/></h1> </div> <hr/> <div class="column span-6 colborder sidebar"> <hr class="space" /> <lift:Menu.builder /> <div> <lift:snippet type="msgs"/> <hr class="space" /> </div> </div> <div class="column span-17 last"> <lift:bind name="content" /> </div> <hr /> <div class="column span-23 last" style="text-align: center"> <h4 class="alt"> <a href="http://liftweb.net"><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  • 99. Boot.scala def boot { if (!DB.jndiJdbcConnAvailable_?) DB.defineConnectionManager(DefaultConnectionIdentifier, DBVendor) // where to search snippet LiftRules.addToPackages("de.inovex.jax2009.lift") // create or update the database schema Schemifier.schemify(true, Log.infoF _, User) // build site map val entries = Menu(Loc("Home", List("index"), "Home")) :: User.sitemap LiftRules.setSiteMap(SiteMap(entries:_*)) // Show the spinny image when an Ajax call starts LiftRules.ajaxStart = Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd) // 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(makeUtf8) S.addAround(DB.buildLoanWrapper) } 37
  • 101. Rekursive Template Komposition class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date} at <lift:helloWorld.howdy2 /></span> def howdy2 = <span>JAX 2009!</span> } 38
  • 102. Rekursive Template Komposition class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date} at <lift:helloWorld.howdy2 /></span> def howdy2 = <span>JAX 2009!</span> } 38
  • 103. Rekursive Template Komposition class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date} at <lift:helloWorld.howdy2 /></span> def howdy2 = <span>JAX 2009!</span> } 38
  • 104. Rekursive Template Komposition class HelloWorld { def howdy = <span>Welcome to lift-demo at {new Date} at <lift:helloWorld.howdy2 /></span> def howdy2 = <span>JAX 2009!</span> } 38
  • 105. Formulare <lift:surround with="default" at="content"> <h2>Very first form example:</h2> <p> <lift:FormExample form="POST"> <f:name><input type="text"/></f:name> <input type="submit" value="Post"/> </lift:FormExample> </p> </lift:surround> 39
  • 106. Formulare <lift:surround with="default" at="content"> <h2>Very first form example:</h2> <p> <lift:FormExample form="POST"> <f:name><input type="text"/></f:name> <input type="submit" value="Post"/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind("f", xhtml, "name" -> text("", println(_))) } } 39
  • 107. Formulare <lift:surround with="default" at="content"> <h2>Very first form example:</h2> <p> <lift:FormExample form="POST"> <f:name><input type="text"/></f:name> <input type="submit" value="Post"/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind("f", xhtml, "name" -> text("", println(_))) } } 39
  • 108. Formulare <lift:surround with="default" at="content"> <h2>Very first form example:</h2> <p> <lift:FormExample form="POST"> <f:name><input type="text"/></f:name> <input type="submit" value="Post"/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind("f", xhtml, "name" -> text("", println(_))) } } 39
  • 109. Formulare <lift:surround with="default" at="content"> <h2>Very first form example:</h2> <p> <lift:FormExample form="POST"> <f:name><input type="text"/></f:name> <input type="submit" value="Post"/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind("f", xhtml, "name" -> text("", println(_))) } } 39
  • 110. Formulare <lift:surround with="default" at="content"> <h2>Very first form example:</h2> <p> <lift:FormExample form="POST"> <f:name><input type="text"/></f:name> <input type="submit" value="Post"/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind("f", xhtml, "name" -> text("", println(_))) } } // in boot.scala: val entries = Menu(Loc("Home", List("index"), "Home")) :: Menu(Loc("form1", List("veryFirstForm"), "Example")) :: User.sitemap LiftRules.setSiteMap(SiteMap(entries:_*)) 39
  • 111. Formulare <lift:surround with="default" at="content"> <h2>Very first form example:</h2> <p> <lift:FormExample form="POST"> <f:name><input type="text"/></f:name> <input type="submit" value="Post"/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind("f", xhtml, "name" -> text("", println(_))) } } // in boot.scala: val entries = Menu(Loc("Home", List("index"), "Home")) :: Menu(Loc("form1", List("veryFirstForm"), "Example")) :: User.sitemap LiftRules.setSiteMap(SiteMap(entries:_*)) 39
  • 112. Formulare 40
  • 113. Formulare 40
  • 114. Formulare JAX 2009! INFO - Service request (POST) /veryFirstForm took 61 Milliseconds 40
  • 115. Formulare JAX 2009! INFO - Service request (POST) /veryFirstForm took 61 Milliseconds 40
  • 116. more in Action ;) 41
  • 117. Beispiel-Applikation(en) Scala Actors / Comet Modelle / OR-Mapping SiteMap Messages ... 42
  • 118. Beispiel-Applikation(en) Scala Actors / Comet Modelle / OR-Mapping SiteMap Messages ... Demo ! 42
  • 120. 44
  • 121. Pro Sehr schicke Sprachfeatures „Best of all“ Prinzip Junge und dynamische Community Sehr gut für interaktive Webbapplikationen („Real time web“) Native, volle JVM Geschwindigkeit 100% kompatibel mit Java Läuft auf Standard Servlet-Container (Jetty, Tomcat, ...) 44
  • 122. Pro Sehr schicke Sprachfeatures „Best of all“ Prinzip Junge und dynamische Community Sehr gut für interaktive Webbapplikationen („Real time web“) Native, volle JVM Geschwindigkeit 100% kompatibel mit Java Läuft auf Standard Servlet-Container (Jetty, Tomcat, ...) Cons Steile Lernkurve Wenig Scala Ressourcen am Markt verfügbar (XING: 164) Noch weniger Lift Ressourcen verfügbar (XING: 3) Keine mir bekannten große Installationen aktuell vorzeigbar 44
  • 123. Aktuell Roadmap 1.1 (Auszug der Lift Newsgroup) Improved documentation: better VScalaDoc coverage as well as better tutorial and cook-book documentation. Improved J2EE support including JTA and Portlets. Finish Record/Field code with backing store including JDBC, JPA and Goat Rodeo (what's Goat Rodeo? http://goatrodeo.org) Improved client-side JavaScript support and better JavaScript abstractions. Client/Server data synchronization (integrated with Record/Field) Improved support for REST. Improved performance including caching templates when running in production mode. OSGi support. Improved testing framework and better testing support when running in "test" mode. Implement Servlet 3.0 support. HTML 5 and Web Sockets support and integration with Kaazing's Web Sockets server. Also, sensing which browser is making the request and performing optimizations based on that browser's characteristics (specifically, Chrome and Firefox 3.1 support) 45
  • 124. Ressourcen im Netz Scala http://scala-lang.org Lift http://liftweb.net/ http://liftweb.net/docs/getting_started.html http://wiki.liftweb.net/ http://github.com/dpp/liftweb Lift Buch: „Exploring Lift“ http://groups.google.com/group/the-lift-book http://github.com/tjweir/liftbook/ 46
  • 125. Exploring Lift Mail 2009, oder LyX Version! Derek Chen-Becker, Tyler Weir, Marius Danciu Beginning Scala Mail 2009 David Pollak Programming in Scala Martin Odersky, Lex Spoon, and Bill Venners ... 47
  • 126. Fragen & Antworten Tobias Joch System Architecture Project Management inovex GmbH Karlsruher Straße 71 75179 Pforzheim 0173.3181 004 tobias.joch@inovex.de www.inovex.de Wir nutzen Technologien, um unsere Kunden glücklich zu machen. Und uns selbst.
  • 127. Vielen Dank! ;) Tobias Joch System Architecture Project Management inovex GmbH Karlsruher Straße 71 75179 Pforzheim 0173.3181 004 tobias.joch@inovex.de www.inovex.de Wir nutzen Technologien, um unsere Kunden glücklich zu machen. Und uns selbst.