Play Framework Cookbook


Play Framework Cookbook
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
$22.94
save 15%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
$44.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • 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

Book Details

Language : English
Paperback : 292 pages [ 235mm x 191mm ]
Release Date : August 2011
ISBN : 1849515522
ISBN 13 : 9781849515528
Author(s) : Alexander Reelsen
Topics and Technologies : All Books, Web Development, Cookbooks, Open Source

Table of Contents

Preface
Chapter 1: Basics of the Play Framework
Chapter 2: Using Controllers
Chapter 3: Leveraging Modules
Chapter 4: Creating and Using APIs
Chapter 5: Introduction to Writing Modules
Chapter 6: Practical Module Examples
Chapter 7: Running Into Production
Appendix: Further Information About the Play Framework
Index
  • 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 Into Production
                • Introduction
                • 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

                  Alexander Reelsen

                  Alexander Reelsen is a software engineer living in Munich, Germany, where he has been working on different software systems, for example a touristic booking engine, a campaign management and messaging platform and a b2b ecommerce portal. He has been using the play framework since 2009 and was immediately astonished by the sheer simplicity of this framework, while still being pure java. Other interests include scaling shared-nothing web architectures and nosql databases. Being rather a system engineer most of the time when he started playing around with Linux at the age of 14, Alexander got to know software engineering during his studies and decided web applications are more interesting than system administration. If not doing something hacky, he enjoys playing a good game of basketball or streetball. Sometimes he even twitters at http://twitter.com/spinscale and can be reached anytime at alexander@reelsen.net
                  Sorry, we don't have any reviews for this title yet.

                  Code Downloads

                  Download the code and support files for this book.


                  Submit Errata

                  Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                  Errata

                  - 12 submitted: last submission 06 Mar 2013

                  Errata type: Others | Page number: 149 | Errata date: 25 Aug 11

                  This URL has been hacked and readers are requested not to click on it: http://mavensearch.net/

                   

                  Errata type: Typo | Page number: 33

                  The line:
                  public InputStreamdoJobWithResult() {
                  should be:
                  public InputStream doJobWithResult() {

                   

                  Errata type: Typo | Page number: 52

                  The code:
                  public booleanisValid() {
                  public booleanisAuthorized() {
                  public static booleanisAuthorized(Http.Request request) {
                  should be:
                  public boolean isValid() {
                  public boolean isAuthorized() {
                  public static boolean isAuthorized(Http.Request request) {

                   

                  Errata type: Typo | Page number: 56

                  The line:
                  private VirtualFiletemplateFile;
                  should be:
                  private VirtualFile templateFile;

                   

                  Errata type: Typo | Page number: 58

                  The line:
                  private VirtualFilegetTemplateFile(Object ... args) {
                  should be:
                  private VirtualFile getTemplateFile(Object ... args) {

                   

                  Errata type: Typo | Page number: 75

                  private SyndFeedgetFeed(Response response) throws Exception {
                  should be:
                  private SyndFeed getFeed(Response response) throws Exception {

                   

                  Errata type: Typo | Page number: 79

                  The line:
                  private SyndEntrycreateEntry (String title, String link, String
                  should be:
                  private SyndEntry createEntry (String title, String link, String

                   

                  Errata type: Typo | Page number: 101

                  The line:
                  GridFSfs = getGridFS();
                  should be:
                  GridFS fs = getGridFS();

                   

                  Errata type: Others | Page number: 37 and 82

                  Wrong cross ref to "Basics of caching" which is in chapter 2.

                   

                  Errata type: Typo | Page number: 46

                  Wrong HTTP response code:
                  302 Not Modified
                  Should be:
                  304 Not-Modified

                   

                  Errata type: Typo | Page number: 20

                  <h1>${user.login}</}</}</h1>
                  Send <a href="mailto:${user.email}">}">}">mail</a>
                  Should be:
                  <h1>${user.login}</h1>
                  Send <a href="mailto:${user.email}">mail</a>

                   

                  Errata type: Typo | Page number: 108 and 116

                  The line:
                  #{settitle:'Home' /}
                  Should be:
                  #{set title:'Home' /}

                   

                  Sample chapters

                  You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                  Frequently bought together

                  Play Framework Cookbook +    Akka Essentials =
                  50% Off
                  the second eBook
                  Price for both: €30.90

                  Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                  What you will learn from this book

                  • 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.

                  Approach

                  This book is in Packt’s Cookbook series. A Packt Cookbook contains recipes for solutions to the most important problems you face when working with a topic.

                  Inside the Cookbook you will find:

                  • A straightforward and easy to follow format
                  • A selection of the most important tasks and problems
                  • Carefully organized instructions for solving the problem efficiently
                  • Clear explanations of what you did
                  • Details for applying the solution to other situations

                  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

                  Code Download and Errata
                  Packt Anytime, Anywhere
                  Register Books
                  Print Upgrades
                  eBook Downloads
                  Video Support
                  Contact Us
                  Awards Voting Nominations Previous Winners
                  Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                  Resources
                  Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software