GeLiftete Web-Applikation mit Scala - Tobias Joch - inovex GmbH
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

GeLiftete Web-Applikation mit Scala - Tobias Joch - inovex GmbH

on

  • 2,182 views

Webframeworks für Java müssen nicht zwangsläufig in Java geschrieben sein. Neben prominenten Vertretern wie Grails oder JRuby entstehen weitere, wie z.B. das erst kürzlich in der Version 1.0 ...

Webframeworks für Java müssen nicht zwangsläufig in Java geschrieben sein. Neben prominenten Vertretern wie Grails oder JRuby entstehen weitere, wie z.B. das erst kürzlich in der Version 1.0 erschiene Framework Lift. Lift ist in der funktionalen und objektorientierten Programmiersprache Scala geschrieben und lässt sich nahtlos in bestehende Java-Anwendungen integrieren. Innerhalb dieses Vortrags wird Lift anhand einer Beispielanwendung vorgestellt.

Statistics

Views

Total Views
2,182
Views on SlideShare
2,173
Embed Views
9

Actions

Likes
0
Downloads
23
Comments
0

2 Embeds 9

http://www.slideshare.net 8
http://www.slashdocs.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

GeLiftete Web-Applikation mit Scala - Tobias Joch - inovex GmbH Presentation Transcript

  • 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
  • 9. in Action ;) 8
  • 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(quot;JAX09quot;)) { 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(quot;JAX09quot;)) { System.out.println(arg); } } } } object Example2 { def main(args: Array[String]) { args.filter(_.startsWith(quot;JAX09quot;)).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(quot;JAX09quot;)) { 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(quot;JAX09quot;)) { exists = true; break; } } System.out.print(exists); } } object Example3 { def main(args: Array[String]) { print(args.exists(_.startsWith(quot;JAX09quot;))) } } 12
  • 19. Grundlagen 13
  • 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 quot;more than just CRUD is includedquot; 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=quot;defaultquot; at=quot;contentquot;> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> 17
  • 24. Architektur Überblick 18
  • 25. Lift-Framework 19
  • 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 OAuth Lift Webkit Lift Paypal Lift Util Lift AMQP Lift Core 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=quot;defaultquot; at=quot;contentquot;> <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=quot;defaultquot; at=quot;contentquot;> <h2>Welcome to your project!</h2> <p><lift:HelloWorld.howdy /></p> </lift:surround> /templates-hidden/default.html <html xmlns=quot;...quot; xmlns:lift=quot;http://liftweb.net/quot;> <head>...</head> <body> ... <lift:bind name=quot;contentquot; /> </body> </html> 24
  • 61. › Template Template Verarbeitung von Außen nach Innen /index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Welcome to your project!</h2> <p><lift:HelloWorld.howdy /></p> </lift:surround> /templates-hidden/default.html <html xmlns=quot;...quot; xmlns:lift=quot;http://liftweb.net/quot;> <head>...</head> <body> ... <lift:bind name=quot;contentquot; /> </body> </html> Ausführung von HelloWorld#howdy 24
  • 62. Template Head Merge 25
  • 63. Template Head Merge /index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <head><script type=quot;text/javascriptquot;>...</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=quot;defaultquot; at=quot;contentquot;> <head><script type=quot;text/javascriptquot;>...</script>...</head> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> /templates-hidden/default.html <html xmlns=quot;...quot; xmlns:lift=quot;http://liftweb.net/quot;> <head>...</head> <body> ... <lift:bind name=quot;contentquot; /> </body> </html> 25
  • 65. Template Head Merge /index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <head><script type=quot;text/javascriptquot;>...</script>...</head> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> /templates-hidden/default.html <html xmlns=quot;...quot; xmlns:lift=quot;http://liftweb.net/quot;> <head>...</head> <body> ... <lift:bind name=quot;contentquot; /> </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=quot;liftquot;>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(quot;Click me ;)quot;, () => { println(quot;Yes, thanks!quot;) JsCmds.SetHtml(quot;click-divquot;, Text(quot;Yes, thanks!quot;)) }) 29
  • 70. in Action ;) 30
  • 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
  • 72. Projekt anlegen 32
  • 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
  • 75. Projektlayout 33
  • 76. Projektlayout 33
  • 77. Projektlayout 33
  • 78. Ausführen 34
  • 79. Ausführen $mvn jetty:run 34
  • 80. Ausführen $mvn jetty:run 34
  • 81. index.html 35
  • 82. index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> 35
  • 83. index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Welcome to your project!</h2> <p><lift:helloWorld.howdy /></p> </lift:surround> HelloWorld.scala 35
  • 84. index.html <lift:surround with=quot;defaultquot; at=quot;contentquot;> <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=quot;defaultquot; at=quot;contentquot;> <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=quot;defaultquot; at=quot;contentquot;> <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=quot;defaultquot; at=quot;contentquot;> <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=quot;defaultquot; at=quot;contentquot;> <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=quot;defaultquot; at=quot;contentquot;> <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=quot;defaultquot; at=quot;contentquot;> <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
  • 91. default.html 36
  • 92. default.html <div class=quot;containerquot;> <div class=quot;column span-12 lastquot; style=quot;text-align: rightquot;> <h1 class=quot;altquot;>lift-demo <img id=quot;ajax-loaderquot; style=quot;display:none; margin-bottom: 0px; margin-left: 5pxquot; src=quot;/images/ajax-loader.gifquot;/></h1> </div> <hr/> <div class=quot;column span-6 colborder sidebarquot;> <hr class=quot;spacequot; /> <lift:Menu.builder /> <div> <lift:snippet type=quot;msgsquot;/> <hr class=quot;spacequot; /> </div> </div> <div class=quot;column span-17 lastquot;> <lift:bind name=quot;contentquot; /> </div> <hr /> <div class=quot;column span-23 lastquot; style=quot;text-align: centerquot;> <h4 class=quot;altquot;> <a href=quot;http://liftweb.netquot;><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=quot;containerquot;> <div class=quot;column span-12 lastquot; style=quot;text-align: rightquot;> <h1 class=quot;altquot;>lift-demo <img id=quot;ajax-loaderquot; style=quot;display:none; margin-bottom: 0px; margin-left: 5pxquot; src=quot;/images/ajax-loader.gifquot;/></h1> </div> <hr/> <div class=quot;column span-6 colborder sidebarquot;> <hr class=quot;spacequot; /> <lift:Menu.builder /> <div> <lift:snippet type=quot;msgsquot;/> <hr class=quot;spacequot; /> </div> </div> <div class=quot;column span-17 lastquot;> <lift:bind name=quot;contentquot; /> </div> <hr /> <div class=quot;column span-23 lastquot; style=quot;text-align: centerquot;> <h4 class=quot;altquot;> <a href=quot;http://liftweb.netquot;><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=quot;containerquot;> <div class=quot;column span-12 lastquot; style=quot;text-align: rightquot;> <h1 class=quot;altquot;>lift-demo <img id=quot;ajax-loaderquot; style=quot;display:none; margin-bottom: 0px; margin-left: 5pxquot; src=quot;/images/ajax-loader.gifquot;/></h1> </div> <hr/> <div class=quot;column span-6 colborder sidebarquot;> <hr class=quot;spacequot; /> <lift:Menu.builder /> <div> <lift:snippet type=quot;msgsquot;/> <hr class=quot;spacequot; /> </div> </div> <div class=quot;column span-17 lastquot;> <lift:bind name=quot;contentquot; /> </div> <hr /> <div class=quot;column span-23 lastquot; style=quot;text-align: centerquot;> <h4 class=quot;altquot;> <a href=quot;http://liftweb.netquot;><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=quot;containerquot;> <div class=quot;column span-12 lastquot; style=quot;text-align: rightquot;> <h1 class=quot;altquot;>lift-demo <img id=quot;ajax-loaderquot; style=quot;display:none; margin-bottom: 0px; margin-left: 5pxquot; src=quot;/images/ajax-loader.gifquot;/></h1> </div> <hr/> <div class=quot;column span-6 colborder sidebarquot;> <hr class=quot;spacequot; /> <lift:Menu.builder /> <div> <lift:snippet type=quot;msgsquot;/> <hr class=quot;spacequot; /> </div> </div> <div class=quot;column span-17 lastquot;> <lift:bind name=quot;contentquot; /> </div> <hr /> <div class=quot;column span-23 lastquot; style=quot;text-align: centerquot;> <h4 class=quot;altquot;> <a href=quot;http://liftweb.netquot;><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=quot;containerquot;> <div class=quot;column span-12 lastquot; style=quot;text-align: rightquot;> <h1 class=quot;altquot;>lift-demo <img id=quot;ajax-loaderquot; style=quot;display:none; margin-bottom: 0px; margin-left: 5pxquot; src=quot;/images/ajax-loader.gifquot;/></h1> </div> <hr/> <div class=quot;column span-6 colborder sidebarquot;> <hr class=quot;spacequot; /> <lift:Menu.builder /> <div> <lift:snippet type=quot;msgsquot;/> <hr class=quot;spacequot; /> </div> </div> <div class=quot;column span-17 lastquot;> <lift:bind name=quot;contentquot; /> </div> <hr /> <div class=quot;column span-23 lastquot; style=quot;text-align: centerquot;> <h4 class=quot;altquot;> <a href=quot;http://liftweb.netquot;><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=quot;containerquot;> <div class=quot;column span-12 lastquot; style=quot;text-align: rightquot;> <h1 class=quot;altquot;>lift-demo <img id=quot;ajax-loaderquot; style=quot;display:none; margin-bottom: 0px; margin-left: 5pxquot; src=quot;/images/ajax-loader.gifquot;/></h1> </div> <hr/> <div class=quot;column span-6 colborder sidebarquot;> <hr class=quot;spacequot; /> <lift:Menu.builder /> <div> <lift:snippet type=quot;msgsquot;/> <hr class=quot;spacequot; /> </div> </div> <div class=quot;column span-17 lastquot;> <lift:bind name=quot;contentquot; /> </div> <hr /> <div class=quot;column span-23 lastquot; style=quot;text-align: centerquot;> <h4 class=quot;altquot;> <a href=quot;http://liftweb.netquot;><i>Lift</i></a> is Copyright 2007-2009 WorldWide Conferencing, LLC. Distributed under an Apache 2.0 License.</h4> </div> </div> 36
  • 98. Boot.scala 37
  • 99. Boot.scala def boot { if (!DB.jndiJdbcConnAvailable_?) DB.defineConnectionManager(DefaultConnectionIdentifier, DBVendor) // where to search snippet LiftRules.addToPackages(quot;de.inovex.jax2009.liftquot;) // create or update the database schema Schemifier.schemify(true, Log.infoF _, User) // build site map val entries = Menu(Loc(quot;Homequot;, List(quot;indexquot;), quot;Homequot;)) :: User.sitemap LiftRules.setSiteMap(SiteMap(entries:_*)) // Show the spinny image when an Ajax call starts LiftRules.ajaxStart = Full(() => LiftRules.jsArtifacts.show(quot;ajax-loaderquot;).cmd) // Make the spinny image go away when it ends LiftRules.ajaxEnd = Full(() => LiftRules.jsArtifacts.hide(quot;ajax-loaderquot;).cmd) // force the request to be UTF-8 LiftRules.early.append(makeUtf8) S.addAround(DB.buildLoanWrapper) 37 }
  • 100. Rekursive Template Komposition 38
  • 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=quot;defaultquot; at=quot;contentquot;> <h2>Very first form example:</h2> <p> <lift:FormExample form=quot;POSTquot;> <f:name><input type=quot;textquot;/></f:name> <input type=quot;submitquot; value=quot;Postquot;/> </lift:FormExample> </p> </lift:surround> 39
  • 106. Formulare <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Very first form example:</h2> <p> <lift:FormExample form=quot;POSTquot;> <f:name><input type=quot;textquot;/></f:name> <input type=quot;submitquot; value=quot;Postquot;/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind(quot;fquot;, xhtml, quot;namequot; -> text(quot;quot;, println(_))) } } 39
  • 107. Formulare <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Very first form example:</h2> <p> <lift:FormExample form=quot;POSTquot;> <f:name><input type=quot;textquot;/></f:name> <input type=quot;submitquot; value=quot;Postquot;/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind(quot;fquot;, xhtml, quot;namequot; -> text(quot;quot;, println(_))) } } 39
  • 108. Formulare <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Very first form example:</h2> <p> <lift:FormExample form=quot;POSTquot;> <f:name><input type=quot;textquot;/></f:name> <input type=quot;submitquot; value=quot;Postquot;/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind(quot;fquot;, xhtml, quot;namequot; -> text(quot;quot;, println(_))) } } 39
  • 109. Formulare <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Very first form example:</h2> <p> <lift:FormExample form=quot;POSTquot;> <f:name><input type=quot;textquot;/></f:name> <input type=quot;submitquot; value=quot;Postquot;/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind(quot;fquot;, xhtml, quot;namequot; -> text(quot;quot;, println(_))) } } 39
  • 110. Formulare <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Very first form example:</h2> <p> <lift:FormExample form=quot;POSTquot;> <f:name><input type=quot;textquot;/></f:name> <input type=quot;submitquot; value=quot;Postquot;/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind(quot;fquot;, xhtml, quot;namequot; -> text(quot;quot;, println(_))) } } // in boot.scala: val entries = Menu(Loc(quot;Homequot;, List(quot;indexquot;), quot;Homequot;)) :: Menu(Loc(quot;form1quot;, List(quot;veryFirstFormquot;), quot;Examplequot;)) :: User.sitemap LiftRules.setSiteMap(SiteMap(entries:_*)) 39
  • 111. Formulare <lift:surround with=quot;defaultquot; at=quot;contentquot;> <h2>Very first form example:</h2> <p> <lift:FormExample form=quot;POSTquot;> <f:name><input type=quot;textquot;/></f:name> <input type=quot;submitquot; value=quot;Postquot;/> </lift:FormExample> </p> </lift:surround> class FormExample { def render(xhtml: NodeSeq) = { bind(quot;fquot;, xhtml, quot;namequot; -> text(quot;quot;, println(_))) } } // in boot.scala: val entries = Menu(Loc(quot;Homequot;, List(quot;indexquot;), quot;Homequot;)) :: Menu(Loc(quot;form1quot;, List(quot;veryFirstFormquot;), quot;Examplequot;)) :: 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
  • 119. Zusammenfassung 43
  • 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 quot;testquot; 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 45 Firefox 3.1 support)
  • 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.