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
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
Java extensions Java extensions add convenience methods to objects for use in view templates, making expressions more expressive. The code examples show an example template expression, with its result on the next line. Collection extensions join(separator) Concatenates the collection’s entries, with the given separator between each entry. Returns: String.
Play applications can be deployed virtually anywhere: inside Servlet containers, as standalone servers, in Google Application Engine, Stack, a Cloud, etc... Standalone Play applications The simplest and the more robust way is to simply run your Play application without any container. You can use a frontal HTTP server like Lighttpd or Apache if you need more advanced HTTP features like virtual hosting. The built-in HTTP server can serve thousands of HTTP requests per second so it will never be the performance bottleneck. Moreover it uses a more efficient threading model (where a Servlet container uses 1 thread per request). Deployment
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