Welcome to the website for the worlds first Play Framework book. Thank you to everyone who have valuable feedback during the Beta release of the book. Thanks to your support, the final release is now available, along with a Paperback version to go with the eBook! The book was written with help and guidance from Guillaume Bort (the Framework creator). Jump in and see why Play is so special. Introducing the Play Framework
YAML YAML syntax Your application tests will often use data structures that consist of related model objects, which can be tedious to create programmatically in Java. Play includes a YAML parser which makes the task much simpler. Create a YAML file like the following, in the conf directory. City(capitalfederal): name: Capital Federal state: Buenos Aires User(john): name: "John Smith" email: firstname.lastname@example.org lang: es created: 2007-01-01 User(frank): name: "Frank Franken" email: email@example.com lang: en created: 2007-08-05 Neighborhood(villalugano): name: Villa Lugano city: capitalfederal tags: "shopping, cafes" users: [john, frank] Neighborhood(coghlan): name: Coghlan city: capitalfederal tags: "cafes, bars" users: [john] Play’s YAML syntax varies slightly from the standard.
snakeyaml This documentation is very brief and incomplete. Feel free to fix or improve it. Installation If you use Maven just add a dependency as described here. If you do not use Maven download the latest JAR and put it to the classpath. Frequently Asked Questions
Play Framework - Better JSON serialization with FlexJSON We want to be able to create multiple different JSON views on the same object, to be used in our Play templates. This is useful, because entities are often used in several contexts. A news item may be shown with only a few details in a listing of news items, with more details on a separate page for that news item, and with even more details for an editor of the website.
In summary, this article describes a simple example of how to define a Java annotation that will declaratively add behaviour to a model class in a Play framework application. You can do with with a custom annotation and a Play module that enhances the model JavaBean class. Suppose your Play application uses the CRUD module to provide a default user-interface for managing data such as the following JavaBean. Declarative model class enhancement in Play
Play! Framework cheat sheet Controller/link?i=32&n=patrickpublic static void link(int i, String n)public static void link(Integer i, String n)public static void link(Long i, String n) Controller/show?id=1&id=2&id=3&id=4public static void show(Long id)public static void show(List
Play framework - Setting up a basic administration area using CRUD Currently, we have no way to create new blog posts or moderate comments using the blog UI. Play provides an out of the box CRUD module that will help quickly generate a basic administration area. Enabling the CRUD module A Play application can be assembled from several application modules. This lets you reuse components across several applications or split a large application into several smaller ones. The CRUD module is a generic application that introspects the model classes to create simple lists and forms.
Overview (Hibernate JavaDocs)
Closure (Groovy 1.7.5)
Caching To create high-performance systems, sometimes you need to cache data. Play has a cache library and will use Memcached when used in a distributed environment. If you don’t configure Memcached, Play will use a standalone cache that stores data in the JVM heap.
A simple, asynchronous, single-threaded memcached client written in java. Efficient storage of objects. General serializable objects are stored in their serialized form and optionally compressed if they meet criteria. spymemcached - java memcached interface
javadocs for spymemcached 2.4.2
What is Memcached? Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load. Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.
A Play application can be assembled from several application modules. This allows you to reuse application components across several applications or split a large application into several smaller applications. What is a module? A module is just another Play application; however some differences exist in the way resources are loaded for an application module: A module does not have a conf/application.conf file.A module can have a conf/routes file, but these routes will not be loaded automatically.All files are first searched for in the main application path, then in all loaded modules.A module can contain plain Java code packaged as a JAR file in the module/lib directory.Everything in a module is optional. You can create a module with the play new-module command. Module basics
UnboundID LDAP API
Using UnboundID LDAP SDK LDAP SDK for Java Using the UnboundID LDAP SDK Persistence Framework The UnboundID LDAP SDK for Java provides a persistence framework that can be used to easily store Java objects in an LDAP directory server.
com.unboundid.ldap.sdk Class StartTLSPostConnectProcessor java.lang.Object com.unboundid.ldap.sdk.StartTLSPostConnectProcessor All Implemented Interfaces: PostConnectProcessor LDAP Connection Pools with StartTLS
Getting Started with Javassist Shigeru Chiba 1. Reading and writing bytecode2. Javassist Tutorial
The Play logger is built on Log4j. Since most Java libraries use Log4j or a wrapper able to use Log4j as a backend, you can easily configure logging that is well-suited to your application. Logging from your application Play provides a default logger with the class play.Logger. This class uses Log4j to write messages and exceptions to a logger named “play”. Logging configuration
Log4j 1.2.16 API
Moving to production
How Comet works in Play!
Implicit Objects in templates
Implicit Objects in Controllers
Gson User Guide
Coding style guide
Scala module documentation
Getting Started Guide
OVal 1.61 API
OVal - Object Validation