One thing that the Play framework has in common with other RESTful architectures is the direct use of HTTP functionality, instead of trying to hide HTTP or put an abstraction layer on top of it. This article shows you how to use HTTP content negotiation in a Play framework web application.
Here is an example of a striking difference in verbosity between Java and Scala. Some languages make it easy to concisely declare data structures in your code. Perl, Python, Ruby, PHP all do. Java doesn't.
Let's say you would like to maintain a simple lookup table in your code, to map from country code to country name. And to make it more interesting, let's say you want to have the country names in a couple of different languages.
Panzano is an Italian deli that sells the best sandwiches in Rotterdam, and even delivers, which makes it the perfect catering for a business lunch. However, you cannot order on-line and, bizarrely, Panzano does not even have a web site, which makes it difficult to order by phone or fax for a group if you neglected to memorise all 28 sandwiches. Here is a copy of the menu (as of 1 July 2010), and an idea.
If you want someone to know how fast and straightforward it is to build a Java web application with the Play framework, then show, don't tell. The most compelling way to do this is to download Play and start coding a web application from scratch, while they watch. This article is a script for a five-minute live-coding Play demo.
Now that you are getting started with the Play framework, you need a handy quick reference. Here is a Play framework cheat sheet (A4 PDF, 53 KB), with the essential commands, tags and extensions.
Copyright © 2005-2010, Lunatech Research B.V. Tous droits réservés.