The Play Team is proud to announce the release of Play 2.7.0. This release adds many new features and continues our efforts to make Play more modular, flexible, and secure. Play 2.7.0 is the result of more than 1 year of relentless work from our fantastic community comprehending more than 720 changes made from almost 150 contributors.

What's new?

The highlights in Play 2.7.0 include:

gRPC support

gRPC is a transport mechanism for request/response and (non-persistent) streaming use cases. It is a schema-first RPC framework, where your protocol is declared in a protobuf service descriptor, and requests and responses will be streamed over an HTTP/2 connection. Play now offers play-grpc which is a module built on top of akka-grpc and gives you experimental support to declare your services in this format. See Akka gRPC's documentation on Why gRPC? for more information about when to use gRPC as your transport.

Akka Coordinated Shutdown

Play 2.6 introduced the usage of Akka's Coordinated Shutdown but still did not use it all across the core framework or expose it to the end user. Coordinated Shutdown is now used internally to handle Play's lifecycle.

The main advantage is that it gives you fine-grained phases where you can register tasks instead of just having a single phase like Play's application lifecycle. For example, you can add tasks to run before or after server binding, or after all the current requests finishes.

New cache implementation using Caffeine

Caffeine is a high performance, near optimal caching library based on Java 8. It is now the underlying cache library used by Play Cache APIs implementation since it is a much better option for a local cache than the version of EhCache we were using before.

Enhanced Content Security Policy support

There is a new Content Security Policy filter available that supports CSP nonce and hashes for embedded content. The previous setting of enabling CSP by default and setting it to default-src 'self' was too strict, and interfered with browser plugins.

The CSP filter uses Google's Strict CSP policy by default, which is a nonce based policy.

Direct access to request data without Http.Context

Historically, Play used play.mvc.Http.Context as a way to access request information and set some response data. It is a crucial part of Java HTTP & MVC APIs, but it is not a proper abstraction of how these APIs should work. You can now make your actions directly receive the request as a parameter, and consistent APIs were added to manipulate its data and the response.

See our detailed migration guide for examples showing how to migrate to the new APIs.

Play 2.7 brings a new version of most of its dependencies. The updates mainly include new features, security and overall fixes. See a list of the most important updates in our migration guide. Of course, we are also bringing the latest version of our own libraries such as Play JSON, Play-WS and Twirl.

Many improvements in Java Forms API

Java Forms APIs bring a good number of improvements like binding for file uploads, better support for advanced validation, and repeatable constraints.

New HTTP Error Handlers that are more suitable for REST APIs

Play 2.7 brings two new error handlers — one targeting REST APIs which will return errors formatted in JSON. The second one returns HTML or JSON errors based on the preferences specified in client’s Accept header, and it is a better option if your application uses a mixture of HTML and JSON, as is common in modern web apps.

As usual, you can see the more details of those new features in the release highlights and learn how to migrate in our migration guide. See the milestone for a more comprehensive list of changes.

How to start or migrate to Play 2.7

To get started with Play, follow the instructions in our Try Play page. And if you need to migrate from an older version to Play 2.7, see our migration guide.

Thanks to our contributors

Finally, many, many thanks to the community for their help with detailed bug reports, discussion about new features, and pull requests.

Thanks to Lightbend for their continued sponsorship of the Play core team's efforts. Lightbend offers commercial support for Play.

Special thanks to the following contributors who helped with this release: