Play for Scala
Covers Play 2
Peter Hilton, Erik Bakker, and Francisco Canedo
Foreword by James Ward
  • October 2013
  • ISBN 9781617290794
  • 328 pages
  • printed in black & white

The code examples are complete and well-explained ... this book fits the needs of both novices and experts.

From the Foreword by James Ward, Typesafe

Play for Scala shows you how to build Scala-based web applications using the Play 2 framework. This book starts by introducing Play through a comprehensive overview example. Then, you'll look at each facet of a typical Play application both by exploring simple code snippets and by adding to a larger running example. Along the way, you'll deepen your knowledge of Scala as a programming language and work with tools like Akka.

Table of Contents show full

foreword

preface

acknowledgments

about this book

about the cover illustration

Part 1 Getting started

1. Introduction to Play 2

1.1. What Play is

1.2. High-productivity web development

1.3. Why Scala needs Play

1.4. Type-safe web development—why Play needs Scala

1.5. Hello Play!

1.6. The console

1.7. Summary

2. Your first Play application

2.1. The product list page

2.2. Details page

2.3. Adding a new product

2.4. Summary

Part 2 Core functionality

3. Deconstructing Play application architecture

3.1. Drawing the architectural big picture

3.2. Application configuration—enabling features and changing defaults

3.3. The model—adding data structures and business logic

3.4. Controllers—handling HTTP requests and responses

3.5. View templates—formatting output

3.6. Static and compiled assets

3.7. Jobs—starting processes

3.8. Modules—structuring your application

3.9. Summary

4. Defining the application’s HTTP interface

4.1. Designing your application’s URL scheme

4.2. Controllers—the interface between HTTP and Scala

4.3. Routing HTTP requests to controller actions

4.4. Binding HTTP data to Scala objects

4.5. Generating HTTP calls for actions with reverse routing

4.6. Generating a response

4.7. Summary

5. Storing data—the persistence layer

5.1. Talking to a database

5.2. Creating the schema

5.3. Using Anorm

5.4. Using Squeryl

5.5. Caching data

5.6. Summary

6. Building a user interface with view templates

6.1. The why of a template engine

6.2. Type safety of a template engine

6.3. Template basics and common structures

6.4. Structuring pages: template composition

6.5. Reducing repetition with implicit parameters

6.6. Using LESS and CoffeeScript: the asset pipeline

6.7. Internationalization

6.8. Summary

7. Validating and processing input with the forms API

7.1. Forms—the concept

7.2. Forms basics

7.3. Creating and processing HTML forms

7.4. Validation and advanced mappings

7.5. Summary

Part 3 Advanced concepts

8. Building a single-page JavaScript application with JSON

8.1. Creating the single-page Play application

8.2. Serving data to a JavaScript client

8.3. Sending JSON data to the server

8.4. Validating JSON

8.5. Authenticating JSON web service requests

8.6. Summary

9. Play and more

9.1. Modules

9.2. Plugins

9.3. Deploying to production

9.4. Summary

10. Web services, iteratees, and WebSockets

10.1. Accessing web services

10.2. Dealing with streams using the iteratee library

10.3. WebSockets: Bidirectional communication with the browser

10.4. Using body parsers to deal with HTTP request bodies

10.5. Another way to look at iteratees

10.6. Summary

index 297

© 2014 Manning Publications Co.

About the book

Play is a Scala web framework with built-in advantages: Scala's strong type system helps deliver bug-free code, and the Akka framework helps achieve hassle-free concurrency and peak performance. Play builds on the web's stateless nature for excellent scalability, and because it is event-based and nonblocking, you'll find it to be great for near real-time applications.

Play for Scala teaches you to build Scala-based web applications using Play 2. It gets you going with a comprehensive overview example. It then explores each facet of a typical Play application by walking through sample code snippets and adding features to a running example. Along the way, you'll deepen your knowledge of Scala and learn to work with tools like Akka.

Written for readers familiar with Scala and web-based application architectures. No knowledge of Play is assumed.

What's inside

  • Intro to Play 2
  • Play's MVC structure
  • Mastering Scala templates and forms
  • Persisting data and using web services
  • Using Play's advanced features

About the reader

Written for readers familiar with Scala and web-based application architecture. No previous experience with Play! required.

About the authors

Peter Hilton, Erik Bakker, and Francisco Canedo are engineers at Lunatech, a consultancy with Scala and Play expertise. They are contributors to the Play framework.


combo $49.99 pBook + eBook
eBook $39.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks

Well-written and informative, with great insight.

Magnus Smith, Advanced Computer Software

Writing web apps is fun again thanks to this book.

Andy Hicks, UnderScore Consulting

A superb resource for both learning Play and improving your Scala.

Steve Chaloner, Objectify