SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
Web application development using Play
Framework (with Java)
Tehran JUG meeting February-2015
By: Saeed Zarinfam
History
 Play 1 Created By Guillaume Bort at Zengularity SA
in 2007
 Play 2 release in 2012 by Typesafe (rewrite using
Scala)
 Play 1 vs Play 2
 Part of Typesafe Activator
Introduction
• Inspired by Ruby on Rails and Django
• Run on JVM (use java library)
• MVC
• Stateless
• Hot code reloading (in development)
• Convention over configuration
• Lightweight
• Asynchronous and Non-blocking I/O
• Java 8 support
Architecture
• MVC architecture
• Netty as web server (no servlet container)
• Sbt as build tools (Ivy dependency manager)
• Stateless
Requirements
 Install Typesafe Activator (or sbt)

JDK 6 or later

activator new my-first-app play-java
 Open project in IDE (Eclipse and Intellij)

Run using
– command line (activator run)
– Activator console (activator)
– Activator UI (activator ui)
– Interactive Console (Only in Scala)
Activator UI
Project structure
• App
• Public
• Conf
• build.sbt
• Scala and Java
• ...
Route
• Scala syntax
• Optional parameters
• Reverse routing
• REST friendly
Controller
• Actions return Result
• Static method
• Use dependency injection (JSR 330 in Play 3)
• HTTP manipulation (body parsers)
– REST service (JSON and XML)
View
 Type safe template engine
 Scala Template (Twirl inspired by ASP.NET
Razor)
 Http form handling
Session
 Session data are not stored in the server
 Session data added to each subsequent HTTP
Request, using Cookie.
 Cookie are signed with a secret key so the
client can’t modify the cookie data or it will be
invalidated
 Use cache for sever side session data
Assets
 Public Assets
 WebJars
 Assets controller
 Etag

Gzip
 Caching
 Managed Assets
 CoffeeScript
 LESS CSS

Sbt-web plugins

js-engine plugin (able to execute plugins written to the Node API either
within the JVM via the excellent Trireme)
Hot code reloading (in
development)
 It is possible because Play is stateless and tightly integration between Play and sbt
 Classloader hierarchy manage by sbt

