Table of Contents

Copyright

Brief Table of Contents

Table of Contents

Foreword

Preface

Acknowledgments

About this Book

1. Introduction and first steps

Chapter 1. An introduction to Play

1.1. What Play is

1.1.1. Key features

1.1.2. Java and Scala

1.1.3. Play is not Java EE

1.2. High-productivity web development

1.2.1. Working with HTTP

1.2.2. Simplicity, productivity, and usability

1.3. Reactive programming

1.3.1. Event-driven

1.3.2. Scalable

1.3.3. Resilient

1.3.4. Responsive

1.4. Play 2 enterprise features

1.4.1. Simplicity

1.4.2. Traditional data access

1.4.3. Flexibility

1.4.4. Integration

1.4.5. Large-team applications

1.4.6. Security

1.4.7. Modularity

1.5. Hello Play!

1.5.1. Installing Play

1.5.2. Creating your first application

1.5.3. Play application structure

1.5.4. Running the application

1.5.5. Accessing the running application

1.5.6. Changing the controller class

1.5.7. Add a compilation error

1.5.8. Use an HTTP request parameter

1.5.9. Add an HTML page template

1.6. The console

1.7. Summary

Chapter 2. The parts of an application

2.1. Introducing our application

2.2. A rundown of a Play application

2.3. Play’s configuration files

2.4. Build configuration files

2.5. Public assets

2.6. Application code

2.6.1. Compiled assets

2.7. Setting up an IDE

2.7.1. Eclipse

2.7.2. NetBeans

2.7.3. IntelliJ IDEA

2.7.4. Using a debugger

2.8. Summary

Chapter 3. A basic CRUD application

3.1. Adding a controller and actions

3.2. Mapping URLs to action methods using routes

3.3. Adding a model and implementing functionality

3.3.1. Creating a model class

3.4. Mocking some data

3.5. Implementing the list method

3.5.1. The list template

3.6. Adding the product form

3.6.1. Constructing the form object

3.6.2. Rendering the HTML form

3.6.3. Rendering input fields

3.7. Handling the form submission

3.8. Adding a delete button

3.9. Summary

2. Core functionality

Chapter 4. An enterprise app, Play-style

4.1. Recalling what an enterprise application is

4.2. Determining today’s enterprise application challenges

4.3. Understanding Play’s application in an enterprise context

4.4. Defining our warehouse enterprise application

4.5. Summary

Chapter 5. Controllers—handling HTTP requests

5.1. Controllers and action methods

5.1.1. Action methods

5.1.2. Examining our controller

5.2. Returning results from action methods

5.2.1. Results

5.2.2. Redirect result

5.2.3. Using results

5.3. Using routing to wire URLs to action methods

5.3.1. Translating HTTP to Java code

5.3.2. The routes files explained

5.3.3. Dynamic path parts

5.3.4. Completing our routes file

5.3.5. Reverse routing

5.4. Interceptors

5.4.1. The @With annotation

5.4.2. Explaining our CatchAction

5.4.3. Action composition

5.5. About scopes

5.5.1. A bit of history about the scopes

5.5.2. Storing data with Play

5.5.3. The context object

5.5.4. The request scope

5.5.5. The response scope

5.5.6. The session scope

5.5.7. The flash scope

5.5.8. What about security?

5.6. Summary

Chapter 6. Handling user input

6.1. Forms

6.1.1. Displaying the new product form

6.1.2. Displaying the edit product form

6.1.3. Processing form input

6.2. Data binding

6.2.1. Binding single values

6.2.2. Binding multiple values

6.2.3. Custom data binders and formatters

6.3. Body parsers

6.3.1. The body-parser API

6.4. Validation

6.4.1. Using the built-in validators

6.4.2. Partial validation

6.4.3. Creating a custom validator

6.4.4. Displaying the validation errors on the form

6.5. File uploads

6.6. Summary

Chapter 7. Models and persistence

7.1. Modeling the real world in code

7.1.1. The reasons for getters and setters

7.1.2. Let Play eliminate some noise for you

7.1.3. Creating our classes

7.2. Persistence and Object-Relational Mapping (ORM)

7.2.1. About relational databases

7.2.2. Bridging the relational world and the OO world

7.2.3. Introducing Ebean

7.3. Mapping basic entities

7.3.1. Configuring Ebean and the database

7.3.2. Inspecting the H2 database

7.3.3. Saving our first entities

7.4. Mapping relationships

7.4.1. Mapping a one-to-many relationship

7.4.2. Making the one-to-many relationship bidirectional

7.4.3. Giving our warehouse an address

7.4.4. Mapping the product–tag relationship

7.5. Querying for objects

7.5.1. Retrieving by ID

7.5.2. Using the Finder API

7.5.3. Loading initial data

7.5.4. Creating more complex queries

7.6. Using JPA instead of Ebean

7.6.1. Configuring Play

7.6.2. Adding Persistence.xml

7.6.3. Built-in JPA helpers

7.7. Summary

Chapter 8. Producing output with view templates

8.1. The benefits of compiled, type-safe templates

8.2. Scala template syntax

8.2.1. Template definition

8.2.2. Template body

8.2.3. Expression scope

8.3. Your basic building blocks

8.3.1. Iterating

8.3.2. Making decisions

8.4. Structuring pages with template composition

8.4.1. Includes

8.4.2. Layouts

8.5. Using LESS and CoffeeScript: the asset pipeline

8.5.1. LESS

8.5.2. CoffeeScript

8.5.3. The asset pipeline

8.6. Internationalization

8.6.1. Configuration and message files

8.6.2. Using messages in your application

8.7. Summary

3. Advanced topics

Chapter 9. Asynchronous data

9.1. What do we mean by asynchronous data?

9.2. Handling asynchronous data

9.2.1. Handling asynchronous requests

9.2.2. Returning the asynchronous result

9.3. Scheduling asynchronous tasks

9.4. Streaming HTTP responses

9.4.1. Standard responses and Content-Length header

9.4.2. Serving files

9.4.3. Chunked responses

9.5. Unidirectional communication with Comet

9.6. Bidirectional communication with WebSockets

9.6.1. WebSockets explained

9.6.2. A more advanced application with WebSockets

9.7. Summary

Chapter 10. Security

10.1. Play security concepts

10.1.1. Play 2 session

10.1.2. Cross-site scripting

10.1.3. SQL injection

10.1.4. Cross-site request forgery

10.2. Adding basic authentication with filters

10.3. Fine-grained authentication with action composition

10.4. Summary

Chapter 11. Modules and deployment

11.1. Modules

11.1.1. Using modules

11.1.2. Creating modules

11.2. Splitting your application into multiple sub-applications

11.3. Deploying to production

11.3.1. Packing up your application

11.3.2. Working with multiple configurations

11.3.3. Creating native packages for a package manager

11.3.4. Setting up a front-end proxy

11.3.5. Using SSL

11.3.6. Deploying to a cloud provider

11.3.7. Deploying to an application server

11.4. Summary

Chapter 12. Testing your application

12.1. Testing Play applications

12.1.1. Writing tests

12.1.2. Running tests

12.2. Functional testing

12.2.1. Testing your controllers

12.2.2. Template testing

12.2.3. Testing the router

12.3. Integration testing

12.3.1. Testing your HTTP interface

12.3.2. Browser testing

12.4. Summary

Index

List of Figures

List of Tables

List of Listings

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset