Home Page Icon
Home Page
Table of Contents for
What you need for this book
Close
What you need for this book
by Alexander Reelsen
Play Framework Cookbook
Play Framework Cookbook
Table of Contents
Play Framework Cookbook
Credits
Foreword
Why Play is a small revolution in the Java world
Prerequisites
What is missing: A Scala chapter
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Basics of the Play Framework
Introduction
Downloading and installing the Play framework
Getting ready
How to do it...
How it works...
Creating a new application
How to do it...
How it works...
There's more...
Support for various IDEs
Defining routes as the entry point to your application
Getting ready
How to do it...
How it works...
There's more...
See also
Configuring your application via application.conf
How to do it...
How it works...
See also
Defining your own controllers
Getting ready
How to do it...
How it works...
There's more...
Using POJOs for HTTP mapping
Using HTTP redirects
Thread safety
See also
Defining your own models
Getting ready
How to do it...
How it works...
There's more...
Using finders
Never be anemic
Learning from the existing examples
Regarding JPA and transactions
See also
Using fixtures to provide initial data
How to do it...
How it works...
There's more...
Using a bootstrap job to load seed data
More information about YAML
Using lists in YAML
Defining your own views
How to do it...
How it works...
There's more...
Check out more possible template tags
Check out more predefined variables
Supporting multiple formats
See also
Writing your own tags
Getting ready
How to do it...
How it works...
There's more...
Using parameters and more inside tags
Higher rendering performance by using FastTags
See also
Using Java Extensions to format data in your views
Getting ready
How to do it...
How it works...
There's more...
Using parameters in extensions
Check for more built in Java Extensions
Check for internationalization on plurals
Adding modules to extend your application
Getting ready
How to do it...
How it works...
There's more...
Module documentation
Updating modules
More on the search module
See also
Using Oracle or other databases with Play
How to do it...
How it works...
There's more...
Using application server datasources
Using connection pools
Configuring your JPA dialect
Understanding suspendable requests
Getting ready
How to do it...
How it works...
There's more...
More about promises
More about jobs
More information about execution times
See also
Understanding session management
How to do it...
How it works...
There's more...
Configuring different cache types
Using the cache to offload database load
See also
2. Using Controllers
Introduction
URL routing using annotation-based configuration
How to do it...
How it works...
There's more...
Mixing the configuration file and annotations is possible
Basics of caching
Getting ready
How to do it...
How it works...
There's more...
More information in the ActionInvoker
Be thoughtful with ETag calculation
Use a plugin instead of a job
See also
Using HTTP digest authentication
Getting ready
How to do it...
How it works...
There's more...
Get more info about HTTP digest authentication
See also
Generating PDFs in your controllers
Getting ready
How to do it...
How it works...
There's more...
More about Apache FOP
Using other solutions to create PDFs
See also
Binding objects using custom binders
How to do it...
How it works...
There's more...
Using type binders on objects
Be careful with JPA using model classes
Validating objects using annotations
Getting ready
How to do it...
How it works...
There's more...
Using the configure() method for setup
Annotations can be used in models as well
Adding annotation-based right checks to your controller
Getting ready
How to do it...
How it works...
There's more...
Be flexible with roles instead of rights
More speed with caching
Increased complexity with context-sensitive rights
Check out the deadbolt module
Rendering JSON output
Getting ready
How to do it...
How it works...
There's more...
More about Google gson
Alternatives to Google gson
Writing your own renderRSS method as controller output
Getting ready
How to do it...
How it works...
There's more...
Using annotations to make your code more generic
Using ROME modules
Cache at the right place
3. Leveraging Modules
Introduction
Dependency injection with Spring
Getting ready
How to do it...
How it works...
There's more...
Use the component scanning feature
Have Spring configurations per ID
Direct access to the application context
See also
Dependency injection with Guice
Getting ready
How to do it...
How it works...
There's more...
Default @Inject support of play
Creating own injectors
Using the security module
Getting ready
How to do it...
How it works...
There's more...
Declare only one security class
Implementing rights per controller with the secure module
Adding security to the CRUD module
Getting ready
How to do it...
How it works...
There's more...
Changing the design of the CRUD user interface
Checking out the scaffold module
Using the MongoDB module
Getting ready
How to do it...
How it works...
There's more...
Check out the Yabe example in the Morphia directory
Use long based data types as unique IDs
Aggregation and grouping via map reduce
Using MongoDB/GridFS to deliver files
Getting ready
How to do it...
How it works...
There's more...
Using MongoDB's REST API
Resizing images on the fly
4. Creating and Using APIs
Introduction
Using Google Chart API as a tag
How to do it...
How it works...
There's more...
Getting request data inside a fast tag
The Google Chart API
Make a graceful and more performant implementation
Considering privacy when transmitting data
Including a Twitter search in your application
Getting ready
How to do it...
How it works...
There's more...
Make it a client side API
Add caching to your code late
Be fast with asynchronous queries
Managing different output formats
Getting ready
How to do it...
How it works...
There's more...
Integrating arbitrary formats
Getting out AMF formats
See also
Binding JSON and XML to objects
Getting ready
How to do it...
How it works...
There's more...
Add the XML annotations via byte code enhancement
Put plugins where they belong
Change your render methods to use JAXB for rendering
See also
5. Introduction to Writing Modules
Introduction
Creating and using your own module
How to do it...
How it works...
There's more...
Cleaning up after creating your module
Supporting Eclipse IDE
Building a flexible registration module
Getting ready
How to do it...
How it works...
There's more...
Think about when to write a module
Understanding events
How to do it...
How it works...
There's more...
Think about multi-node environments
Managing module dependencies
Getting ready
How to do it...
How it works...
There's more...
Learn more about dependency management with play
Search for jar files in Maven repositories
See also
Using the same model for different applications
How to do it...
How it works...
There's more...
Learn more about bytecode enhancers
Check the modules for even more enhancers
See also
Understanding bytecode enhancement
Getting ready
How to do it...
How it works...
There's more...
Overriding toString() via annotation
See also
Adding private module repositories
Getting ready
How to do it...
How it works...
There's more...
Check the official documentation
Repositories with older versions
Preprocessing content by integrating stylus
Getting ready
How to do it...
How it works...
There's more...
More information about CSS preprocessing
Integrating Dojo by adding command line options
Getting ready
How to do it...
How it works...
There's more...
More about Dojo
Create operating system independent modules
More ideas for command support
6. Practical Module Examples
Introduction
Adding annotations via bytecode enhancement
Getting ready
How to do it...
How it works...
There's more...
Javassist documentation
Implementing your own persistence layer
Getting ready
How to do it...
How it works...
There's more...
Check the JPA and Morphia plugins
Integrating with messaging queues
Getting ready
How to do it...
How it works...
There's more...
More info about AMQP
Using Solr for indexing
Getting ready
How to do it...
How it works...
There's more...
More information about SolrJ
More complex queries
Support for other search engines
Writing your own cache implementation
Getting ready
How to do it...
How it works...
There's more...
More about Hazelcast
Try building a Redis cache
7. Running in Production
Introduction
Test automation with Jenkins
Getting ready
How to do it...
How it works...
There's more...
Other plugins might be useful
Check out the new play Jenkins plugin
Test automation with Calimoucho
Getting ready
How to do it...
How it works...
There's more...
Using git with Calimoucho
Using mercurial with Calimoucho
Using subversion with Calimoucho
Creating a distributed configuration service
Getting ready
How to do it...
How it works...
There's more...
More on memcached
See also
Running jobs in a distributed environment
Getting ready
How to do it...
How it works...
There's more...
Solving the locking problem
Changing cache clear times
Running one Play instance for several hosts
How to do it...
How it works...
There's more...
Implementing multi tenant applications using hibernate
A virtual hosting module
Using properties to be more flexible
Forcing SSL for chosen controllers
Getting ready
How to do it...
How it works...
Implementing own monitoring points
Getting ready
How to do it...
How it works...
There's more...
More about JAMon
See also
Configuring log4j for log rotation
How to do it...
How it works...
There's more...
More about log4j
Default log levels of others frameworks
Integrating with Icinga
Getting ready
How to do it...
How it works...
There's more...
Find out more about Icinga
See also
Integrating with Munin
Getting ready
How to do it...
How it works...
There's more...
Find out more about Munin and its plugins
Add and graph hit counts, tag runtimes, running jobs, and so on
Setting up the Apache web server with Play
Getting ready
How to do it...
How it works...
There's more...
Transparent upgrade of your application
Setting up the Nginx web server with Play
Getting ready
How to do it...
How it works...
There's more...
More information about Nginx
Better load balancing
Transparent upgrade of your application
Setting up the Lighttpd web server with Play
Getting ready
How to do it...
How it works...
There's more...
Learn more about lighttpd
Multi-node deployment introduction
How to do it...
How it works...
There's more...
Add centralized logging to your multi node installation
Distributing configuration files in a different way
A. Further Information About the Play Framework
Further information
Links
Twitter
Index
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Preface
Next
Next Chapter
Who this book is for
What you need for this book
Everything you need is listed in each recipe.
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset