SlideShare uma empresa Scribd logo
1 de 37
Baixar para ler offline
Web development with the Play! framework
                    Java web development is fun again


                             Alexander Reelsen

                              alexander@reelsen.net


                                    June 2010




Alexander Reelsen       Web development with the Play! framework   June 2010   1 / 35
Agenda
1   Introduction
       Overview
2   Core concepts
       Architecture
       Conventions
       Configuring routes
       Model
       Controller
       View
       Testing
       Jobs
       Running Play in production
3   Ongoing development
       Features for Play 1.1
       Module repository
       Development forecast
      Alexander Reelsen   Web development with the Play! framework   June 2010   2 / 35
Introduction


Agenda
1   Introduction
       Overview
2   Core concepts
       Architecture
       Conventions
       Configuring routes
       Model
       Controller
       View
       Testing
       Jobs
       Running Play in production
3   Ongoing development
       Features for Play 1.1
       Module repository
       Development forecast
      Alexander Reelsen   Web development with the Play! framework   June 2010   3 / 35
Introduction   Overview


Speaking...


About me
    Studied information systems
    10 years linux system engineering, converted to software engineering
    Just another java developer
    Web framework enthusiast
    Fed up with complex java environment for simple webapps

Non development life
    Basketball/Streetball
    Web 2.0



     Alexander Reelsen   Web development with the Play! framework   June 2010   4 / 35
Introduction   Overview


Speaking...


About me
    Studied information systems
    10 years linux system engineering, converted to software engineering
    Just another java developer
    Web framework enthusiast
    Fed up with complex java environment for simple webapps

Non development life
    Basketball/Streetball
    Web 2.0



     Alexander Reelsen   Web development with the Play! framework   June 2010   4 / 35
Introduction   Overview


The web taking over




Ubiquitous web
    Web as ubiquitous platform
    Providing data, not web pages
    Browser as the operating system
    JavaScript gains steam, toolkits as well as engines
    Web applications are alive




     Alexander Reelsen   Web development with the Play! framework   June 2010   5 / 35
Core concepts


Agenda
1   Introduction
       Overview
2   Core concepts
       Architecture
       Conventions
       Configuring routes
       Model
       Controller
       View
       Testing
       Jobs
       Running Play in production
3   Ongoing development
       Features for Play 1.1
       Module repository
       Development forecast
      Alexander Reelsen   Web development with the Play! framework   June 2010   6 / 35
Core concepts   Architecture


Play in 10 seconds


Quick overview
    No compile, deploy, restart cycle - Fix the bug and hit reload!
    Share nothing system - no state in the server
    Clean templating system - using groovy
    Exact errors (including line numbers, even for templates)
    Lots of builtin features for fast development
    Pure Java
    Starts fast, runs fast
    Extensible by modules




     Alexander Reelsen   Web development with the Play! framework   June 2010   7 / 35
Core concepts   Architecture


Roots and fundamentals

History
     Exists since 2008, by Guillaume Bort from zenexity
    Release 1.0 was in October 2009
    Current: 1.0.3 + development tree

A framework imposes its own style of architecture
     REST as architectural paradigm for ressources
    URLs are the entry point (and implicit interface) to your application
    Do not work against HTTP (stateless protocol)
    Convention over configuration
    Only fractions of differences between development and production
    mode

     Alexander Reelsen   Web development with the Play! framework   June 2010   8 / 35
Core concepts   Architecture


Play architecture




Source: http://www.playframework.org/documentation/1.0.1/main
         Alexander Reelsen          Web development with the Play! framework   June 2010   9 / 35
Core concepts   Architecture


Play is a lot of glue code

Includes the following libraries
     Hibernate
     Oval
     Lucene
     Google gson
     Eclipse compiler
     Commons: fileupload, httpclient, email, logging, beanutils
     MINA and Asyncweb
     EhCache
     JAMon
     Groovy


     Alexander Reelsen    Web development with the Play! framework   June 2010   10 / 35
Core concepts   Architecture


Play specialties



Interesting to know
    No support for servlet API (yes, in a web framework)
    Sharing objects via memcached through several nodes
    Everything is UTF-8
    Full text indexing with 2 annotations
    No anemic domain model - logic is in the object
    DAOs and finders are not external
    Textmate, eclipse bundles, also support for IDEA and netbeans




     Alexander Reelsen   Web development with the Play! framework   June 2010   11 / 35
Core concepts   Conventions


Application layout
Creating a new app
    play new myapp

Application structure

./ conf
./ conf / routes
./ conf / a p p l i c a t i o n . conf
./ conf / messages
./ test
./ l i b
./ public
. / app
. / app / m o d e l s
. / app / c o n t r o l l e r s
. / app / v i e w s
      Alexander Reelsen     Web development with the Play! framework   June 2010   12 / 35
Core concepts   Conventions


Application layout
Creating a new app
    play new myapp

Application structure

./ conf
./ conf / routes
./ conf / a p p l i c a t i o n . conf
./ conf / messages
./ test
./ l i b
./ public
. / app
. / app / m o d e l s
. / app / c o n t r o l l e r s
. / app / v i e w s
      Alexander Reelsen     Web development with the Play! framework   June 2010   12 / 35
Core concepts   Conventions


Application config file


