Chapter 1. Introduction to Play 2
Figure 1.1. Play framework stack
Figure 1.2. Java EE “lasagna” architecture compared to Play’s simplified architecture
Figure 1.3. The default welcome page for a new Play application
Chapter 2. Your first Play application
Figure 2.1. The main page, showing a list of products
Figure 2.2. The application’s model-view-controller structure
Figure 2.3. The product list page, with the language set to Spanish (es)
Figure 2.4. The product details page, including a generated bar code
Chapter 3. Deconstructing Play application architecture
Figure 3.1. A client sends an HTTP request to the server, which sends back an HTTP response.
Figure 3.2. An HTTP request and an HTTP response have text content.
Figure 3.4. Play is persistence API agnostic, although it comes with an API for SQL databases.
Figure 3.5. Two different ways to structure your application’s model layer
Figure 3.6. Persistence architecture in a Play application
Figure 3.7. Play routes HTTP requests to action methods in controller classes.
Figure 3.8. URL-centric design starts with identifying HTTP resources and their URLs.
Figure 3.9. Routing syntax for matching HTTP requests
Figure 3.10. Routing and binding an HTTP request
Figure 3.11. UI components that span client and server and generate HTML
Figure 3.12. Server-side HTML templates
Figure 3.13. Client-side JavaScript components, decoupled from the server
Figure 3.14. A simple pick list
Figure 3.15. User interface to manually trigger an asynchronous job
Figure 3.16. Play application dependencies on libraries, modules, and the framework itself
Chapter 4. Defining the application’s HTTP interface
Figure 4.1. A controller handles an HTTP request by invoking an action method that returns a result.
Figure 4.2. Requests are mapped by HTTP method and URL to actions that generate web pages.
Figure 4.3. Selecting the route that’s the mapping from GET /products to Products.list
Figure 4.4. routes file’s route definition syntax
Figure 4.5. Routing requests: binding parameters and invoking controller actions
Figure 4.6. The error page that Play shows as a result of a binding error
Figure 4.7. Routing requests to actions, compared to reverse routing actions to requests
Figure 4.8. The Network debug view in Safari, showing response headers at the bottom
Figure 4.9. Generated PNG bar code, served as an image/png response
Chapter 5. Storing data—the persistence layer
Figure 5.1. An overview of Play’s persistence layer
Figure 5.2. Applying your script to the default database
Figure 5.3. The relationship between the schema and the model classes
Figure 5.4. What a simple query looks like
Figure 5.5. Squeryl’s order by clause
Chapter 6. Building a user interface with view templates
Figure 6.1. Templates in the request lifecycle
Figure 6.3. List of best sellers
Figure 6.4. Cross-site scripting attack
Figure 6.5. Rendering text in a safe way
Figure 6.6. Escaping in templates
Figure 6.8. Our web shop catalog
Figure 6.9. Composition of a web page
Figure 6.10. Web shop catalog with cart item count in top-right corner
Chapter 7. Validating and processing input with the forms API
Figure 7.2. Form with custom LocalDate mapper
Figure 7.3. Form with custom LocalDate mapper and invalid input
Chapter 8. Building a single-page JavaScript application with JSON
Figure 8.1. Editing the first row of a table of products
Figure 8.2. Single-page JavaScript application architecture
Figure 8.3. A list of product EAN codes fetched from a web service URL and rendered in JavaScript
Figure 8.4. A table that consists of a single column of EAN codes
Figure 8.5. Product details fetched by one additional GET request per table row
Figure 8.6. Complete product details table
Figure 8.7. Editing a table cell’s contents using the HTML5 contenteditable attribute
Figure 8.8. Displaying a label to indicate a successful Ajax request
Figure 8.9. Displaying a label to indicate a server-side error
Chapter 10. Web services, iteratees, and WebSockets
Figure 10.1. Page showing tweets mentioning paperclips
Figure 10.2. Using the WS library
Figure 10.3. Using the WS library with an iteratee to consume the response
Figure 10.4. Bidirectional communication using polling
Figure 10.5. Bidirectional communication using Comet
Figure 10.6. Bidirectional communication using WebSocket
Figure 10.7. Status page showing load average