This document summarizes a presentation about the Play web framework. The presentation covers the background of Play, why it was created, its key features, and a demo. Play is described as a full-stack Java web framework that aims to provide rapid development, deployment, and a productive developer experience compared to traditional Java EE stacks. Some of Play's highlighted features include being pure Java, having no compile/deploy cycle, built-in support for routing, parameters, and testing.
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Play
1. Play Framework
(Fun is back in Java)
@basav
Saturday, December 8, 12
2. About Me
• Just another Java developer
• have experienced JSP, Struts2, Spring MVC,
JSF etc
• Fed up with complex Java EE environment
for simple Web apps
• Current Interests
• Clojure, Play, Cloud..
Saturday, December 8, 12
3. Agenda
• Background - 5 mins
• Why Play! Framework? - 10 mins
• Features and Benefits - 15 mins
• Demo - 10 mins
• Q &A
Saturday, December 8, 12
4. Web is taking over..
• Web is providing data on
HTTP not just web pages
• Browser is acting as an
Operating system
• Javascript has become very
powerful
• Webapps are alive
Saturday, December 8, 12
9. Web frameworks
Non Java Java based
Saturday, December 8, 12
10. Non Java Web
frameworks
Saturday, December 8, 12
11. Non Java Web
frameworks
• Are popular
Saturday, December 8, 12
12. Non Java Web
frameworks
• Are popular
• HTTP is first class
citizen
Saturday, December 8, 12
13. Non Java Web
frameworks
• Are popular
• HTTP is first class
citizen
• Rapid Development
Saturday, December 8, 12
14. Non Java Web
frameworks
• Are popular
• HTTP is first class
citizen
• Rapid Development
• Rapid Deployment
Saturday, December 8, 12
15. Non Java Web
frameworks
• Are popular
• HTTP is first class
citizen
• Rapid Development
• Rapid Deployment
• Less code
Saturday, December 8, 12
16. Non Java Web
frameworks
• Are popular
• HTTP is first class
citizen
• Rapid Development
• Rapid Deployment
• Less code
• JVM Ecosystem
Saturday, December 8, 12
20. Java Web frameworks
• on JVM
• Standard based
• Implement Heavy
Servlet Specs
Saturday, December 8, 12
21. Java Web frameworks
• on JVM
• Standard based
• Implement Heavy
Servlet Specs
• Embrace HTTP
Saturday, December 8, 12
22. Java Web frameworks
• on JVM
• Standard based
• Implement Heavy
Servlet Specs
• Embrace HTTP
• Rapid Development
Saturday, December 8, 12
23. Java Web frameworks
• on JVM
• Standard based
• Implement Heavy
Servlet Specs
• Embrace HTTP
• Rapid Development
• Rapid Deployment
Saturday, December 8, 12
24. Java Web frameworks
• on JVM
• Standard based
• Implement Heavy
Servlet Specs
• Embrace HTTP
• Rapid Development
• Rapid Deployment
• Less More code
Saturday, December 8, 12
25. Where is the GAP and
What we Need?
Saturday, December 8, 12
26. Where is the GAP and
What we Need?
• HTTP as First Class Citizen
Saturday, December 8, 12
27. Where is the GAP and
What we Need?
• HTTP as First Class Citizen
• Rapid Development
Saturday, December 8, 12
28. Where is the GAP and
What we Need?
• HTTP as First Class Citizen
• Rapid Development
• Rapid Deployment
Saturday, December 8, 12
29. Where is the GAP and
What we Need?
• HTTP as First Class Citizen
• Rapid Development
• Rapid Deployment
+
Saturday, December 8, 12
30. Where is the GAP and
What we Need?
• HTTP as First Class Citizen
• Rapid Development
• Rapid Deployment
+
• on JVM Ecosystem (i.e. Pure Java Support)
Saturday, December 8, 12
31. Conventional Java EE
Stack for Web Apps
• Complex
• Lots of
• Specs and Implementations
• Configurations
• Layered
• Defined by Standards / Specs
• Assembled by Interfaces
Saturday, December 8, 12
32. Conventional Java EE
Stack for Web Apps
• Complex
• Lots of
• Specs and Implementations
OVER ARCHITECTED
• Configurations
• Layered
• Defined by Standards / Specs
• Assembled by Interfaces
Saturday, December 8, 12
33. Why?
“Java developers are building
Java applications, not web
applications”
Saturday, December 8, 12
34. Why?
“Java culture emphasis
interfaces and layers of
abstraction over solving
problems directly.”
Saturday, December 8, 12
36. What about Developer
Productivity?
• code change -> run Maven / Ant -> build war
-> copy-> Deploy -> wait (sometimes server
restart) -> open-browser-> test
(Try developing something on Webpshere, you understand what I mean)
Saturday, December 8, 12
40. Developer Productivity
• important
• is of economic value
• Lets not pay for compile-test-deploy
cycle
Saturday, December 8, 12
41. Developer Productivity
• important
• is of economic value
• Lets not pay for compile-test-deploy
cycle
• more importantly - Lets not bore them
Saturday, December 8, 12
42. Where is the GAP and
What we Need?
Saturday, December 8, 12
43. Where is the GAP and
What we Need?
• HTTP as First Class • Rapid Development
Citizen
• Rapid Deployment
+
• on JVM Ecosystem (i.e. Pure Java Support)
Saturday, December 8, 12
44. Where is the GAP and
What we Need?
• HTTP as First Class • Rapid Development
Citizen
• Rapid Deployment
+
• on JVM Ecosystem (i.e. Pure Java Support)
• Developer Productivity
Saturday, December 8, 12
45. Where is the GAP and
What we Need?
• HTTP as First Class • Rapid Development
Citizen
• Rapid Deployment
+
• on JVM Ecosystem (i.e. Pure Java Support)
• Developer Productivity
=
Saturday, December 8, 12
46. Where is the GAP and
What we Need?
• HTTP as First Class • Rapid Development
Citizen
• Rapid Deployment
+
• on JVM Ecosystem (i.e. Pure Java Support)
• Developer Productivity
=
Saturday, December 8, 12
47. pure Java Web Framework
• https://github.com/playframework/play.git
Saturday, December 8, 12
48. • Founded by Guillaume Bort in 2007
• 500,000+ downloads, and counting
• 3000+ questions tagged in stackoverflow
• 7000+ members on Play google groups
• ~7000 topics
• 100+ modules
Saturday, December 8, 12
50. Play is
• Full Stack Framework (from compilation to
deployment)
Saturday, December 8, 12
51. Play is
• Full Stack Framework (from compilation to
deployment)
• Stateless Architecture
Saturday, December 8, 12
52. Play is
• Full Stack Framework (from compilation to
deployment)
• Stateless Architecture
• Not Based on Servlet API
Saturday, December 8, 12
53. Play is
• Full Stack Framework (from compilation to
deployment)
• Stateless Architecture
• Not Based on Servlet API
• RESTFul Architecture
Saturday, December 8, 12
54. Play is
• Full Stack Framework (from compilation to
deployment)
• Stateless Architecture
• Not Based on Servlet API
• RESTFul Architecture
• Shared Philosophy - Heavily borrowed from
Rails / Django
Saturday, December 8, 12
55. Play is
• Full Stack Framework (from compilation to
deployment)
• Stateless Architecture
• Not Based on Servlet API
• RESTFul Architecture
• Shared Philosophy - Heavily borrowed from
Rails / Django
• Web Framework - Not a Java Framework!!
Saturday, December 8, 12
56. Play History
• Started with Servlet and JSP
Saturday, December 8, 12
57. Play History
• Servlet and JSP replaced by
custom Classloader
• Introduced Python support
• Groovy for Templates
• Async IO
Saturday, December 8, 12
58. Play History
Introduced
• Ivy For Build
• Websockets
• Scala
Saturday, December 8, 12
59. Play History
Introduced
• Ivy SBT
• Groovy Scala Templates
• Akka for middleware
• First class support for
Scala
Saturday, December 8, 12
60. Our focus for Today is
on Play 1.2.5
Saturday, December 8, 12
62. Full Stack...
• Full Stack - everything “needed” is bundled
JDT Compiler JPA
Saturday, December 8, 12
63. Full Stack...
• Full Stack - everything “needed” is bundled
JDT Compiler JPA
Can be packaged as standard WARS and
deployed in Servlet Containers
Saturday, December 8, 12
76. My top 10 features
• Pure Java
Saturday, December 8, 12
77. My top 10 features
• Pure Java
• Starts fast, runs fast
Saturday, December 8, 12
78. My top 10 features
• Pure Java
• Starts fast, runs fast
• No compile, deploy,
restart cycle - Fix the
bug and hit reload!
Saturday, December 8, 12
79. My top 10 features
• Pure Java
• Starts fast, runs fast
• No compile, deploy,
restart cycle - Fix the
bug and hit reload!
• URL Routing
Saturday, December 8, 12
80. My top 10 features
• Pure Java
• Starts fast, runs fast
• No compile, deploy,
restart cycle - Fix the
bug and hit reload!
• URL Routing
• HTTP Parameter
Binding
Saturday, December 8, 12
81. My top 10 features
• Pure Java
• Starts fast, runs fast
• No compile, deploy,
restart cycle - Fix the
bug and hit reload!
• URL Routing
• HTTP Parameter
Binding
• Share nothing system -
no state in the server
Saturday, December 8, 12
82. My top 10 features
• Pure Java
• Starts fast, runs fast
• Exact errors (including
• No compile, deploy, line numbers, even for
groovy templates)
restart cycle - Fix the
bug and hit reload!
• URL Routing
• HTTP Parameter
Binding
• Share nothing system -
no state in the server
Saturday, December 8, 12
83. My top 10 features
• Pure Java
• Starts fast, runs fast
• Exact errors (including
• No compile, deploy, line numbers, even for
groovy templates)
restart cycle - Fix the
bug and hit reload!
• Extensible by modules
• URL Routing
• HTTP Parameter
Binding
• Share nothing system -
no state in the server
Saturday, December 8, 12
84. My top 10 features
• Pure Java
• Starts fast, runs fast
• Exact errors (including
• No compile, deploy, line numbers, even for
groovy templates)
restart cycle - Fix the
bug and hit reload!
• Extensible by modules
• URL Routing
• Super Testing support
• HTTP Parameter
Binding
• Share nothing system -
no state in the server
Saturday, December 8, 12
85. My top 10 features
• Pure Java
• Starts fast, runs fast
• Exact errors (including
• No compile, deploy, line numbers, even for
groovy templates)
restart cycle - Fix the
bug and hit reload!
• Extensible by modules
• URL Routing
• Super Testing support
• HTTP Parameter
• Easy deployment on
Binding
Cloud
• Share nothing system -
no state in the server
Saturday, December 8, 12
95. Stateless Architecture
• “Share Nothing” Philosophy - Nothing is
shared between reach request
• No Session - i.e. No “HTTPSession” Object
• You cannot do :
• session.setAttribute("user" , user);
• Use HttpSessionListener to count sessions
• ServletFilter , Servlet-related securities
• Instead Play uses (delegates to) memcached as a
workaround
Saturday, December 8, 12
96. Where is the Session?
Web Browser Play! Framework Server
Application
State Play! Framework Server 2
DB
Application
Crypted signed cookie
Saturday, December 8, 12
97. Where is the Session?
Web Browser Play! Framework Server
Application
State Play! Framework Server 2
DB
Application
Crypted signed cookie
Saturday, December 8, 12
98. Where is the Session?
Web Browser Play! Framework Server
Application
State Play! Framework Server 2
DB
Application
Crypted signed cookie
Saturday, December 8, 12
99. Where is the Session?
Web Browser Play! Framework Server
Application
State Play! Framework Server 2
DB
Application
Crypted signed cookie
Saturday, December 8, 12
100. Where is the Session?
Web Browser Play! Framework Server
Application
State Play! Framework Server 2
DB
Application
Crypted signed cookie
Saturday, December 8, 12
101. Where is the Session?
Web Browser Play! Framework Server
Application
State Play! Framework Server 2
DB
Application
Crypted signed cookie
Saturday, December 8, 12
103. Play URLs Are RESTFul
UGLY
Saturday, December 8, 12
104. Play URLs Are RESTFul
UGLY
• http://www.myapp.com/cont/servlet/buyService?
sessionId=3gh3haaa2gg2&action=nextPage&idExpanse
=false&flow=3C&event=s1e1&entityId=23bS&role=p&
date=04%2F12%F2010&returnPage=homeS02&out=tr
ue
Saturday, December 8, 12
105. Play URLs Are RESTFul
UGLY
• http://www.myapp.com/cont/servlet/buyService?
sessionId=3gh3haaa2gg2&action=nextPage&idExpanse
=false&flow=3C&event=s1e1&entityId=23bS&role=p&
date=04%2F12%F2010&returnPage=homeS02&out=tr
ue
GRACEFUL
Saturday, December 8, 12
106. Play URLs Are RESTFul
UGLY
• http://www.myapp.com/cont/servlet/buyService?
sessionId=3gh3haaa2gg2&action=nextPage&idExpanse
=false&flow=3C&event=s1e1&entityId=23bS&role=p&
date=04%2F12%F2010&returnPage=homeS02&out=tr
ue
GRACEFUL
• http://mysite.com/list/products/page/2
Saturday, December 8, 12
107. Play URLs Are RESTFul
UGLY
• http://www.myapp.com/cont/servlet/buyService?
sessionId=3gh3haaa2gg2&action=nextPage&idExpanse
=false&flow=3C&event=s1e1&entityId=23bS&role=p&
date=04%2F12%F2010&returnPage=homeS02&out=tr
ue
GRACEFUL
• http://mysite.com/list/products/page/2
• http://mysite.com/user/53
Saturday, December 8, 12
108. Play URLs Are RESTFul
UGLY
• http://www.myapp.com/cont/servlet/buyService?
sessionId=3gh3haaa2gg2&action=nextPage&idExpanse
=false&flow=3C&event=s1e1&entityId=23bS&role=p&
date=04%2F12%F2010&returnPage=homeS02&out=tr
ue
GRACEFUL
• http://mysite.com/list/products/page/2
• http://mysite.com/user/53
You can Read it, Bookmark it, Share it and more over SEO
Friendly
Saturday, December 8, 12
123. • Native Cloud deployment support on
Playapps, Heroku, Google App Engine,
Cloudbees
Saturday, December 8, 12
124. • Native Cloud deployment support on
Playapps, Heroku, Google App Engine,
Cloudbees
• Modules for NoSQL, revert DB, Scaffold,
Excel, Senia, MongoDB, Scalate, PDF,
search, Excel export, etc.
Saturday, December 8, 12
125. • Native Cloud deployment support on
Playapps, Heroku, Google App Engine,
Cloudbees
• Modules for NoSQL, revert DB, Scaffold,
Excel, Senia, MongoDB, Scalate, PDF,
search, Excel export, etc.
• Easy to learn
Saturday, December 8, 12
126. • Native Cloud deployment support on
Playapps, Heroku, Google App Engine,
Cloudbees
• Modules for NoSQL, revert DB, Scaffold,
Excel, Senia, MongoDB, Scalate, PDF,
search, Excel export, etc.
• Easy to learn
• .............................. and it’s
Saturday, December 8, 12
127. • Native Cloud deployment support on
Playapps, Heroku, Google App Engine,
Cloudbees
• Modules for NoSQL, revert DB, Scaffold,
Excel, Senia, MongoDB, Scalate, PDF,
search, Excel export, etc.
• Easy to learn
• .............................. and it’s Java
Saturday, December 8, 12
128. • Native Cloud deployment support on
Playapps, Heroku, Google App Engine,
Cloudbees
• Modules for NoSQL, revert DB, Scaffold,
Excel, Senia, MongoDB, Scalate, PDF,
search, Excel export, etc.
• Easy to learn
• .............................. and it’s Java
Give it a Try !
Saturday, December 8, 12