You are previewing Play Framework Cookbook - Second Edition.
O'Reilly logo
Play Framework Cookbook - Second Edition

Book Description

Over 60 hands-on recipes to create dynamic and reactive web-based applications with Play 2

In Detail

As web and mobile systems become more sophisticated, anchoring systems in a mature, solid framework has become increasingly important. Play 2 provides developers with the necessary tools to build robust web applications.

This book is a compilation of useful recipes aimed at helping developers discover the power of Play 2. The introductory section serves as a primer to Play Framework, wherein all the fundamentals of the framework are covered extensively. It then explains the usage of controllers and how modules can be leveraged for optimal performance. Next, the book walks you through creating and using APIs, followed by extensive real-world applications. Finally, you will learn to manage applications post production.

What You Will Learn

  • Implement the Model-View-Controller (MVC) web architecture with Play 2

  • Convert data between incompatible type systems using ORM tools such as Ebean and Anorm

  • Serve and receive JSON messages to transmit data objects

  • Create long-running, asynchronous controllers using Akka

  • Learn to use modules for Amazon S3, Redis, and MongoDB

  • Consume public APIs using the Play WS API

  • Make your application production-ready by integrating it with AngularJS

  • Automate the creation of a portable development environment using Vagrant

  • Deploy Play 2 applications with Docker

  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. Play Framework Cookbook Second Edition
      1. Table of Contents
      2. Play Framework Cookbook Second Edition
      3. Credits
      4. About the Authors
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Conventions
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      8. 1. Basics of Play Framework
        1. Introduction
        2. Installing Play Framework
          1. Getting ready
          2. How to do it...
        3. Creating a Play application using Typesafe Activator
          1. How to do it...
          2. How it works…
          3. There's more...
        4. Using the Play console
          1. How to do it…
          2. There's more…
        5. Working with modules
          1. How to do it…
          2. How it works…
          3. There's more...
        6. Working with controllers and routes
          1. How to do it...
          2. How it works…
        7. Using Action parameters in controllers
          1. How to do it…
          2. How it works...
        8. Using reverse routing and redirects
          1. How to do it…
          2. How it works...
        9. Working with View templates
          1. How to do it...
          2. How it works...
        10. Using helper tags
          1. How to do it...
          2. How it works...
        11. Using View layouts and Includes
          1. How to do it...
          2. How it works...
        12. Working with XML and text files
          1. How to do it...
          2. How it works...
        13. Using Ebean (Java) with MySQL
          1. How to do it...
            1. Creating a record
            2. Updating a record
            3. Querying a record
            4. Retrieving a record
        14. Using Anorm (Scala) and database evolutions with MySQL
          1. There's more…
            1. Creating a new record
            2. Updating a record
            3. Deleting a record
        15. Using a form template and web action
          1. How to do it...
          2. How it works...
        16. Using form validation
          1. How to do it...
          2. How it works...
        17. Securing form submission
          1. How to do it...
          2. How it works...
        18. Testing with JUnit (Java) and specs2 (Scala)
          1. How to do it...
          2. How it works...
        19. Testing models
          1. How to do it...
          2. How it works...
        20. Testing controllers
          1. How to do it...
          2. How it works...
      9. 2. Using Controllers
        1. Introduction
        2. Using HTTP headers
          1. How to do it…
          2. How it works…
        3. Using HTTP cookies
          1. How to do it…
          2. How it works…
        4. Using the session
          1. How to do it…
          2. How it works…
        5. Using custom actions
          1. How to do it…
          2. How it works…
        6. Using filters
          1. How to do it…
          2. How it works…
        7. Using path binders
          1. How to do it…
          2. How it works…
        8. Serving JSON
          1. How to do it…
          2. How it works…
        9. Receiving JSON
          1. How to do it…
          2. How it works…
        10. Uploading files
          1. How to do it…
          2. How it works…
        11. Using futures with Akka actors
          1. How to do it…
          2. How it works…
      10. 3. Leveraging Modules
        1. Introduction
        2. Dependency injection with Spring
          1. How to do it…
          2. How it works…
        3. Dependency injection using Guice
          1. How to do it…
          2. How it works…
        4. Utilizing MongoDB
          1. How to do it…
          2. How it works…
        5. Utilizing MongoDB and GridFS
          1. How to do it…
          2. How it works…
        6. Utilizing Redis
          1. How to do it…
          2. How it works…
        7. Integrating Play application with Amazon S3
          1. How to do it…
          2. How it works…
        8. Integrating with Play application Typesafe Slick
          1. How to do it…
          2. How it works…
        9. Utilizing play-mailer
          1. How to do it…
          2. How it works…
        10. Integrating Bootstrap and WebJars
          1. How to do it…
          2. How it works…
      11. 4. Creating and Using Web APIs
        1. Introduction
        2. Creating a POST API endpoint
          1. How to do it…
          2. How it works…
        3. Creating a GET API endpoint
          1. How to do it…
          2. How it works…
        4. Creating a PUT API endpoint
          1. How to do it…
          2. How it works…
        5. Creating a DELETE API endpoint
          1. How to do it…
          2. How it works…
        6. Securing API endpoints with HTTP basic authentication
          1. How to do it…
          2. How it works…
        7. Consuming external web APIs
          1. How to do it…
          2. How it works…
        8. Using the Twitter API and OAuth
          1. How to do it…
          2. How it works...
      12. 5. Creating Plugins and Modules
        1. Introduction
        2. Creating and using your own plugin
          1. How to do it…
          2. How it works…
        3. Building a flexible registration module
          1. How to do it…
          2. How it works…
        4. Using the same model for different applications
          1. How to do it…
          2. How it works…
        5. Managing module dependencies
          1. How to do it…
          2. How it works…
        6. Adding private module repositories using Amazon S3
          1. How to do it…
          2. How it works…
      13. 6. Practical Module Examples
        1. Introduction
        2. Integrating a Play application with message queues
          1. How to do it…
          2. How it works…
        3. Integrating a Play application with ElasticSearch
          1. How to do it…
          2. How it works…
        4. Implementing token authentication using JWT
          1. How to do it…
          2. How it works…
      14. 7. Deploying Play 2 Web Apps
        1. Introduction
        2. Deploying a Play application on Heroku
          1. How to do it...
          2. How it works...
            1. Procfile
            2. system.properties
          3. There's more...
        3. Deploying a Play application on AWS Elastic Beanstalk
          1. How to do it...
          2. How it works...
          3. There's more...
        4. Deploying a Play application on CoreOS and Docker
          1. How to do it...
          2. How it works...
          3. There's more...
        5. Deploying a Play application with Dokku
          1. How to do it...
          2. How it works...
          3. There's more...
        6. Deploying a Play application with Nginx
          1. How to do it...
          2. How it works...
      15. 8. Additional Play Information
        1. Introduction
        2. Testing with Travis CI
          1. How to do it…
          2. How it works…
        3. Monitoring with New Relic
          1. How to do it…
          2. How it works…
        4. Integrating a Play application with AngularJS
          1. How to do it…
          2. How it works…
        5. Integrating a Play application with Parse.com
          1. How to do it…
          2. How it works…
          3. There's more…
        6. Creating a Play development environment using Vagrant
          1. How to do it…
          2. How it works…
          3. There's more…
        7. Coding Play 2 web apps with IntelliJ IDEA 14
          1. How to do it…
          2. How it works…
      16. Index