Tricky (You don't need JRebel)
 For each request reloader check if there's any code changes
 Compile changed codes
 remove the old application classloader
 create a new application classloader with the updated classes.
 restart application (only application, no need to restart the JVM)
Accessing Database
 JDBC
 JPA (2.0)
 Ebeans (default ORM)
 Database evolutions
 Connection Pool
 Transaction
 In-memory H2 database
Asynchronous
 Actions are asynchronous by default
 Each open connection does not need a thread
 application code should avoid blocking in
controllers
Other APIs

Integration with Akka

WebSockets and Comet sockets

Cache API

Internationalization

Interceptors

Filters(only in Scala)

JSON API (jackson)

XML API

Job scheduling (Using Akka)

Logging API (Logback)
Testing

Ready to use application stubs for test (several helper methods)

Junit

FEST assertions

Mock

Test every part of your application (router, action, controller and ...)

Testing with a browser using FluentLenium ( Selenium WebDriver
wrapper)
Plugins
 Several plugins
– Mail
– Open ID
– CRUD
– Security
Deployment
 Compile all class and assets in application
 Activator start
 Activator stage (without any dependency on Play)
 Activator dist (produces a ZIP file without any
dependency on Play)
 SBT Native Packager plugin(activator universal:package-
bin)
– MSI, OS X disk image, RPM, DEB and …
 Publishing to a Maven (or Ivy) repository
Scaleability
 Scale horizontally easily (using load balancer)
 Integrate with Akka clustring and remoting
features
 Asynchronous from bottom to top
Reactive

Play Iteratee library (Scala Library)

ReactiveMongo
Non-blocking
 ReturnPromise<Result>Promise<Result>
 Intensive computation will just be run on another thread
(thread pool in separate execution context ).
 The web client will be blocked while waiting for the
response, but nothing will be blocked on the server
‫تشکر‬
zarinfam.s@gmail.com
http://javabyab.com

Contenu connexe

Tendances

Play Framework: The Basics
Play Framework: The BasicsPlay Framework: The Basics
Play Framework: The BasicsPhilip Langer
 
Designing a play framework application
Designing a play framework applicationDesigning a play framework application
Designing a play framework applicationVulcanMinds
 
Play Framework 2.5
Play Framework 2.5Play Framework 2.5
Play Framework 2.5m-kurz
 
Node.js Development with Apache NetBeans
Node.js Development with Apache NetBeansNode.js Development with Apache NetBeans
Node.js Development with Apache NetBeansRyan Cuprak
 
Scala and Play with Gradle
Scala and Play with GradleScala and Play with Gradle
Scala and Play with GradleWei Chen
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with GradleRyan Cuprak
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules uploadRyan Cuprak
 
Developing Modern Java Web Applications with Java EE 7 and AngularJS
Developing Modern Java Web Applications with Java EE 7 and AngularJSDeveloping Modern Java Web Applications with Java EE 7 and AngularJS
Developing Modern Java Web Applications with Java EE 7 and AngularJSShekhar Gulati
 
Getting Started with Java EE 7
Getting Started with Java EE 7Getting Started with Java EE 7
Getting Started with Java EE 7Arun Gupta
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot IntroductionJeevesh Pandey
 
Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Matthew Groves
 
Connect2017 DEV-1550 Why Java 8? Or, What's a Lambda?
Connect2017 DEV-1550 Why Java 8? Or, What's a Lambda?Connect2017 DEV-1550 Why Java 8? Or, What's a Lambda?
Connect2017 DEV-1550 Why Java 8? Or, What's a Lambda?Julian Robichaux
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring BootTrey Howard
 
Java EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJava EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJiayun Zhou
 
[143]Inside fuse deview 2016
[143]Inside fuse   deview 2016[143]Inside fuse   deview 2016
[143]Inside fuse deview 2016NAVER D2
 
Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013Matt Raible
 

Tendances (20)

Play framework
Play frameworkPlay framework
Play framework
 
Play Framework: The Basics
Play Framework: The BasicsPlay Framework: The Basics
Play Framework: The Basics
 
Designing a play framework application
Designing a play framework applicationDesigning a play framework application
Designing a play framework application
 
Play Framework 2.5
Play Framework 2.5Play Framework 2.5
Play Framework 2.5
 
Why Play Framework is fast
Why Play Framework is fastWhy Play Framework is fast
Why Play Framework is fast
 
Node.js Development with Apache NetBeans
Node.js Development with Apache NetBeansNode.js Development with Apache NetBeans
Node.js Development with Apache NetBeans
 
Scala and Play with Gradle
Scala and Play with GradleScala and Play with Gradle
Scala and Play with Gradle
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules upload
 
Developing Modern Java Web Applications with Java EE 7 and AngularJS
Developing Modern Java Web Applications with Java EE 7 and AngularJSDeveloping Modern Java Web Applications with Java EE 7 and AngularJS
Developing Modern Java Web Applications with Java EE 7 and AngularJS
 
Node.js vs Play Framework
Node.js vs Play FrameworkNode.js vs Play Framework
Node.js vs Play Framework
 
Getting Started with Java EE 7
Getting Started with Java EE 7Getting Started with Java EE 7
Getting Started with Java EE 7
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017
 
Connect2017 DEV-1550 Why Java 8? Or, What's a Lambda?
Connect2017 DEV-1550 Why Java 8? Or, What's a Lambda?Connect2017 DEV-1550 Why Java 8? Or, What's a Lambda?
Connect2017 DEV-1550 Why Java 8? Or, What's a Lambda?
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Java EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJava EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSF
 
[143]Inside fuse deview 2016
[143]Inside fuse   deview 2016[143]Inside fuse   deview 2016
[143]Inside fuse deview 2016
 
Angular beans
Angular beansAngular beans
Angular beans
 
Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013
 

En vedette

Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaYevgeniy Brikman
 
Formation Play! framework
Formation Play! frameworkFormation Play! framework
Formation Play! frameworkBenoît Simard
 
Introduction à Play Framework 2
Introduction à Play Framework 2Introduction à Play Framework 2
Introduction à Play Framework 2Samy Dindane
 
Play framework - Human Talks Grenoble - 12.02.2013
Play framework - Human Talks Grenoble - 12.02.2013Play framework - Human Talks Grenoble - 12.02.2013
Play framework - Human Talks Grenoble - 12.02.2013Xavier NOPRE
 
Enib cours c.a.i. web - séance #5 : scala play! framework
Enib   cours c.a.i. web - séance #5 : scala play! frameworkEnib   cours c.a.i. web - séance #5 : scala play! framework
Enib cours c.a.i. web - séance #5 : scala play! frameworkHoracio Gonzalez
 
O uso de frameworks em aplicações desktop baseadas na metodologia de desenvol...
O uso de frameworks em aplicações desktop baseadas na metodologia de desenvol...O uso de frameworks em aplicações desktop baseadas na metodologia de desenvol...
O uso de frameworks em aplicações desktop baseadas na metodologia de desenvol...Rogério Batista
 
Vert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
Vert.x - Tehran JUG meeting Aug-2014 - Saeed ZarinfamVert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
Vert.x - Tehran JUG meeting Aug-2014 - Saeed ZarinfamSaeed Zarinfam
 
Enterprise Java Web Application Frameworks Sample Stack Implementation
Enterprise Java Web Application Frameworks   Sample Stack ImplementationEnterprise Java Web Application Frameworks   Sample Stack Implementation
Enterprise Java Web Application Frameworks Sample Stack ImplementationMert Çalışkan
 
Real World Enterprise Reactive Programming using Vert.x
Real World Enterprise Reactive Programming using Vert.xReal World Enterprise Reactive Programming using Vert.x
Real World Enterprise Reactive Programming using Vert.xMariam Hakobyan
 
Play framework: lessons learned
Play framework: lessons learnedPlay framework: lessons learned
Play framework: lessons learnedPeter Hilton
 
Comparing JVM Web Frameworks - February 2014
Comparing JVM Web Frameworks - February 2014Comparing JVM Web Frameworks - February 2014
Comparing JVM Web Frameworks - February 2014Matt Raible
 
DDS on the Web: Quick Recipes for Real-Time Web Applications
DDS on the Web: Quick Recipes for Real-Time Web ApplicationsDDS on the Web: Quick Recipes for Real-Time Web Applications
DDS on the Web: Quick Recipes for Real-Time Web ApplicationsAngelo Corsaro
 
Play Framework
Play FrameworkPlay Framework
Play FrameworkArmaklan
 
Play : Premiers pas par l'exemple le 120613
Play : Premiers pas par l'exemple le 120613Play : Premiers pas par l'exemple le 120613
Play : Premiers pas par l'exemple le 120613SOAT
 

En vedette (14)

Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and Scala
 
Formation Play! framework
Formation Play! frameworkFormation Play! framework
Formation Play! framework
 
Introduction à Play Framework 2
Introduction à Play Framework 2Introduction à Play Framework 2
Introduction à Play Framework 2
 
Play framework - Human Talks Grenoble - 12.02.2013
Play framework - Human Talks Grenoble - 12.02.2013Play framework - Human Talks Grenoble - 12.02.2013
Play framework - Human Talks Grenoble - 12.02.2013
 
Enib cours c.a.i. web - séance #5 : scala play! framework
Enib   cours c.a.i. web - séance #5 : scala play! frameworkEnib   cours c.a.i. web - séance #5 : scala play! framework
Enib cours c.a.i. web - séance #5 : scala play! framework
 
O uso de frameworks em aplicações desktop baseadas na metodologia de desenvol...
O uso de frameworks em aplicações desktop baseadas na metodologia de desenvol...O uso de frameworks em aplicações desktop baseadas na metodologia de desenvol...
O uso de frameworks em aplicações desktop baseadas na metodologia de desenvol...
 
Vert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
Vert.x - Tehran JUG meeting Aug-2014 - Saeed ZarinfamVert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
Vert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
 
Enterprise Java Web Application Frameworks Sample Stack Implementation
Enterprise Java Web Application Frameworks   Sample Stack ImplementationEnterprise Java Web Application Frameworks   Sample Stack Implementation
Enterprise Java Web Application Frameworks Sample Stack Implementation
 
Real World Enterprise Reactive Programming using Vert.x
Real World Enterprise Reactive Programming using Vert.xReal World Enterprise Reactive Programming using Vert.x
Real World Enterprise Reactive Programming using Vert.x
 
Play framework: lessons learned
Play framework: lessons learnedPlay framework: lessons learned
Play framework: lessons learned
 
Comparing JVM Web Frameworks - February 2014
Comparing JVM Web Frameworks - February 2014Comparing JVM Web Frameworks - February 2014
Comparing JVM Web Frameworks - February 2014
 
DDS on the Web: Quick Recipes for Real-Time Web Applications
DDS on the Web: Quick Recipes for Real-Time Web ApplicationsDDS on the Web: Quick Recipes for Real-Time Web Applications
DDS on the Web: Quick Recipes for Real-Time Web Applications
 
Play Framework
Play FrameworkPlay Framework
Play Framework
 
Play : Premiers pas par l'exemple le 120613
Play : Premiers pas par l'exemple le 120613Play : Premiers pas par l'exemple le 120613
Play : Premiers pas par l'exemple le 120613
 

Similaire à Web application development using Play Framework (with Java)

Playframework + Twitter Bootstrap
Playframework + Twitter BootstrapPlayframework + Twitter Bootstrap
Playframework + Twitter BootstrapKevingo Tsai
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And BeyondVMware Tanzu
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Arun Gupta
 
JCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of JavaJCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of JavaJoseph Kuo
 
It pro dev_birbilis_20101127_en
It pro dev_birbilis_20101127_enIt pro dev_birbilis_20101127_en
It pro dev_birbilis_20101127_enGeorge Birbilis
 
Web Component Development with Servlet and JSP Technologies Unit 01
Web Component Development with Servlet and JSP Technologies Unit 01Web Component Development with Servlet and JSP Technologies Unit 01
Web Component Development with Servlet and JSP Technologies Unit 01Prashanth Shivakumar
 
Programming in HTML5 With Java Script and CSS3
Programming in HTML5 With Java Script and CSS3Programming in HTML5 With Java Script and CSS3
Programming in HTML5 With Java Script and CSS3Testbells
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introductionvstorm83
 
Advance java prasentation
Advance java prasentationAdvance java prasentation
Advance java prasentationdhananajay95
 
Object Oriented Programming-JAVA
Object Oriented Programming-JAVAObject Oriented Programming-JAVA
Object Oriented Programming-JAVAHome
 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxMurugesh33
 
JAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxJAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxMurugesh33
 
Spring Update | July 2023
Spring Update | July 2023Spring Update | July 2023
Spring Update | July 2023VMware Tanzu
 
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3 Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3 Skills Matter
 

Similaire à Web application development using Play Framework (with Java) (20)

Java Programming - 01 intro to java
Java Programming - 01 intro to javaJava Programming - 01 intro to java
Java Programming - 01 intro to java
 
Playframework + Twitter Bootstrap
Playframework + Twitter BootstrapPlayframework + Twitter Bootstrap
Playframework + Twitter Bootstrap
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And Beyond
 
01 java intro
01 java intro01 java intro
01 java intro
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011
 
The Java alternative to Javascript
The Java alternative to JavascriptThe Java alternative to Javascript
The Java alternative to Javascript
 
AMIS Oracle OpenWorld 2013 Review Part 3 - Fusion Middleware
AMIS Oracle OpenWorld 2013 Review Part 3 - Fusion MiddlewareAMIS Oracle OpenWorld 2013 Review Part 3 - Fusion Middleware
AMIS Oracle OpenWorld 2013 Review Part 3 - Fusion Middleware
 
GlassFish and JavaEE, Today and Future
GlassFish and JavaEE, Today and FutureGlassFish and JavaEE, Today and Future
GlassFish and JavaEE, Today and Future
 
JCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of JavaJCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of Java
 
It pro dev_birbilis_20101127_en
It pro dev_birbilis_20101127_enIt pro dev_birbilis_20101127_en
It pro dev_birbilis_20101127_en
 
Web Component Development with Servlet and JSP Technologies Unit 01
Web Component Development with Servlet and JSP Technologies Unit 01Web Component Development with Servlet and JSP Technologies Unit 01
Web Component Development with Servlet and JSP Technologies Unit 01
 
Programming in HTML5 With Java Script and CSS3
Programming in HTML5 With Java Script and CSS3Programming in HTML5 With Java Script and CSS3
Programming in HTML5 With Java Script and CSS3
 
java slides
java slidesjava slides
java slides
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introduction
 
Advance java prasentation
Advance java prasentationAdvance java prasentation
Advance java prasentation
 
Object Oriented Programming-JAVA
Object Oriented Programming-JAVAObject Oriented Programming-JAVA
Object Oriented Programming-JAVA
 
JAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptxJAVA_Day1_BasicIntroduction.pptx
JAVA_Day1_BasicIntroduction.pptx
 
JAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptxJAVAPart1_BasicIntroduction.pptx
JAVAPart1_BasicIntroduction.pptx
 
Spring Update | July 2023
Spring Update | July 2023Spring Update | July 2023
Spring Update | July 2023
 
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3 Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
 

Dernier

Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburgmasabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 

Dernier (20)

Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 

Web application development using Play Framework (with Java)

  • 1. Web application development using Play Framework (with Java) Tehran JUG meeting February-2015 By: Saeed Zarinfam
  • 2. History  Play 1 Created By Guillaume Bort at Zengularity SA in 2007  Play 2 release in 2012 by Typesafe (rewrite using Scala)  Play 1 vs Play 2  Part of Typesafe Activator
  • 3. Introduction • Inspired by Ruby on Rails and Django • Run on JVM (use java library) • MVC • Stateless • Hot code reloading (in development) • Convention over configuration • Lightweight • Asynchronous and Non-blocking I/O • Java 8 support
  • 4. Architecture • MVC architecture • Netty as web server (no servlet container) • Sbt as build tools (Ivy dependency manager) • Stateless
  • 5. Requirements  Install Typesafe Activator (or sbt)  JDK 6 or later  activator new my-first-app play-java  Open project in IDE (Eclipse and Intellij)  Run using – command line (activator run) – Activator console (activator) – Activator UI (activator ui) – Interactive Console (Only in Scala)
  • 7. Project structure • App • Public • Conf • build.sbt • Scala and Java • ...
  • 8. Route • Scala syntax • Optional parameters • Reverse routing • REST friendly
  • 9. Controller • Actions return Result • Static method • Use dependency injection (JSR 330 in Play 3) • HTTP manipulation (body parsers) – REST service (JSON and XML)
  • 10. View  Type safe template engine  Scala Template (Twirl inspired by ASP.NET Razor)  Http form handling
  • 11. Session  Session data are not stored in the server  Session data added to each subsequent HTTP Request, using Cookie.  Cookie are signed with a secret key so the client can’t modify the cookie data or it will be invalidated  Use cache for sever side session data
  • 12. Assets  Public Assets  WebJars  Assets controller  Etag  Gzip  Caching  Managed Assets  CoffeeScript  LESS CSS  Sbt-web plugins  js-engine plugin (able to execute plugins written to the Node API either within the JVM via the excellent Trireme)
  • 13. Hot code reloading (in development)  It is possible because Play is stateless and tightly integration between Play and sbt  Classloader hierarchy manage by sbt  Tricky (You don't need JRebel)  For each request reloader check if there's any code changes  Compile changed codes  remove the old application classloader  create a new application classloader with the updated classes.  restart application (only application, no need to restart the JVM)
  • 14. Accessing Database  JDBC  JPA (2.0)  Ebeans (default ORM)  Database evolutions  Connection Pool  Transaction  In-memory H2 database
  • 15. Asynchronous  Actions are asynchronous by default  Each open connection does not need a thread  application code should avoid blocking in controllers
  • 16. Other APIs  Integration with Akka  WebSockets and Comet sockets  Cache API  Internationalization  Interceptors  Filters(only in Scala)  JSON API (jackson)  XML API  Job scheduling (Using Akka)  Logging API (Logback)
  • 17. Testing  Ready to use application stubs for test (several helper methods)  Junit  FEST assertions  Mock  Test every part of your application (router, action, controller and ...)  Testing with a browser using FluentLenium ( Selenium WebDriver wrapper)
  • 18. Plugins  Several plugins – Mail – Open ID – CRUD – Security
  • 19. Deployment  Compile all class and assets in application  Activator start  Activator stage (without any dependency on Play)  Activator dist (produces a ZIP file without any dependency on Play)  SBT Native Packager plugin(activator universal:package- bin) – MSI, OS X disk image, RPM, DEB and …  Publishing to a Maven (or Ivy) repository
  • 20. Scaleability  Scale horizontally easily (using load balancer)  Integrate with Akka clustring and remoting features  Asynchronous from bottom to top
  • 21. Reactive  Play Iteratee library (Scala Library)  ReactiveMongo
  • 22. Non-blocking  ReturnPromise<Result>Promise<Result>  Intensive computation will just be run on another thread (thread pool in separate execution context ).  The web client will be blocked while waiting for the response, but nothing will be blocked on the server