SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
Dive into           Framework

            Maher Gamal
Key Features

● Agile development workflow ( Save, Reload ! )

● Stateless architecture

● Clear error reporting

● Reusable modules & plugins

● Gets you up and running quickly !
Project Layout : play new proj1

● proj1/app/controllers
● proj1/app/models
● proj1/app/views

● proj1/conf/application.conf
● proj1/conf/messages
● proj1/conf/routes

● proj1/lib
● proj1/public
● proj1/test
Routing : /conf/routes

 ● Examples

GET /profile/view/{id}    ProfileController.view
POST /profile/save      ProfileController.save
GET /{<ar|en>lang}/      HomeController.index
* /{controller}/{action} {controller}.{action}

 ● Defining the URLs early, forces you to explore your website

 ● You can use annotations too (with the play-router module)
Controllers : /app/controllers

import play.mvc.Controller;

public class ProfileController extends Controller {

    public static void view(Long id) {
      // ...
      renderText("123"); // or json, xml.
      renderTemplate("Users/show.html");
      redirect("....");
      HomeController.index(); // Does a redirect
      // ...
    }
}
Models : /app/models

import play.db.jpa.Model;
import javax.persistence.Entity;


@Entity
public class User extends Model {

    public String email;

    public String password;
}
Validations : /app/models

import play.db.jpa.Model;
import javax.persistence.Entity;
import play.data.validation.*;

@Entity
public class User extends Model {
  @Email @Required
  public String email;
  @Required @MinSize(5)
  public String password;
}
Validations : /app/controllers

import play.mvc.Controller;

public class ProfileController extends Controller {

    public static void view(@Valid Profile profile) {
      render(profile);
      // or invoke the validation manually !
      // validation.valid(profile)
    }
}
Views : /app/views

/app/views/ProfileController/view.html

#{ifErrors}

  <ul class="error">
    #{errors}
       <li>${error}</li>
    #{/errors}
  </ul>

#{/ifErrors}
Views : /app/views

/app/views/ProfileController/view.html
#{extends 'main.html' /}
#{set title : 'Page Title' /}
#{set 'moreScripts'}
  ...
#{/set}

/app/views/main.html
<html>
   <head>
     <title>#{get 'title' /}</title>
     #{get 'moreScripts' /}
   </head>
</html>
Views : /app/views

/app/views/main.html
<html>
   <head>
     <title>#{get 'title' /}</title>
     #{get 'moreScripts' /}
   </head>
   <body>
     ...
     #{doLayout /}
     ...
   </body>
</html>
Jobs : /app/jobs


public class BootstrapJob extends Job {

    @Override
    public void doJob() {
      ...
    }
}
Jobs : /app/jobs

@OnApplicationStart
public class BootstrapJob extends Job {

    @Override
    public void doJob() {
      ...
    }
}
Jobs : /app/jobs

@Every("1h") or @On("0 0 * * *")
public class BootstrapJob extends Job {

    @Override
    public void doJob() {
      ...
    }
}
Helper Libraries : play.libs.*

 ● MD5 , SHA1 , Base64 Encoding/Decoding
 ● Encryption , decryption , hashing
 ● File/Directory copying , deleting and I/O methods
 ● Image resizing , cropping and captcha generation
 ● Mail message preparation and sending
 ● OAuth Integration
 ● OpenID Integration
 ● HttpClient to call external web services
 ● XML Parsing
Running

● play new proj1

● play run proj1

● play clean,run proj1

● play netbeansify proj1

● play help
Resources

● Documentation
   ○ playframework.org/documentation
   ○ playframework.org/documentation/api/1.1.1/index.html

● Community
   ○ playframework.org/community
   ○ play.lighthouseapp.com
   ○ groups.google.com/group/play-framework

● Modules and Examples
   ○ playframework.org/modules
   ○ Check samples-and-tests directory in the release

Contenu connexe

Tendances

Simple restfull app_s
Simple restfull app_sSimple restfull app_s
Simple restfull app_snetwix
 
Automated Smoke Tests with Protractor
Automated Smoke Tests with ProtractorAutomated Smoke Tests with Protractor
Automated Smoke Tests with Protractor🌱 Dale Spoonemore
 
Gatling Performance Workshop
Gatling Performance WorkshopGatling Performance Workshop
Gatling Performance WorkshopSai Krishna
 
