Java Reference
In-Depth Information
Features of Play 2
Play 2.0 was released in 2012 in conjunction with the Typesafe stack. Play 2 was built using Scala
as the core language, whereas Play 1 used the Java language and provided support for Scala by
means of plug-ins. Play 2.2 was released in September 2013. Table 8-1 describes the key features
of Play 2.
Table 8-1. Key Features of Play 2
Feature
Description
Asynchronous I/O
Play 2 can service long requests asynchronously as a result of using
JBoss Netty 1 as its web server.
Built-in web server
Play 2 provides the JBoss Netty web server out of the box, but Play web
applications can also be packaged as WAR files to be distributed to Java
EE application servers.
Dependency management
Play 2 provides sbt 2 for dependency management.
Hot reloading
In a Play 2-based application, the code in development mode is checked
for updates each time a new request arrives, and any changed files
are automatically recompiled; if there is any error, the error is displayed
directly in the browser.
In-memory database
Like Grails, Play 2 supports H2 out of the box.
Native Scala support
Play 2 uses Scala natively but is completely interoperable with Java.
ORM
Play 2 provides Ebean 3 as the ORM replacement of JPA to access
databases.
Stateless
Play 2 is fully RESTful, and there is no Java EE session per connection.
Templating
Play 2 uses Scala for the template engine.
Testing framework
Play 2 provides a built-in test framework for unit testing and functional
testing such as JUnit and Selenium. 4
Web Sockets
Play 2 implements Web Sockets out of the box to enable a bi-directional
connection between a client and the server.
MVC in Play 2
A Play 2 application follows the MVC architectural pattern. In a Play 2 application, the MVC layers
are defined in the app directory, each one in a separate package (see Figure 8-1 ).
http://netty.io/
1
www.scala-sbt.org/
2
www.avaje.org/
3
www.seleniumhq.org/
4
 
 
Search WWH ::




Custom Search