Play Framework Cookbook

Over 60 incredibly effective recipes to take you under the hood and leverage advanced concepts of the Play framework

Play Framework Cookbook

Cookbook
Alexander Reelsen

Over 60 incredibly effective recipes to take you under the hood and leverage advanced concepts of the Play framework
$26.99
$44.99
RRP $26.99
RRP $44.99
eBook
Print + eBook
$12.99 p/month

Get Access

Get Unlimited Access to every Packt eBook and Video course

Enjoy full and instant access to over 3000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781849515528
Paperback292 pages

About This Book

  • Make your application more modular, by introducing you to the world of modules.
  • Keep your application up and running in production mode, from setup to monitoring it appropriately.
  • Integrate play applications into your CI environment
  • Keep performance high by using caching
  • Learn how to leverage external APIs without letting your application go down on problems
  • Use the play framework as a provider for your API systems
  • Implement your own authorization mechanisms, and different output formats

Who This Book Is For

This is the ideal book for people who have already written a first application with the Play Framework or have just finished reading through the documenation. In other words - anyone who is ready to get to grips with Play! Having a basic knowledge of Java is good, as well as well as some web developer skills – HTML and JavaScript

Table of Contents

Chapter 1: Basics of the Play Framework
Introduction
Downloading and installing the Play framework
Creating a new application
Defining routes as the entry point to your application
Configuring your application via application.conf
Defining your own controllers
Defining your own models
Using fixtures to provide initial data
Defining your own views
Writing your own tags
Using Java Extensions to format data in your views
Adding modules to extend your application
Using Oracle or other databases with Play
Understanding suspendable requests
Understanding session management
Chapter 2: Using Controllers
Introduction
URL routing using annotation-based configuration
Basics of caching
Using HTTP digest authentication
Generating PDFs in your controllers
Binding objects using custom binders
Validating objects using annotations
Adding annotation-based right checks to your controller
Rendering JSON output
Writing your own renderRSS method as controller output
Chapter 3: Leveraging Modules
Introduction
Dependency injection with Spring
Dependency injection with Guice
Using the security module
Adding security to the CRUD module
Using the MongoDB module
Using MongoDB/GridFS to deliver files
Chapter 4: Creating and Using APIs
Introduction
Using Google Chart API as a tag
Including a Twitter search in your application
Managing different output formats
Binding JSON and XML to objects
Chapter 5: Introduction to Writing Modules
Introduction
Creating and using your own module
Building a flexible registration module
Understanding events
Managing module dependencies
Using the same model for different applications
Understanding bytecode enhancement
Adding private module repositories
Preprocessing content by integrating stylus
Integrating Dojo by adding command line options
Chapter 6: Practical Module Examples
Introduction
Adding annotations via bytecode enhancement
Implementing your own persistence layer
Integrating with messaging queues
Using Solr for indexing
Writing your own cache implementation
Chapter 7: Running in Production
Introduction
Test automation with Jenkins
Test automation with Calimoucho
Creating a distributed configuration service
Running jobs in a distributed environment
Running one Play instance for several hosts
Forcing SSL for chosen controllers
Implementing own monitoring points
Configuring log4j for log rotation
Integrating with Icinga
Integrating with Munin
Setting up the Apache web server with Play
Setting up the Nginx web server with Play
Setting up the Lighttpd web server with Play
Multi-node deployment introduction

What You Will Learn

  • Write own render methods to return custom formats for creating custom PDFs or RSS and ATOM feed responses
  • Understand internal caching and implement your own cache in just a few lines of code
  • Use existing modules to incorporate legacy spring or guice applications
  • Integrate external APIs into your own application without affecting your application during downtimes
  • Add custom monitoring points deep inside your application to simplify bottleneck detection
  • Create your own API which gets exposed to the world wide web
  • Leverage the validation abilities of the play framework to make sure you always handle valid data to your backend
  • Create your own modules to make your application as reusable as possible
  • Improve performance by setting up multi node environments without struggling through the usual pitfalls
  • Provide integration to your operation monitoring systems like nagios or icinga
  • Implement messaging capabilities by connecting to apache camel or rabbitmq
  • Improve searching of data in a multi node setup by searching via apache solr

 

In Detail

The Play framework is the new kid on the block of Java frameworks. By breaking with existing standards the play framework tries not to abstract away from HTTP as most web frameworks do, but tightly integrates with it. This means quite a shift for Java programmers. Understanding these concepts behind the play framework and its impact on web development with Java are crucial for fast development of applications.

The Play Framework Cookbook starts where the beginner documentation ends. It shows you how to utilize advanced features of the Play framework – piece by piece and completely outlined with working applications!

The reader will be taken through all layers of the Play Framework and provided with in-depth knowledge from as many examples and applications as possible. Leveraging the most from the Play framework means to think simple again in a java environment. Implement your own renderers, integrate tightly with HTTP, use existing code, improve site performance with caching and integrate with other web services and interfaces. Learn about non-functional issues like modularity or integration into production and testing environments. In order to provide the best learning experience during reading Play Framework Cookbook, almost every example is provided with source code, so you can start immediately to integrate recipes into your own play applications.

Authors

Table of Contents

Chapter 1: Basics of the Play Framework
Introduction
Downloading and installing the Play framework
Creating a new application
Defining routes as the entry point to your application
Configuring your application via application.conf
Defining your own controllers
Defining your own models
Using fixtures to provide initial data
Defining your own views
Writing your own tags
Using Java Extensions to format data in your views
Adding modules to extend your application
Using Oracle or other databases with Play
Understanding suspendable requests
Understanding session management
Chapter 2: Using Controllers
Introduction
URL routing using annotation-based configuration
Basics of caching
Using HTTP digest authentication
Generating PDFs in your controllers
Binding objects using custom binders
Validating objects using annotations
Adding annotation-based right checks to your controller
Rendering JSON output
Writing your own renderRSS method as controller output
Chapter 3: Leveraging Modules
Introduction
Dependency injection with Spring
Dependency injection with Guice
Using the security module
Adding security to the CRUD module
Using the MongoDB module
Using MongoDB/GridFS to deliver files
Chapter 4: Creating and Using APIs
Introduction
Using Google Chart API as a tag
Including a Twitter search in your application
Managing different output formats
Binding JSON and XML to objects
Chapter 5: Introduction to Writing Modules
Introduction
Creating and using your own module
Building a flexible registration module
Understanding events
Managing module dependencies
Using the same model for different applications
Understanding bytecode enhancement
Adding private module repositories
Preprocessing content by integrating stylus
Integrating Dojo by adding command line options
Chapter 6: Practical Module Examples
Introduction
Adding annotations via bytecode enhancement
Implementing your own persistence layer
Integrating with messaging queues
Using Solr for indexing
Writing your own cache implementation
Chapter 7: Running in Production
Introduction
Test automation with Jenkins
Test automation with Calimoucho
Creating a distributed configuration service
Running jobs in a distributed environment
Running one Play instance for several hosts
Forcing SSL for chosen controllers
Implementing own monitoring points
Configuring log4j for log rotation
Integrating with Icinga
Integrating with Munin
Setting up the Apache web server with Play
Setting up the Nginx web server with Play
Setting up the Lighttpd web server with Play
Multi-node deployment introduction

Book Details

ISBN 139781849515528
Paperback292 pages
Read More