Codeception: introduction to php testing
Codeception: introduction to php testingCodeception: introduction to php testing
Codeception: introduction to php testingEngineor
 
Test automation with php codeception
Test automation with php codeceptionTest automation with php codeception
Test automation with php codeceptionbuddhieash
 
ASP.NET Routing & MVC
ASP.NET Routing & MVCASP.NET Routing & MVC
ASP.NET Routing & MVCEmad Alashi
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberKMS Technology
 
UI Testing Best Practices - An Expected Journey
UI Testing Best Practices - An Expected JourneyUI Testing Best Practices - An Expected Journey
UI Testing Best Practices - An Expected JourneyOren Farhi
 
[Fronthub 2016] Константин Макарычев: "Не быстрый старт с Angular 2"
[Fronthub 2016] Константин Макарычев: "Не быстрый старт с Angular 2"[Fronthub 2016] Константин Макарычев: "Не быстрый старт с Angular 2"
[Fronthub 2016] Константин Макарычев: "Не быстрый старт с Angular 2"Provectus
 
Catching bugs with Opera Dragonfly / Özgür Web Teknolojileri Günleri / Istanb...
Catching bugs with Opera Dragonfly / Özgür Web Teknolojileri Günleri / Istanb...Catching bugs with Opera Dragonfly / Özgür Web Teknolojileri Günleri / Istanb...
Catching bugs with Opera Dragonfly / Özgür Web Teknolojileri Günleri / Istanb...Patrick Lauke
 
Codeception introduction and use in Yii
Codeception introduction and use in YiiCodeception introduction and use in Yii
Codeception introduction and use in YiiIlPeach
 
Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...Abhijeet Vaikar
 
How to use_cucumber_rest-assured_api_framework
How to use_cucumber_rest-assured_api_frameworkHow to use_cucumber_rest-assured_api_framework
How to use_cucumber_rest-assured_api_frameworkHarshad Ingle
 
[EclipseCon NA 2014] Integration tests for RCP made easy with SWTBot and Tycho
[EclipseCon NA 2014] Integration tests for RCP made easy with SWTBot and Tycho[EclipseCon NA 2014] Integration tests for RCP made easy with SWTBot and Tycho
[EclipseCon NA 2014] Integration tests for RCP made easy with SWTBot and TychoMickael Istria
 
Laravel & Composer presentation - extended
Laravel & Composer presentation - extendedLaravel & Composer presentation - extended
Laravel & Composer presentation - extendedCvetomir Denchev
 
Testing Web Applications
Testing Web ApplicationsTesting Web Applications
Testing Web ApplicationsSeth McLaughlin
 

Tendances (20)

13.exemplu closure controller
13.exemplu closure controller13.exemplu closure controller
13.exemplu closure controller
 
Simple restfull app_s
Simple restfull app_sSimple restfull app_s
Simple restfull app_s
 
Java EE 6
Java EE 6Java EE 6
Java EE 6
 
OpenCms Days 2015 Hidden features of OpenCms
OpenCms Days 2015 Hidden features of OpenCmsOpenCms Days 2015 Hidden features of OpenCms
OpenCms Days 2015 Hidden features of OpenCms
 
Automated Smoke Tests with Protractor
Automated Smoke Tests with ProtractorAutomated Smoke Tests with Protractor
Automated Smoke Tests with Protractor
 
Gatling Performance Workshop
Gatling Performance WorkshopGatling Performance Workshop
Gatling Performance Workshop
 
Codeception: introduction to php testing
Codeception: introduction to php testingCodeception: introduction to php testing
Codeception: introduction to php testing
 
Test automation with php codeception
Test automation with php codeceptionTest automation with php codeception
Test automation with php codeception
 
ASP.NET Routing & MVC
ASP.NET Routing & MVCASP.NET Routing & MVC
ASP.NET Routing & MVC
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
 
UI Testing Best Practices - An Expected Journey
UI Testing Best Practices - An Expected JourneyUI Testing Best Practices - An Expected Journey
UI Testing Best Practices - An Expected Journey
 
[Fronthub 2016] Константин Макарычев: "Не быстрый старт с Angular 2"
[Fronthub 2016] Константин Макарычев: "Не быстрый старт с Angular 2"[Fronthub 2016] Константин Макарычев: "Не быстрый старт с Angular 2"
[Fronthub 2016] Константин Макарычев: "Не быстрый старт с Angular 2"
 
