You are previewing Play in Practice.
O'Reilly logo
Play in Practice

Book Description

Experienced developers looking to integrate the Play framework into their systems will find everything they need in this practical book. By examining the details of a real-world application, you’ll go into the details of making Play 2.4 work as a system—using non-blocking actions, isolating services, recovering from failure, using CQRS and microservices, providing backpressure and rate limiting, deploying applications, and scaling up.

Author Will Sargent is a frequent Play contributor and a Typesafe consultant who has ample experience working with many different web application frameworks. If you’re well-versed in Java and Scala, you’re ready to get started.

Table of Contents

  1. 1. Introduction to Play
    1. Introducing Play in Practice
    2. Chapter Overview
    3. Summary
  2. 2. Defining the Domain
    1. Domain Driven Design
      1. Subdomains and Bounded Contexts
      2. Identity Subdomain
      3. Session Subdomain
      4. Transcoding Subdomain
      5. Asset Management Subdomain
      6. Video Subdomain
      7. Notification Subdomain
      8. Discussion Subdomain
    2. Implementation
    3. Domain Services
    4. Domain Objects
      1. Entities
      2. Value Objects
      3. Standard Types
      4. Domain Events
      5. Adding Behavior to Domain Objects
    5. Recognition
      1. Deferred Recognition
      2. Composing Recognition
      3. Recognition using Regular Expressions
      4. Recognition using Parser Combinators
      5. URL recognition
      6. Recognition from External Libraries
      7. Recognition from Data Formats
      8. Recognition from Object Graphs
    6. Summary
  3. 3. Configuring the System
    1. Running SBT
    2. Looking at build.sbt
      1. Working with projects
      2. Putting it all together
    3. Startup
      1. GuiceApplicationLoader
      2. GuiceApplicationBuilder
      3. Guice Modules
    4. Application Scope Classes
    5. Using HTTPS in development mode
    6. Summary
  4. 4. Presenting Content
    1. Calling templates
    2. Presentation classes
    3. Twirl Templates
    4. Helper classes
    5. Using variables
    6. Conditional statements
    7. Iterating using Loops
    8. Using URLs
    9. Using fragments
    10. Using “when”
    11. Using Default
    12. Enriching Types with Implicit Classes
    13. Defining layouts
    14. Form Rendering Architecture
    15. Rendering a form
      1. Handling Complex Data
    16. Testing
    17. Summary
  5. 5. Handling Requests
    1. Overview
    2. HttpRequestHandler
    3. Routing
      1. Routes
      2. String Interpolating Routing DSL (SIRD)
    4. Error Handling
    5. Filters
    6. Actions
    7. Request
      1. Headers
      2. Cookies
      3. Session
      4. Query Parameters
      5. BodyParser
    8. Response
      1. Writable
      2. Headers
      3. Cookies
      4. Session
      5. Flash
      6. Redirects
    9. Conclusion
  6. 6. Handling State
    1. URLs
      1. Using Path Parameters
      2. Using Query Parameters
      3. Complex Binding through SIRD
    2. Hidden Form Fields
    3. Cookies
      1. Using Session Cookies
      2. Custom Cookies
      3. Encrypted Data in Cookies
    4. Server Side Sessions
    5. Summary