conf/application.conf
   Configure database access
          db=fs, db=mem
          db=mysql:user:pwd@database_name
          Any JDBC connection
   Specify modules
   Supported languages
   Logger
   memcached setup
   mail configuration
   mode/system specific settings


    Alexander Reelsen   Web development with the Play! framework   June 2010   13 / 35
Core concepts   Configuring routes


The conf/routes file



Interface contract to the outer world

GET            /                                    Application        . index
GET            / u s e r /{ username }              Application        . showUser
POST           / user                               Application        . createUser
DELETE         / u s e r /{ username }              Application        . deleteUser

GET            / public                staticDir : public




      Alexander Reelsen     Web development with the Play! framework       June 2010   14 / 35
Core concepts   Model


Designing a domain model

A simple user
   @Entity
   public class User extends Model {
           @Required
           @Column(unique = true)
           public String username;

              @Required
              @Email
              public String email;

              @Required
              public String password;

              public void setPassword(String password) {
                     this.pass = Crypto.passwordHash(pass);
              }
   }



       Alexander Reelsen     Web development with the Play! framework   June 2010   15 / 35
Core concepts   Model


The Model class is a helper


Finders and Entity actions
   // Query by property
   User user = User.find("byUsername", username).first();

   // Calls a setter
   user.password = "foobar";
   user.save();

   List<User> users = User.findAll();
   users.get(0).delete();

   // JPA queries are possible as well, so are joins
   List<String> names = User.find("select u.username from User u
    order by u.username desc").fetch();




     Alexander Reelsen   Web development with the Play! framework   June 2010   16 / 35
Core concepts   Controller


Calling business logic


User controller
   public class Application extends Controller {
          public static void index() {
                 List<User> users = User.findAll();
                 render(users);
          }

            public static void showUser(String username) {
                   User user = User.find("byUsername", username).first();
                   notFoundIfNull(user);
                   render(user);
            }

   ...




     Alexander Reelsen     Web development with the Play! framework   June 2010   17 / 35
Core concepts   Controller


Calling business logic
User controller (ctd.)
   ...

              public static void deleteUser(String username) {
                     User user = User.find("byUsername", username).first();
                     notFoundIfNull(user);
                     user.delete();
                     Application.index();
              }

              public static void createUser(@Valid User user) {
                     if (validation.hasErrors()) {
                            flash.error("Invalid user data");
                            Application.index();
                     }

                           user = user.save();
                           Application.showUser(user.username)
              }
   }

       Alexander Reelsen           Web development with the Play! framework   June 2010   18 / 35
Core concepts   Controller


Calling business logic
Example: Accessing the session
   public class AuthController extends Controller {

              @Before(unless = "login")
              public static void checkSession() {
                     if (!request.session.contains("username")) {
                            forbidden("You are not authorized");
                     }
              }


              public void login(String username, String password) {
                     String pass = Crypto.passwordHash(password);
                     User user = User.find("byUsernameAndPassword",
                            username, pass).first();
                     notFoundIfNull(user);
                     request.session.put("username", user);
                     Application.index();
              }
   }

       Alexander Reelsen     Web development with the Play! framework   June 2010   19 / 35
Core concepts   View


The templating system


List users (app/views/Application/index.html)
#{ extends ’ main . html ’ /}
#{ set title : ’ Index ’ /}

< ul >
#{ list items : users , as : ’ user ’}
< li >
   #{ a @Application . showUser ( user . username )}
         $ { user . username }
   #{/ a }
   with email address $ { user . email }
</ li >
#{/ list }
</ ul >




     Alexander Reelsen    Web development with the Play! framework   June 2010   20 / 35
Core concepts   View


The templating system

Add user
#{ form @Application . createUser ()}
< div > Username :
< input type = " text " name = " user . username " / >
</ div >

< div > Password :
< input type = " pass " name = " user . password " / >
</ div >

< div > Email :
< input type = " text " name = " user . email " / >
</ div >

< input type = " submit " value = " Add user " / >
#{/ form }




      Alexander Reelsen     Web development with the Play! framework   June 2010   21 / 35
Core concepts   View


The templating system




More tags
    doLayout, extends, include
   if, ifnot, else, elseif
   &{’i18nVariable’} out of conf/messages.de
   Always access to: session, flash, request, params, lang,
   messages, out, play




    Alexander Reelsen   Web development with the Play! framework   June 2010   22 / 35
Core concepts   View


The templating system


Extending objects using mixins
   public class SqrtExtension extends JavaExtensions {

       public static Double sqrt(Number number) {
          return Math.sqrt(number.doubleValue());
       }

   }



The template code
< div >
Square root of x value is : $ { x . sqrt ()}
</ div >




       Alexander Reelsen    Web development with the Play! framework   June 2010   23 / 35
Core concepts   Testing


Testing

Providing test data
YAML formatted file provides testdata
User ( a l e r e e ) :
     username : a l r
     password : t e s t
     email : a l e x a n d e r @ r e e l s e n . net


Loading test data...
   @Before
   public void setUp() {
       Fixtures.deleteAll();
       Fixtures.load("data.yml");
   }



     Alexander Reelsen    Web development with the Play! framework   June 2010   24 / 35
Core concepts   Testing


Testing

Unit tests
     Standard junit tests
    Extend from UnitTest, which needs a JPA environment

Functional tests
    Integration tests
    Checks the external responses (http response)

Selenium tests
     GUI tests
    Very nice controllable, playback recorder
    Possibility of doing step-by-step slow debugging


     Alexander Reelsen      Web development with the Play! framework   June 2010   25 / 35
Core concepts   Testing


Testing



CI with Calimoucho
    Poor mans hudson
    Checks out the project and runs play auto-test, which needs a
    graphical layer for selenium tests
    Check it under http://integration.playframework.org

Code coverage with cobertura
    Enable the cobertura module in application.conf
    Run the tests, check the results




    Alexander Reelsen   Web development with the Play! framework   June 2010   26 / 35
Core concepts   Jobs


Jobs - being asynchronous


Doing the right thing at the right time
       Scheduled jobs (housekeeping)
       Bootstrap jobs (initial data providing)
       Suspendable requests (rendering a PDF report without blocking the
       connection thread pool)
   /* @Every("1h") */
   @OnApplicationStart
   public class LoadDataJob extends Job {

              public void doJob() {
                     /* .. do whatever you want */
              }
   }




       Alexander Reelsen     Web development with the Play! framework   June 2010   27 / 35
Core concepts   Running Play in production


Putting play into production




The setup
    A redirector like nginx or apache is preferred
    Also eliminates the need to serve static files
    Redirect to different nodes would be the main task
    Profile per nodes possible (very useful for server farms)




     Alexander Reelsen   Web development with the Play! framework          June 2010   28 / 35
Core concepts   Running Play in production


Monitoring play application


Partial Output of play status
 Monitors:

Application.showLatestRecipesRss(), ms. ->
4120 hits; 41.0 avg; 20.0 min; 260.0 max;
/app/views/Application/showLatestRecipesRss.html, ms. ->
4120 hits; 34.9 avg; 19.0 min; 235.0 max;

Datasource:
Job execution pool:
Scheduled jobs:



     Alexander Reelsen   Web development with the Play! framework          June 2010   29 / 35
Ongoing development


Agenda
1   Introduction
       Overview
2   Core concepts
       Architecture
       Conventions
       Configuring routes
       Model
       Controller
       View
       Testing
       Jobs
       Running Play in production
3   Ongoing development
       Features for Play 1.1
       Module repository
       Development forecast
      Alexander Reelsen    Web development with the Play! framework   June 2010   30 / 35
Ongoing development   Features for Play 1.1


Play 1.1 is on its way




Core features
    Bug fixes
    Scala support
    More modules through module repository




     Alexander Reelsen    Web development with the Play! framework     June 2010   31 / 35
Ongoing development   Module repository


Useful modules

Slowly but steadily growing
    Scala, Scalate, Akka
    PDF, excel modules
    Guice and Spring modules
    Netty and grizzly support
    GWT support, GAE support
    Extended CSS, SASS
    Ivy and Maven support
    Siena, Ebean ORM, MongoDB
    Database migration module
    Hosting: stax, playapps


     Alexander Reelsen    Web development with the Play! framework   June 2010   32 / 35
Ongoing development   Development forecast


TODO



Open issues
    NoSQL support (Siena, MongoDB)
    Amazon Cloud Integration
    Hosting platform (playapps.net has just launched)
    Lucene Solr Support for shared environments
    Tighter integration with JavaScript Toolkits like Dojo
    Far more modules - check out the rich grails ecosystem
    The first book... is coming!




     Alexander Reelsen    Web development with the Play! framework    June 2010   33 / 35
Finish


Done!


Thanks for listening.
Questions?


Job offers regarding Java Scalability or new technologies like Play and/or
MongoDB?



Talk to me or send mail to alexander@reelsen.net



      Alexander Reelsen   Web development with the Play! framework   June 2010   34 / 35
Finish


URLs

Further information
    This presentation: http://www.slideshare.net/areelsen/
    http://www.playframework.org
    http://twitter.com/playframework
    http://it-republik.de/jaxenter/artikel/
    Webanwendungen-mit-dem-Java-Framework-Play!-2813.html
    http://www.bookware.de/kaffeeklatsch/archiv/
    KaffeeKlatsch-2009-11.pdf
    http://www.bookware.de/kaffeeklatsch/archiv/
    KaffeeKlatsch-2009-12.pdf
    http://www.zenexity.fr/frameworks/
    anatomie-dun-framework-de-developpement-web/


    Alexander Reelsen   Web development with the Play! framework   June 2010   35 / 35

Mais conteúdo relacionado

Mais procurados

Scala play-framework
Scala play-frameworkScala play-framework
Scala play-frameworkAbdhesh Kumar
 
Play framework 2 : Peter Hilton
Play framework 2 : Peter HiltonPlay framework 2 : Peter Hilton
Play framework 2 : Peter HiltonJAX London
 
Play framework : A Walkthrough
Play framework : A WalkthroughPlay framework : A Walkthrough
Play framework : A Walkthroughmitesh_sharma
 
Workshop Framework(J2EE/OSGi/RCP)
Workshop Framework(J2EE/OSGi/RCP)Workshop Framework(J2EE/OSGi/RCP)
Workshop Framework(J2EE/OSGi/RCP)Summer Lu
 
Designing a play framework application
Designing a play framework applicationDesigning a play framework application
Designing a play framework applicationVulcanMinds
 
Getting Reactive with Spring Framework 5.0’s GA release
Getting Reactive with Spring Framework 5.0’s GA releaseGetting Reactive with Spring Framework 5.0’s GA release
Getting Reactive with Spring Framework 5.0’s GA releaseVMware Tanzu
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!Jakub Kubrynski
 
An Introduction to Play 2 Framework
An Introduction to Play 2 FrameworkAn Introduction to Play 2 Framework
An Introduction to Play 2 FrameworkPT.JUG
 
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
 
Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!
Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!
Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!Serdar Basegmez
 
Play framework: lessons learned
Play framework: lessons learnedPlay framework: lessons learned
Play framework: lessons learnedPeter Hilton
 
Playframework + Twitter Bootstrap
Playframework + Twitter BootstrapPlayframework + Twitter Bootstrap
Playframework + Twitter BootstrapKevingo Tsai
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot IntroductionJeevesh Pandey
 
Intro to JavaScript Tooling in Visual Studio Code
Intro to JavaScript Tooling in Visual Studio CodeIntro to JavaScript Tooling in Visual Studio Code
Intro to JavaScript Tooling in Visual Studio CodeColdFusionConference
 
Spring boot
Spring bootSpring boot
Spring bootsdeeg
 
Spring Boot and Microservices
Spring Boot and MicroservicesSpring Boot and Microservices
Spring Boot and Microservicesseges
 

Mais procurados (20)

Scala play-framework
Scala play-frameworkScala play-framework
Scala play-framework
 
Play framework 2 : Peter Hilton
Play framework 2 : Peter HiltonPlay framework 2 : Peter Hilton
Play framework 2 : Peter Hilton
 
Play framework : A Walkthrough
Play framework : A WalkthroughPlay framework : A Walkthrough
Play framework : A Walkthrough
 
Workshop Framework(J2EE/OSGi/RCP)
Workshop Framework(J2EE/OSGi/RCP)Workshop Framework(J2EE/OSGi/RCP)
Workshop Framework(J2EE/OSGi/RCP)
 
Play framework
Play frameworkPlay framework
Play framework
 
Designing a play framework application
Designing a play framework applicationDesigning a play framework application
Designing a play framework application
 
Getting Reactive with Spring Framework 5.0’s GA release
Getting Reactive with Spring Framework 5.0’s GA releaseGetting Reactive with Spring Framework 5.0’s GA release
Getting Reactive with Spring Framework 5.0’s GA release
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!
 
An Introduction to Play 2 Framework
An Introduction to Play 2 FrameworkAn Introduction to Play 2 Framework
An Introduction to Play 2 Framework
 
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
 
Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!
Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!
Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!
 
Play framework: lessons learned
Play framework: lessons learnedPlay framework: lessons learned
Play framework: lessons learned
 
Apache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolboxApache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolbox
 
Java and XPages
Java and XPagesJava and XPages
Java and XPages
 
Playframework + Twitter Bootstrap
Playframework + Twitter BootstrapPlayframework + Twitter Bootstrap
Playframework + Twitter Bootstrap
 
Spring boot
Spring bootSpring boot
Spring boot
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Intro to JavaScript Tooling in Visual Studio Code
Intro to JavaScript Tooling in Visual Studio CodeIntro to JavaScript Tooling in Visual Studio Code
Intro to JavaScript Tooling in Visual Studio Code
 
Spring boot
Spring bootSpring boot
Spring boot
 
Spring Boot and Microservices
Spring Boot and MicroservicesSpring Boot and Microservices
Spring Boot and Microservices
 

Destaque

Play Framework on Google App Engine
Play Framework on Google App EnginePlay Framework on Google App Engine
Play Framework on Google App EngineFred Lin
 
Play Framework on Google App Engine - Productivity Stack
Play Framework on Google App Engine - Productivity StackPlay Framework on Google App Engine - Productivity Stack
Play Framework on Google App Engine - Productivity StackMarcin Stepien
 
Play framework And Google Cloud Platform GCP.
Play framework And Google Cloud Platform GCP.Play framework And Google Cloud Platform GCP.
Play framework And Google Cloud Platform GCP.Eng Chrispinus Onyancha
 
Giraph at Hadoop Summit 2014
Giraph at Hadoop Summit 2014Giraph at Hadoop Summit 2014
Giraph at Hadoop Summit 2014Claudio Martella
 
File Format Benchmarks - Avro, JSON, ORC, & Parquet
File Format Benchmarks - Avro, JSON, ORC, & ParquetFile Format Benchmarks - Avro, JSON, ORC, & Parquet
File Format Benchmarks - Avro, JSON, ORC, & ParquetOwen O'Malley
 

Destaque (7)

Play Framework on Google App Engine
Play Framework on Google App EnginePlay Framework on Google App Engine
Play Framework on Google App Engine
 
Play Framework on Google App Engine - Productivity Stack
Play Framework on Google App Engine - Productivity StackPlay Framework on Google App Engine - Productivity Stack
Play Framework on Google App Engine - Productivity Stack
 
Play framework And Google Cloud Platform GCP.
Play framework And Google Cloud Platform GCP.Play framework And Google Cloud Platform GCP.
Play framework And Google Cloud Platform GCP.
 
Giraph at Hadoop Summit 2014
Giraph at Hadoop Summit 2014Giraph at Hadoop Summit 2014
Giraph at Hadoop Summit 2014
 
ORC Files
ORC FilesORC Files
ORC Files
 
File Format Benchmarks - Avro, JSON, ORC, & Parquet
File Format Benchmarks - Avro, JSON, ORC, & ParquetFile Format Benchmarks - Avro, JSON, ORC, & Parquet
File Format Benchmarks - Avro, JSON, ORC, & Parquet
 
Node.js vs Play Framework
Node.js vs Play FrameworkNode.js vs Play Framework
Node.js vs Play Framework
 

Semelhante a Introduction in the play framework

Mix Tech Ed Update No Video
Mix Tech Ed Update No VideoMix Tech Ed Update No Video
Mix Tech Ed Update No VideoAllyWick
 
Dog food conference creating modular webparts with require js in sharepoint
Dog food conference   creating modular webparts with require js in sharepointDog food conference   creating modular webparts with require js in sharepoint
Dog food conference creating modular webparts with require js in sharepointfahey252
 
Matteo Gazzurelli - Introduction to Android Development - Have a break edition
Matteo Gazzurelli - Introduction to Android Development - Have a break editionMatteo Gazzurelli - Introduction to Android Development - Have a break edition
Matteo Gazzurelli - Introduction to Android Development - Have a break editionDuckMa
 
Developing iPhone and iPad apps that leverage Windows Azure
Developing iPhone and iPad apps that leverage Windows AzureDeveloping iPhone and iPad apps that leverage Windows Azure
Developing iPhone and iPad apps that leverage Windows AzureSimon Guest
 
A Tour of CodePlex
A Tour of CodePlexA Tour of CodePlex
A Tour of CodePlexDave Bost
 
Entity Framework V1 and V2
Entity Framework V1 and V2Entity Framework V1 and V2
Entity Framework V1 and V2ukdpe
 
Webface - Passion is Innovation
Webface - Passion is InnovationWebface - Passion is Innovation
Webface - Passion is InnovationAbhishek kumar
 
Silicon Valley Code Camp 2011: Play! as you REST
Silicon Valley Code Camp 2011: Play! as you RESTSilicon Valley Code Camp 2011: Play! as you REST
Silicon Valley Code Camp 2011: Play! as you RESTManish Pandit
 
Introduction to using jQuery with SharePoint
Introduction to using jQuery with SharePointIntroduction to using jQuery with SharePoint
Introduction to using jQuery with SharePointRene Modery
 
Nikhil Kaja Fair
Nikhil Kaja FairNikhil Kaja Fair
Nikhil Kaja Fairnikhilkaja
 
Cross Platform Mobile Technologies
Cross Platform Mobile TechnologiesCross Platform Mobile Technologies
Cross Platform Mobile TechnologiesTalentica Software
 
Red Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
Red Hat JBoss BRMS and BPMS Workbench and Rich Client TechnologyRed Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
Red Hat JBoss BRMS and BPMS Workbench and Rich Client TechnologyMark Proctor
 
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013DuckMa
 
Microservices for the Masses with Spring Boot and JHipster - Chicago JUG 2018
Microservices for the Masses with Spring Boot and JHipster - Chicago JUG 2018Microservices for the Masses with Spring Boot and JHipster - Chicago JUG 2018
Microservices for the Masses with Spring Boot and JHipster - Chicago JUG 2018Matt Raible
 
VRE Cancer Imaging BL RIC Workshop 22032011
VRE Cancer Imaging BL RIC Workshop 22032011VRE Cancer Imaging BL RIC Workshop 22032011
VRE Cancer Imaging BL RIC Workshop 22032011djmichael156
 
SLUGUK BUILD Round-up
SLUGUK BUILD Round-upSLUGUK BUILD Round-up
SLUGUK BUILD Round-upDerek Lakin
 
Javascript Frameworks Comparison
Javascript Frameworks ComparisonJavascript Frameworks Comparison
Javascript Frameworks ComparisonDeepu S Nath
 
Daniel Egan Msdn Tech Days Oc
Daniel Egan Msdn Tech Days OcDaniel Egan Msdn Tech Days Oc
Daniel Egan Msdn Tech Days OcDaniel Egan
 

Semelhante a Introduction in the play framework (20)

Mix Tech Ed Update No Video
Mix Tech Ed Update No VideoMix Tech Ed Update No Video
Mix Tech Ed Update No Video
 
Stmik bandung
Stmik bandungStmik bandung
Stmik bandung
 
Dog food conference creating modular webparts with require js in sharepoint
Dog food conference   creating modular webparts with require js in sharepointDog food conference   creating modular webparts with require js in sharepoint
Dog food conference creating modular webparts with require js in sharepoint
 
Matteo Gazzurelli - Introduction to Android Development - Have a break edition
Matteo Gazzurelli - Introduction to Android Development - Have a break editionMatteo Gazzurelli - Introduction to Android Development - Have a break edition
Matteo Gazzurelli - Introduction to Android Development - Have a break edition
 
Developing iPhone and iPad apps that leverage Windows Azure
Developing iPhone and iPad apps that leverage Windows AzureDeveloping iPhone and iPad apps that leverage Windows Azure
Developing iPhone and iPad apps that leverage Windows Azure
 
A Tour of CodePlex
A Tour of CodePlexA Tour of CodePlex
A Tour of CodePlex
 
I os2 2
I os2 2I os2 2
I os2 2
 
Entity Framework V1 and V2
Entity Framework V1 and V2Entity Framework V1 and V2
Entity Framework V1 and V2
 
Webface - Passion is Innovation
Webface - Passion is InnovationWebface - Passion is Innovation
Webface - Passion is Innovation
 
Silicon Valley Code Camp 2011: Play! as you REST
Silicon Valley Code Camp 2011: Play! as you RESTSilicon Valley Code Camp 2011: Play! as you REST
Silicon Valley Code Camp 2011: Play! as you REST
 
Introduction to using jQuery with SharePoint
Introduction to using jQuery with SharePointIntroduction to using jQuery with SharePoint
Introduction to using jQuery with SharePoint
 
Nikhil Kaja Fair
Nikhil Kaja FairNikhil Kaja Fair
Nikhil Kaja Fair
 
Cross Platform Mobile Technologies
Cross Platform Mobile TechnologiesCross Platform Mobile Technologies
Cross Platform Mobile Technologies
 
Red Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
Red Hat JBoss BRMS and BPMS Workbench and Rich Client TechnologyRed Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
Red Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
 
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
 
Microservices for the Masses with Spring Boot and JHipster - Chicago JUG 2018
Microservices for the Masses with Spring Boot and JHipster - Chicago JUG 2018Microservices for the Masses with Spring Boot and JHipster - Chicago JUG 2018
Microservices for the Masses with Spring Boot and JHipster - Chicago JUG 2018
 
VRE Cancer Imaging BL RIC Workshop 22032011
VRE Cancer Imaging BL RIC Workshop 22032011VRE Cancer Imaging BL RIC Workshop 22032011
VRE Cancer Imaging BL RIC Workshop 22032011
 
SLUGUK BUILD Round-up
SLUGUK BUILD Round-upSLUGUK BUILD Round-up
SLUGUK BUILD Round-up
 
Javascript Frameworks Comparison
Javascript Frameworks ComparisonJavascript Frameworks Comparison
Javascript Frameworks Comparison
 
Daniel Egan Msdn Tech Days Oc
Daniel Egan Msdn Tech Days OcDaniel Egan Msdn Tech Days Oc
Daniel Egan Msdn Tech Days Oc
 

Último

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Último (20)

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Introduction in the play framework

  • 1. Web development with the Play! framework Java web development is fun again Alexander Reelsen alexander@reelsen.net June 2010 Alexander Reelsen Web development with the Play! framework June 2010 1 / 35
  • 2. Agenda 1 Introduction Overview 2 Core concepts Architecture Conventions Configuring routes Model Controller View Testing Jobs Running Play in production 3 Ongoing development Features for Play 1.1 Module repository Development forecast Alexander Reelsen Web development with the Play! framework June 2010 2 / 35
  • 3. Introduction Agenda 1 Introduction Overview 2 Core concepts Architecture Conventions Configuring routes Model Controller View Testing Jobs Running Play in production 3 Ongoing development Features for Play 1.1 Module repository Development forecast Alexander Reelsen Web development with the Play! framework June 2010 3 / 35
  • 4. Introduction Overview Speaking... About me Studied information systems 10 years linux system engineering, converted to software engineering Just another java developer Web framework enthusiast Fed up with complex java environment for simple webapps Non development life Basketball/Streetball Web 2.0 Alexander Reelsen Web development with the Play! framework June 2010 4 / 35
  • 5. Introduction Overview Speaking... About me Studied information systems 10 years linux system engineering, converted to software engineering Just another java developer Web framework enthusiast Fed up with complex java environment for simple webapps Non development life Basketball/Streetball Web 2.0 Alexander Reelsen Web development with the Play! framework June 2010 4 / 35
  • 6. Introduction Overview The web taking over Ubiquitous web Web as ubiquitous platform Providing data, not web pages Browser as the operating system JavaScript gains steam, toolkits as well as engines Web applications are alive Alexander Reelsen Web development with the Play! framework June 2010 5 / 35
  • 7. Core concepts Agenda 1 Introduction Overview 2 Core concepts Architecture Conventions Configuring routes Model Controller View Testing Jobs Running Play in production 3 Ongoing development Features for Play 1.1 Module repository Development forecast Alexander Reelsen Web development with the Play! framework June 2010 6 / 35
  • 8. Core concepts Architecture Play in 10 seconds Quick overview No compile, deploy, restart cycle - Fix the bug and hit reload! Share nothing system - no state in the server Clean templating system - using groovy Exact errors (including line numbers, even for templates) Lots of builtin features for fast development Pure Java Starts fast, runs fast Extensible by modules Alexander Reelsen Web development with the Play! framework June 2010 7 / 35
  • 9. Core concepts Architecture Roots and fundamentals History Exists since 2008, by Guillaume Bort from zenexity Release 1.0 was in October 2009 Current: 1.0.3 + development tree A framework imposes its own style of architecture REST as architectural paradigm for ressources URLs are the entry point (and implicit interface) to your application Do not work against HTTP (stateless protocol) Convention over configuration Only fractions of differences between development and production mode Alexander Reelsen Web development with the Play! framework June 2010 8 / 35
  • 10. Core concepts Architecture Play architecture Source: http://www.playframework.org/documentation/1.0.1/main Alexander Reelsen Web development with the Play! framework June 2010 9 / 35
  • 11. Core concepts Architecture Play is a lot of glue code Includes the following libraries Hibernate Oval Lucene Google gson Eclipse compiler Commons: fileupload, httpclient, email, logging, beanutils MINA and Asyncweb EhCache JAMon Groovy Alexander Reelsen Web development with the Play! framework June 2010 10 / 35
  • 12. Core concepts Architecture Play specialties Interesting to know No support for servlet API (yes, in a web framework) Sharing objects via memcached through several nodes Everything is UTF-8 Full text indexing with 2 annotations No anemic domain model - logic is in the object DAOs and finders are not external Textmate, eclipse bundles, also support for IDEA and netbeans Alexander Reelsen Web development with the Play! framework June 2010 11 / 35
  • 13. Core concepts Conventions Application layout Creating a new app play new myapp Application structure ./ conf ./ conf / routes ./ conf / a p p l i c a t i o n . conf ./ conf / messages ./ test ./ l i b ./ public . / app . / app / m o d e l s . / app / c o n t r o l l e r s . / app / v i e w s Alexander Reelsen Web development with the Play! framework June 2010 12 / 35
  • 14. Core concepts Conventions Application layout Creating a new app play new myapp Application structure ./ conf ./ conf / routes ./ conf / a p p l i c a t i o n . conf ./ conf / messages ./ test ./ l i b ./ public . / app . / app / m o d e l s . / app / c o n t r o l l e r s . / app / v i e w s Alexander Reelsen Web development with the Play! framework June 2010 12 / 35
  • 15. Core concepts Conventions Application config file conf/application.conf Configure database access db=fs, db=mem db=mysql:user:pwd@database_name Any JDBC connection Specify modules Supported languages Logger memcached setup mail configuration mode/system specific settings Alexander Reelsen Web development with the Play! framework June 2010 13 / 35
  • 16. Core concepts Configuring routes The conf/routes file Interface contract to the outer world GET / Application . index GET / u s e r /{ username } Application . showUser POST / user Application . createUser DELETE / u s e r /{ username } Application . deleteUser GET / public staticDir : public Alexander Reelsen Web development with the Play! framework June 2010 14 / 35
  • 17. Core concepts Model Designing a domain model A simple user @Entity public class User extends Model { @Required @Column(unique = true) public String username; @Required @Email public String email; @Required public String password; public void setPassword(String password) { this.pass = Crypto.passwordHash(pass); } } Alexander Reelsen Web development with the Play! framework June 2010 15 / 35
  • 18. Core concepts Model The Model class is a helper Finders and Entity actions // Query by property User user = User.find("byUsername", username).first(); // Calls a setter user.password = "foobar"; user.save(); List<User> users = User.findAll(); users.get(0).delete(); // JPA queries are possible as well, so are joins List<String> names = User.find("select u.username from User u order by u.username desc").fetch(); Alexander Reelsen Web development with the Play! framework June 2010 16 / 35
  • 19. Core concepts Controller Calling business logic User controller public class Application extends Controller { public static void index() { List<User> users = User.findAll(); render(users); } public static void showUser(String username) { User user = User.find("byUsername", username).first(); notFoundIfNull(user); render(user); } ... Alexander Reelsen Web development with the Play! framework June 2010 17 / 35
  • 20. Core concepts Controller Calling business logic User controller (ctd.) ... public static void deleteUser(String username) { User user = User.find("byUsername", username).first(); notFoundIfNull(user); user.delete(); Application.index(); } public static void createUser(@Valid User user) { if (validation.hasErrors()) { flash.error("Invalid user data"); Application.index(); } user = user.save(); Application.showUser(user.username) } } Alexander Reelsen Web development with the Play! framework June 2010 18 / 35
  • 21. Core concepts Controller Calling business logic Example: Accessing the session public class AuthController extends Controller { @Before(unless = "login") public static void checkSession() { if (!request.session.contains("username")) { forbidden("You are not authorized"); } } public void login(String username, String password) { String pass = Crypto.passwordHash(password); User user = User.find("byUsernameAndPassword", username, pass).first(); notFoundIfNull(user); request.session.put("username", user); Application.index(); } } Alexander Reelsen Web development with the Play! framework June 2010 19 / 35
  • 22. Core concepts View The templating system List users (app/views/Application/index.html) #{ extends ’ main . html ’ /} #{ set title : ’ Index ’ /} < ul > #{ list items : users , as : ’ user ’} < li > #{ a @Application . showUser ( user . username )} $ { user . username } #{/ a } with email address $ { user . email } </ li > #{/ list } </ ul > Alexander Reelsen Web development with the Play! framework June 2010 20 / 35
  • 23. Core concepts View The templating system Add user #{ form @Application . createUser ()} < div > Username : < input type = " text " name = " user . username " / > </ div > < div > Password : < input type = " pass " name = " user . password " / > </ div > < div > Email : < input type = " text " name = " user . email " / > </ div > < input type = " submit " value = " Add user " / > #{/ form } Alexander Reelsen Web development with the Play! framework June 2010 21 / 35
  • 24. Core concepts View The templating system More tags doLayout, extends, include if, ifnot, else, elseif &{’i18nVariable’} out of conf/messages.de Always access to: session, flash, request, params, lang, messages, out, play Alexander Reelsen Web development with the Play! framework June 2010 22 / 35
  • 25. Core concepts View The templating system Extending objects using mixins public class SqrtExtension extends JavaExtensions { public static Double sqrt(Number number) { return Math.sqrt(number.doubleValue()); } } The template code < div > Square root of x value is : $ { x . sqrt ()} </ div > Alexander Reelsen Web development with the Play! framework June 2010 23 / 35
  • 26. Core concepts Testing Testing Providing test data YAML formatted file provides testdata User ( a l e r e e ) : username : a l r password : t e s t email : a l e x a n d e r @ r e e l s e n . net Loading test data... @Before public void setUp() { Fixtures.deleteAll(); Fixtures.load("data.yml"); } Alexander Reelsen Web development with the Play! framework June 2010 24 / 35
  • 27. Core concepts Testing Testing Unit tests Standard junit tests Extend from UnitTest, which needs a JPA environment Functional tests Integration tests Checks the external responses (http response) Selenium tests GUI tests Very nice controllable, playback recorder Possibility of doing step-by-step slow debugging Alexander Reelsen Web development with the Play! framework June 2010 25 / 35
  • 28. Core concepts Testing Testing CI with Calimoucho Poor mans hudson Checks out the project and runs play auto-test, which needs a graphical layer for selenium tests Check it under http://integration.playframework.org Code coverage with cobertura Enable the cobertura module in application.conf Run the tests, check the results Alexander Reelsen Web development with the Play! framework June 2010 26 / 35
  • 29. Core concepts Jobs Jobs - being asynchronous Doing the right thing at the right time Scheduled jobs (housekeeping) Bootstrap jobs (initial data providing) Suspendable requests (rendering a PDF report without blocking the connection thread pool) /* @Every("1h") */ @OnApplicationStart public class LoadDataJob extends Job { public void doJob() { /* .. do whatever you want */ } } Alexander Reelsen Web development with the Play! framework June 2010 27 / 35
  • 30. Core concepts Running Play in production Putting play into production The setup A redirector like nginx or apache is preferred Also eliminates the need to serve static files Redirect to different nodes would be the main task Profile per nodes possible (very useful for server farms) Alexander Reelsen Web development with the Play! framework June 2010 28 / 35
  • 31. Core concepts Running Play in production Monitoring play application Partial Output of play status Monitors: Application.showLatestRecipesRss(), ms. -> 4120 hits; 41.0 avg; 20.0 min; 260.0 max; /app/views/Application/showLatestRecipesRss.html, ms. -> 4120 hits; 34.9 avg; 19.0 min; 235.0 max; Datasource: Job execution pool: Scheduled jobs: Alexander Reelsen Web development with the Play! framework June 2010 29 / 35
  • 32. Ongoing development Agenda 1 Introduction Overview 2 Core concepts Architecture Conventions Configuring routes Model Controller View Testing Jobs Running Play in production 3 Ongoing development Features for Play 1.1 Module repository Development forecast Alexander Reelsen Web development with the Play! framework June 2010 30 / 35
  • 33. Ongoing development Features for Play 1.1 Play 1.1 is on its way Core features Bug fixes Scala support More modules through module repository Alexander Reelsen Web development with the Play! framework June 2010 31 / 35
  • 34. Ongoing development Module repository Useful modules Slowly but steadily growing Scala, Scalate, Akka PDF, excel modules Guice and Spring modules Netty and grizzly support GWT support, GAE support Extended CSS, SASS Ivy and Maven support Siena, Ebean ORM, MongoDB Database migration module Hosting: stax, playapps Alexander Reelsen Web development with the Play! framework June 2010 32 / 35
  • 35. Ongoing development Development forecast TODO Open issues NoSQL support (Siena, MongoDB) Amazon Cloud Integration Hosting platform (playapps.net has just launched) Lucene Solr Support for shared environments Tighter integration with JavaScript Toolkits like Dojo Far more modules - check out the rich grails ecosystem The first book... is coming! Alexander Reelsen Web development with the Play! framework June 2010 33 / 35
  • 36. Finish Done! Thanks for listening. Questions? Job offers regarding Java Scalability or new technologies like Play and/or MongoDB? Talk to me or send mail to alexander@reelsen.net Alexander Reelsen Web development with the Play! framework June 2010 34 / 35
  • 37. Finish URLs Further information This presentation: http://www.slideshare.net/areelsen/ http://www.playframework.org http://twitter.com/playframework http://it-republik.de/jaxenter/artikel/ Webanwendungen-mit-dem-Java-Framework-Play!-2813.html http://www.bookware.de/kaffeeklatsch/archiv/ KaffeeKlatsch-2009-11.pdf http://www.bookware.de/kaffeeklatsch/archiv/ KaffeeKlatsch-2009-12.pdf http://www.zenexity.fr/frameworks/ anatomie-dun-framework-de-developpement-web/ Alexander Reelsen Web development with the Play! framework June 2010 35 / 35