Catching bugs with Opera Dragonfly / Özgür Web Teknolojileri Günleri / Istanb...
Catching bugs with Opera Dragonfly / Özgür Web Teknolojileri Günleri / Istanb...Catching bugs with Opera Dragonfly / Özgür Web Teknolojileri Günleri / Istanb...
Catching bugs with Opera Dragonfly / Özgür Web Teknolojileri Günleri / Istanb...
 
Codeception introduction and use in Yii
Codeception introduction and use in YiiCodeception introduction and use in Yii
Codeception introduction and use in Yii
 
Oro Workflows
Oro WorkflowsOro Workflows
Oro Workflows
 
Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...
 
How to use_cucumber_rest-assured_api_framework
How to use_cucumber_rest-assured_api_frameworkHow to use_cucumber_rest-assured_api_framework
How to use_cucumber_rest-assured_api_framework
 
[EclipseCon NA 2014] Integration tests for RCP made easy with SWTBot and Tycho
[EclipseCon NA 2014] Integration tests for RCP made easy with SWTBot and Tycho[EclipseCon NA 2014] Integration tests for RCP made easy with SWTBot and Tycho
[EclipseCon NA 2014] Integration tests for RCP made easy with SWTBot and Tycho
 
Laravel & Composer presentation - extended
Laravel & Composer presentation - extendedLaravel & Composer presentation - extended
Laravel & Composer presentation - extended
 
Testing Web Applications
Testing Web ApplicationsTesting Web Applications
Testing Web Applications
 

En vedette

Who says what to whom on Twitter? - Twitter flow
Who says what to whom on Twitter? - Twitter flowWho says what to whom on Twitter? - Twitter flow
Who says what to whom on Twitter? - Twitter flowJuan Sarasua
 
Brain Fitness2.Pdf Mck Coverage 2009
Brain Fitness2.Pdf Mck Coverage 2009Brain Fitness2.Pdf Mck Coverage 2009
Brain Fitness2.Pdf Mck Coverage 2009Dakim BrainFitness
 
Pastor Austine's ppt
Pastor Austine's pptPastor Austine's ppt
Pastor Austine's pptahl410
 
First Census of Marine Life 2010
First Census of Marine Life 2010First Census of Marine Life 2010
First Census of Marine Life 2010Juan Sarasua
 
Understanding General Ledger Reconciliations
Understanding General Ledger ReconciliationsUnderstanding General Ledger Reconciliations
Understanding General Ledger ReconciliationsCurtis Martin
 
Cu hedgehog concept public
Cu hedgehog concept   publicCu hedgehog concept   public
Cu hedgehog concept publicCurtis Martin
 
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...Knoldus Inc.
 
Committing to Quality in Education: Arts at the Core
Committing to Quality in Education: Arts at the CoreCommitting to Quality in Education: Arts at the Core
Committing to Quality in Education: Arts at the CoreArts Alliance Illinois
 
A Security Analysis Framework Powered By An Expert System
A Security Analysis Framework Powered By An Expert SystemA Security Analysis Framework Powered By An Expert System
A Security Analysis Framework Powered By An Expert SystemMaher Gamal
 
Functors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In ScalaFunctors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In ScalaKnoldus Inc.
 

En vedette (17)

2013 bridal menus
2013 bridal menus2013 bridal menus
2013 bridal menus
 
Nuevo rumbo
Nuevo rumboNuevo rumbo
Nuevo rumbo
 
Roll Call On Responsible Budget
Roll Call On Responsible BudgetRoll Call On Responsible Budget
Roll Call On Responsible Budget
 
Nuevo rumbo
Nuevo rumboNuevo rumbo
Nuevo rumbo
 
Who says what to whom on Twitter? - Twitter flow
Who says what to whom on Twitter? - Twitter flowWho says what to whom on Twitter? - Twitter flow
Who says what to whom on Twitter? - Twitter flow
 
Brain Fitness2.Pdf Mck Coverage 2009
Brain Fitness2.Pdf Mck Coverage 2009Brain Fitness2.Pdf Mck Coverage 2009
Brain Fitness2.Pdf Mck Coverage 2009
 
A Sip of Python
A Sip of PythonA Sip of Python
A Sip of Python
 
Pastor Austine's ppt
Pastor Austine's pptPastor Austine's ppt
Pastor Austine's ppt
 
First Census of Marine Life 2010
First Census of Marine Life 2010First Census of Marine Life 2010
First Census of Marine Life 2010
 
Arts Activism 101
Arts Activism 101Arts Activism 101
Arts Activism 101
 
Gujrat
GujratGujrat
Gujrat
 
Understanding General Ledger Reconciliations
Understanding General Ledger ReconciliationsUnderstanding General Ledger Reconciliations
Understanding General Ledger Reconciliations
 
Cu hedgehog concept public
Cu hedgehog concept   publicCu hedgehog concept   public
Cu hedgehog concept public
 
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
 
Committing to Quality in Education: Arts at the Core
Committing to Quality in Education: Arts at the CoreCommitting to Quality in Education: Arts at the Core
Committing to Quality in Education: Arts at the Core
 
A Security Analysis Framework Powered By An Expert System
A Security Analysis Framework Powered By An Expert SystemA Security Analysis Framework Powered By An Expert System
A Security Analysis Framework Powered By An Expert System
 
Functors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In ScalaFunctors, Applicatives and Monads In Scala
Functors, Applicatives and Monads In Scala
 

Similaire à Dive into Play Framework

Web Applications with AngularJS
Web Applications with AngularJSWeb Applications with AngularJS
Web Applications with AngularJSPhilipp Burgmer
 
Good practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsGood practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsAbhijeet Vaikar
 
TangoWithDjango - ch8
TangoWithDjango - ch8TangoWithDjango - ch8
TangoWithDjango - ch8Asika Kuo
 
Création d'application Ionic & Angular & Drupal 8
Création d'application Ionic & Angular & Drupal 8Création d'application Ionic & Angular & Drupal 8
Création d'application Ionic & Angular & Drupal 8wsmarouan
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...Fabio Franzini
 
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.jsDrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.jsVladimir Roudakov
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introductionvstorm83
 
Android UI Testing with Appium
Android UI Testing with AppiumAndroid UI Testing with Appium
Android UI Testing with AppiumLuke Maung
 
بررسی چارچوب جنگو
بررسی چارچوب جنگوبررسی چارچوب جنگو
بررسی چارچوب جنگوrailsbootcamp
 
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud RunDesigning flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Runwesley chun
 
Google app-engine-with-python
Google app-engine-with-pythonGoogle app-engine-with-python
Google app-engine-with-pythonDeepak Garg
 
Built to last javascript for enterprise
Built to last   javascript for enterpriseBuilt to last   javascript for enterprise
Built to last javascript for enterpriseMarjan Nikolovski
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersJavan Rasokat
 
Voorhoede - Front-end architecture
Voorhoede - Front-end architectureVoorhoede - Front-end architecture
Voorhoede - Front-end architectureJasper Moelker
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiRan Mizrahi
 
Module, AMD, RequireJS
Module, AMD, RequireJSModule, AMD, RequireJS
Module, AMD, RequireJS偉格 高
 

Similaire à Dive into Play Framework (20)

Web Applications with AngularJS
Web Applications with AngularJSWeb Applications with AngularJS
Web Applications with AngularJS
 
Good practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsGood practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium tests
 
Play framework
Play frameworkPlay framework
Play framework
 
TangoWithDjango - ch8
TangoWithDjango - ch8TangoWithDjango - ch8
TangoWithDjango - ch8
 
Création d'application Ionic & Angular & Drupal 8
Création d'application Ionic & Angular & Drupal 8Création d'application Ionic & Angular & Drupal 8
Création d'application Ionic & Angular & Drupal 8
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
Gwt.create
Gwt.createGwt.create
Gwt.create
 
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.jsDrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introduction
 
Test your modules
Test your modulesTest your modules
Test your modules
 
Android UI Testing with Appium
Android UI Testing with AppiumAndroid UI Testing with Appium
Android UI Testing with Appium
 
بررسی چارچوب جنگو
بررسی چارچوب جنگوبررسی چارچوب جنگو
بررسی چارچوب جنگو
 
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud RunDesigning flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
 
Google app-engine-with-python
Google app-engine-with-pythonGoogle app-engine-with-python
Google app-engine-with-python
 
