Author(s): Prem Kumar Karunakaran
Edition: 2
Publisher: Apress
Year: 2020
Language: English
Tags: java web 2020
Table of Contents
About the Author
About the Technical Reviewer
Preface
Chapter 1: Getting Started with Play 2
Getting Ready
Installation
Prerequisites
Installing sbt
Installing conscript
Installing Giter8
Setting Up Play
Using Play Example Projects
Using sbt
Installing a Java Project Using sbt
Installing a Scala Project Using sbt
Creating Your First Project
app
conf
build.sbt
project
public
lib
test
Configuring Play to Work with Your Preferred IDE
Setting Up in Eclipse
Setting Up in IntelliJ
Hello World Application
Configuration
Controller and View
View
Controller
Enhancing the View
Testing Play Applications
Testing Views
Testing Controllers
Chapter 2: Build System
Scala Build Tool/Simple Build Tool
Core Principles
Benefits of sbt
Project Structure
Using sbt
Setting Definition
Resolvers
Complete build.sbt
Complete plugins.sbt
Quick Recap of SBT Commands
Chapter 3: Play Controllers and HTTP Routing
MVC Programming Model
Model
View
Controller
HTTP Routing
Static Definition
Dynamic Parts in a URL
Passing Fixed Values
Optional Parameters
Application Configuration Using application.conf
Controllers
Finishing the Bookshop Controller
saveComment Method
Testing the saveComment Action
Models
Scoped Objects
Session Scope
Flash Scope
Chapter 4: Play Views and Templating with Scala
Composite Views
Designing a General Template
Code Snippets Templating Basics
Comments
Template Parameters
Import Statement
Iterating a List
Iterating a Map
If Blocks
Escaping Dynamic Contents
Chapter 5: Concurrency and Asynchronous Programming
What Is Concurrency?
Executor
Example 1: Using Runnable
Example 2: Using Callable
Asynchronous Programming with Play
Writing an Asynchronous App
Configuring Asynchronous Scheduled Jobs
Akka Basics
Chapter 6: Web Services, JSON, and XML
Consuming Web Services
Processing Large Responses
Handling JSON
Consuming JSON Request
Producing a JSON Response
Handling XML
Example 1: Simple XML Parsing
Example 2: XML Parsing Using JAXB
Chapter 7: Accessing Databases
Configuring Database Support
Working with an ORM
ORM Concepts
Key Terms
One to Many
Many to One
Many to Many
Relationship Direction
Configuring JPA
Using Ebean in Play
Ebean Query
Common Select Query Constructs in Ebean
where()
eq()
like()
orderBy()
findUnique()
findList()
LIMIT {max rows} [ OFFSET {first row} ]
The Query Interface
Using RawSql
Relationships in Ebean
Chapter 8: Complete Example
Chapter 9: Using Play Modules
Creating a Module
Third-Party Modules
Chapter 10: Application Settings and Error Handling
Filters
Action Composition
Error Handlers
Client Errors
Server Errors
How Global Settings Were Done Before Play 2.6.x
Chapter 11: Working with Cache
Configuring Caffeine
Adding Caffeine to a Project
Configuring EhCache
Using the Cache API
Chapter 12: Production Deployment
Configuring Apache httpd for Play
Load Balancing Using mod_proxy_balancer
Configuring Play with Nginx
Index