SlideShare una empresa de Scribd logo
1 de 17
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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
 

Destacado

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.
 

Destacado (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
 

Similar a 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偉格 高
 

Similar a 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
 

Último

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 

Último (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 

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