Built to last javascript for enterprise
Built to last   javascript for enterpriseBuilt to last   javascript for enterprise
Built to last javascript for enterprise
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA Testers
 
Voorhoede - Front-end architecture
Voorhoede - Front-end architectureVoorhoede - Front-end architecture
Voorhoede - Front-end architecture
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran Mizrahi
 
Module, AMD, RequireJS
Module, AMD, RequireJSModule, AMD, RequireJS
Module, AMD, RequireJS
 
PhoneGap
PhoneGapPhoneGap
PhoneGap
 

Dernier

All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 

Dernier (20)

All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 

Dive into Play Framework

  • 1. Dive into Framework Maher Gamal
  • 2. Key Features ● Agile development workflow ( Save, Reload ! ) ● Stateless architecture ● Clear error reporting ● Reusable modules & plugins ● Gets you up and running quickly !
  • 3. Project Layout : play new proj1 ● proj1/app/controllers ● proj1/app/models ● proj1/app/views ● proj1/conf/application.conf ● proj1/conf/messages ● proj1/conf/routes ● proj1/lib ● proj1/public ● proj1/test
  • 4. Routing : /conf/routes ● Examples GET /profile/view/{id} ProfileController.view POST /profile/save ProfileController.save GET /{<ar|en>lang}/ HomeController.index * /{controller}/{action} {controller}.{action} ● Defining the URLs early, forces you to explore your website ● You can use annotations too (with the play-router module)
  • 5. Controllers : /app/controllers import play.mvc.Controller; public class ProfileController extends Controller { public static void view(Long id) { // ... renderText("123"); // or json, xml. renderTemplate("Users/show.html"); redirect("...."); HomeController.index(); // Does a redirect // ... } }
  • 6. Models : /app/models import play.db.jpa.Model; import javax.persistence.Entity; @Entity public class User extends Model { public String email; public String password; }
  • 7. Validations : /app/models import play.db.jpa.Model; import javax.persistence.Entity; import play.data.validation.*; @Entity public class User extends Model { @Email @Required public String email; @Required @MinSize(5) public String password; }
  • 8. Validations : /app/controllers import play.mvc.Controller; public class ProfileController extends Controller { public static void view(@Valid Profile profile) { render(profile); // or invoke the validation manually ! // validation.valid(profile) } }
  • 9. Views : /app/views /app/views/ProfileController/view.html #{ifErrors} <ul class="error"> #{errors} <li>${error}</li> #{/errors} </ul> #{/ifErrors}
  • 10. Views : /app/views /app/views/ProfileController/view.html #{extends 'main.html' /} #{set title : 'Page Title' /} #{set 'moreScripts'} ... #{/set} /app/views/main.html <html> <head> <title>#{get 'title' /}</title> #{get 'moreScripts' /} </head> </html>
  • 11. Views : /app/views /app/views/main.html <html> <head> <title>#{get 'title' /}</title> #{get 'moreScripts' /} </head> <body> ... #{doLayout /} ... </body> </html>
  • 12. Jobs : /app/jobs public class BootstrapJob extends Job { @Override public void doJob() { ... } }
  • 13. Jobs : /app/jobs @OnApplicationStart public class BootstrapJob extends Job { @Override public void doJob() { ... } }
  • 14. Jobs : /app/jobs @Every("1h") or @On("0 0 * * *") public class BootstrapJob extends Job { @Override public void doJob() { ... } }
  • 15. Helper Libraries : play.libs.* ● MD5 , SHA1 , Base64 Encoding/Decoding ● Encryption , decryption , hashing ● File/Directory copying , deleting and I/O methods ● Image resizing , cropping and captcha generation ● Mail message preparation and sending ● OAuth Integration ● OpenID Integration ● HttpClient to call external web services ● XML Parsing
  • 16. Running ● play new proj1 ● play run proj1 ● play clean,run proj1 ● play netbeansify proj1 ● play help
  • 17. Resources ● Documentation ○ playframework.org/documentation ○ playframework.org/documentation/api/1.1.1/index.html ● Community ○ playframework.org/community ○ play.lighthouseapp.com ○ groups.google.com/group/play-framework ● Modules and Examples ○ playframework.org/modules ○ Check samples-and-tests directory in the release