diff --git a/.mergify.yml b/.mergify.yml index ad0e97071..8a4a26800 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -12,21 +12,16 @@ pull_request_rules: method: merge strict: smart - - name: Merge TemplateControl's PRs that are ready - conditions: - - status-success=Travis CI - Pull Request - - "#review-requested=0" - - "#changes-requested-reviews-by=0" - - label!=status:block-merge - - label=status:merge-when-green - - label!=status:block-merge - actions: - merge: - method: merge - strict: smart - - name: Delete the PR branch after merge conditions: - merged actions: delete_head_branch: {} + + - name: auto add wip + conditions: + # match a few flavours of wip + - title~=^(\[wip\]( |:) |\[WIP\]( |:) |wip( |:) |WIP( |:)).* + actions: + label: + add: ["status:block-merge"] diff --git a/README.md b/README.md index dc10c6004..e4c7f7836 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # Play samples +[![Build Status](https://travis-ci.com/playframework/play-samples.svg?branch=2.8.x)](https://travis-ci.com/playframework/play-samples) +[![GitHub issues](https://img.shields.io/github/issues/playframework/play-samples.svg?style=flat)](https://github.com/playframework/play-samples/issues) +[![GitHub forks](https://img.shields.io/github/forks/playframework/play-samples.svg?style=flat)](https://github.com/playframework/play-samples/network) +[![GitHub stars](https://img.shields.io/github/stars/playframework/play-samples.svg?style=flat)](https://github.com/playframework/play-samples/stargazers) + #### License diff --git a/play-java-chatroom-example/README.md b/play-java-chatroom-example/README.md index f0422191b..c34197da6 100644 --- a/play-java-chatroom-example/README.md +++ b/play-java-chatroom-example/README.md @@ -1,7 +1,5 @@ # play-java-chatroom-example -[](https://travis-ci.org/playframework/play-java-chatroom-example) - This is a simple chatroom using Play and Websockets with the Java API. This project makes use of [dynamic streams](http://doc.akka.io/docs/akka/current/java/stream/stream-dynamic.html) from Akka Streams, notably `BroadcastHub` and `MergeHub`. By [combining MergeHub and BroadcastHub](http://doc.akka.io/docs/akka/current/java/stream/stream-dynamic.html#Dynamic_fan-in_and_fan-out_with_MergeHub_and_BroadcastHub), you can get publish/subscribe functionality. diff --git a/play-java-chatroom-example/build.sbt b/play-java-chatroom-example/build.sbt index 68358c920..fd7d1ab4c 100644 --- a/play-java-chatroom-example/build.sbt +++ b/play-java-chatroom-example/build.sbt @@ -1,6 +1,6 @@ name := """play-java-chatroom-example""" -version := "2.6.x" +version := "2.8.x" scalaVersion := "2.12.8" diff --git a/play-java-chatroom-example/conf/application.conf b/play-java-chatroom-example/conf/application.conf index b38a8c0dd..77dbed16e 100644 --- a/play-java-chatroom-example/conf/application.conf +++ b/play-java-chatroom-example/conf/application.conf @@ -5,11 +5,11 @@ akka { logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" } -// https://www.playframework.com/documentation/2.6.x/SecurityHeaders +// https://www.playframework.com/documentation/2.8.x/SecurityHeaders // Disable the out of the box content security policy in SecurityHeadersFilter play.filters.headers.contentSecurityPolicy = null -// https://www.playframework.com/documentation/2.6.x/AllowedHostsFilter +// https://www.playframework.com/documentation/2.8.x/AllowedHostsFilter play.filters.hosts.allowed = ["localhost:9000", "localhost:19001"] // Add CSP header in explicitly in a custom filter. diff --git a/play-java-compile-di-example/README.md b/play-java-compile-di-example/README.md index 29040ba1c..e75ef3c7a 100644 --- a/play-java-compile-di-example/README.md +++ b/play-java-compile-di-example/README.md @@ -1,12 +1,11 @@ # play-java-compile-di-example -[](https://travis-ci.org/playframework/play-java-compile-di-example) - This is a Play project using the Java API and compile time dependency injection. It is intentionally very simple and basic to show how compile time DI works in Play with the Java API. -There is also an [example](https://github.com/playframework/play-java-dagger2-example) using Java compile time DI with [Dagger 2](https://google.github.io/dagger/). +There is also an example using Java compile time DI with [Dagger 2](https://google.github.io/dagger/): +the "play-java-dagger2-example" in the [play-samples](https://github.com/playframework/play-samples) repo. ## Running diff --git a/play-java-dagger2-example/README.md b/play-java-dagger2-example/README.md index 621371973..d32b1cc21 100644 --- a/play-java-dagger2-example/README.md +++ b/play-java-dagger2-example/README.md @@ -1,5 +1,3 @@ -[](https://travis-ci.org/playframework/play-java-dagger2-example) - # play-java-dagger2-example This project shows how to use Play Java with [Dagger 2](https://google.github.io/dagger/). @@ -18,7 +16,7 @@ Go to http://localhost:9000/ws to see the WS client pull the time from a remote [Dagger 2](https://google.github.io/dagger/) is a compile time dependency injection system. This means that [dependencies are still declared](https://google.github.io/dagger/users-guide.html#declaring-dependencies) with `@Inject`, but the compiler is responsible for resolving the graph. -Play Java supports [Compile Time Dependency Injection](https://www.playframework.com/documentation/2.6.x/JavaCompileTimeDependencyInjection) so the work here is to provide an application loader that hooks into Dagger, rather than using constructor based DI. +Play Java supports [Compile Time Dependency Injection](https://www.playframework.com/documentation/2.8.x/JavaCompileTimeDependencyInjection) so the work here is to provide an application loader that hooks into Dagger, rather than using constructor based DI. The `dagger.MyApplicationLoader` class provides the core, by calling out to the `DaggerApplicationComponent`: @@ -87,4 +85,4 @@ public class MyComponentsFromContext { return simpleInjector; } } -``` \ No newline at end of file +``` diff --git a/play-java-ebean-example/README.md b/play-java-ebean-example/README.md index 97ff8d422..757041558 100644 --- a/play-java-ebean-example/README.md +++ b/play-java-ebean-example/README.md @@ -1,12 +1,10 @@ -[](https://travis-ci.org/playframework/play-java-ebean-example) - # play-java-ebean-example This is an example Play application that uses Java, and communicates with an in memory database using EBean. -The Github location for this project is: +The GitHub location for this project is inside: -[https://github.com/playframework/play-java-ebean-example](https://github.com/playframework/play-java-ebean-example) + ## Play diff --git a/play-java-fileupload-example/README.md b/play-java-fileupload-example/README.md index 71909a34a..a421fc397 100644 --- a/play-java-fileupload-example/README.md +++ b/play-java-fileupload-example/README.md @@ -1,7 +1,5 @@ # Play File Upload using a custom BodyParser -[![Build Status](https://travis-ci.org/playframework/play-java-fileupload-example.svg?branch=2.6.x)](https://travis-ci.org/playframework/play-java-fileupload-example) - This is a sample project that shows how to upload a file through Akka Streams using a custom BodyParser using Akka Streams using the Java API. ## Default MultipartFormData Body Parser diff --git a/play-java-fileupload-example/conf/application.conf b/play-java-fileupload-example/conf/application.conf index b0023095d..2f4ee16b7 100644 --- a/play-java-fileupload-example/conf/application.conf +++ b/play-java-fileupload-example/conf/application.conf @@ -1,5 +1,5 @@ # https://www.playframework.com/documentation/latest/Configuration # Sets the maximum file size that can be uploaded to 1024k. -# https://www.playframework.com/documentation/2.6.x/JavaBodyParsers#Content-length-limits +# https://www.playframework.com/documentation/2.8.x/JavaBodyParsers#Content-length-limits play.http.parser.maxMemoryBuffer=1024k diff --git a/play-java-forms-example/README.md b/play-java-forms-example/README.md index 1f09a4290..c9c57dcae 100644 --- a/play-java-forms-example/README.md +++ b/play-java-forms-example/README.md @@ -1,7 +1,5 @@ # play-java-forms-example -[](https://travis-ci.org/playframework/play-java-forms-example) - This example shows form processing and form helper handling in Play. ## How to run @@ -16,4 +14,4 @@ And open ## Documentation -Please see . \ No newline at end of file +Please see . diff --git a/play-java-forms-example/build.sbt b/play-java-forms-example/build.sbt index fb90df005..68d824711 100644 --- a/play-java-forms-example/build.sbt +++ b/play-java-forms-example/build.sbt @@ -1,6 +1,6 @@ name := """play-java-forms-example""" -version := "2.7.x" +version := "2.8.x" lazy val root = (project in file(".")).enablePlugins(PlayJava) diff --git a/play-java-hello-world-tutorial/app/views/tutorial.scala.html b/play-java-hello-world-tutorial/app/views/tutorial.scala.html index 4bfcc291f..5f09b4a54 100644 --- a/play-java-hello-world-tutorial/app/views/tutorial.scala.html +++ b/play-java-hello-world-tutorial/app/views/tutorial.scala.html @@ -66,7 +66,7 @@

Define a route

A route tells Play how to handle incoming requests and includes the request path, an HTTP method, and the controller action to invoke. When you add a route to the routes file, Play's routes compiler will automatically generate a router class that calls that action using an instance of that - controller. For more information see HTTP Routing. By default, the controller instances are created using dependency injection. See Dependency Injection for more information.

diff --git a/play-java-jpa-example/README.md b/play-java-jpa-example/README.md index 11e2a4b25..52eb22d00 100644 --- a/play-java-jpa-example/README.md +++ b/play-java-jpa-example/README.md @@ -1,5 +1,3 @@ -[](https://travis-ci.org/playframework/play-java-jpa-example) - # play-java-jpa-example This project demonstrates how to create a simple database application with Play, using JPA. diff --git a/play-java-rest-api-example/README.md b/play-java-rest-api-example/README.md index 3e6335b6b..b4f97d975 100644 --- a/play-java-rest-api-example/README.md +++ b/play-java-rest-api-example/README.md @@ -1,12 +1,10 @@ # play-java-rest-api-example -[](https://travis-ci.org/playframework/play-java-rest-api-example) - A REST API showing Play with a JPA backend. For the Scala version, please see . ## Best Practices for Blocking API -If you look at the controller: +If you look at the controller: [PostController](app/v1/post/PostController.java) then you can see that when calling out to a blocking API like JDBC, you should put it behind an asynchronous boundary -- in practice, this means using the CompletionStage API to make sure that you're not blocking the rendering thread while the database call is going on in the background. ```java diff --git a/play-java-rest-api-example/build.sbt b/play-java-rest-api-example/build.sbt index 2e6582aa9..1e48b2536 100644 --- a/play-java-rest-api-example/build.sbt +++ b/play-java-rest-api-example/build.sbt @@ -1,6 +1,6 @@ name := """play-java-rest-api-example""" -version := "2.7.x" +version := "2.8.x" val gatlingVersion = "2.3.1" diff --git a/play-java-starter-example/README.md b/play-java-starter-example/README.md index ec48e530f..6f05f5125 100644 --- a/play-java-starter-example/README.md +++ b/play-java-starter-example/README.md @@ -1,5 +1,3 @@ -[](https://travis-ci.org/playframework/play-java-starter-example) - # play-java-starter-example This is a starter application that shows how Play works. Please see the documentation at https://www.playframework.com/documentation/latest/Home for more details. diff --git a/play-java-streaming-example/README.md b/play-java-streaming-example/README.md index 11758d4a3..d88233c58 100644 --- a/play-java-streaming-example/README.md +++ b/play-java-streaming-example/README.md @@ -1,7 +1,5 @@ # play-java-streaming-example -[](https://travis-ci.org/playframework/play-java-streaming-example) - This is an example Play template that demonstrates Streaming with Server Sent Events or Comet, using Akka Streams. Please see the documentation at: diff --git a/play-java-websocket-example/README.md b/play-java-websocket-example/README.md index 614de6b1d..1a1e7d753 100644 --- a/play-java-websocket-example/README.md +++ b/play-java-websocket-example/README.md @@ -1,7 +1,5 @@ # play-websocket-java-example -[![Build Status](https://travis-ci.org/playframework/play-java-websocket-example.svg?branch=2.6.x)](https://travis-ci.org/playframework/play-java-websocket-example) [![GitHub issues](https://img.shields.io/github/issues/playframework/play-websocket-java.svg?style=flat)](https://github.com/playframework/play-websocket-java/issues) [![GitHub forks](https://img.shields.io/github/forks/playframework/play-websocket-java.svg?style=flat)](https://github.com/playframework/play-websocket-java/network) [![GitHub stars](https://img.shields.io/github/stars/playframework/play-websocket-java.svg?style=flat)](https://github.com/playframework/play-websocket-java/stargazers) - This is an example Play application that shows how to use Play's Websocket API in Java, by showing a series of stock tickers updated using WebSocket. The Websocket API is built on Akka Streams, and so is async, non-blocking, and backpressure aware. Using Akka Streams also means that interacting with Akka Actors is simple. diff --git a/play-scala-anorm-example/README.md b/play-scala-anorm-example/README.md index af29b6c71..8a631fb82 100644 --- a/play-scala-anorm-example/README.md +++ b/play-scala-anorm-example/README.md @@ -1,7 +1,5 @@ # play-scala-anorm-example -[](https://travis-ci.org/playframework/play-scala-anorm-example) - This is an example Play application that uses Scala on the front end, and communicates with an in memory database using Anorm. ## Play diff --git a/play-scala-anorm-example/build.sbt b/play-scala-anorm-example/build.sbt index b43c79e3b..dffb95b52 100644 --- a/play-scala-anorm-example/build.sbt +++ b/play-scala-anorm-example/build.sbt @@ -1,6 +1,6 @@ name := "play-scala-anorm-example" -version := "2.6.0-SNAPSHOT" +version := "2.8.x" scalaVersion := "2.12.8" diff --git a/play-scala-chatroom-example/README.md b/play-scala-chatroom-example/README.md index b848044a1..462fc5c56 100644 --- a/play-scala-chatroom-example/README.md +++ b/play-scala-chatroom-example/README.md @@ -1,7 +1,5 @@ # play-scala-chatroom-example -[](https://travis-ci.org/playframework/play-scala-chatroom-example) - This is a simple chatroom using Play and Websockets with the Scala API. This project makes use of [dynamic streams](http://doc.akka.io/docs/akka/current/scala/stream/stream-dynamic.html) from Akka Streams, notably `BroadcastHub` and `MergeHub`. By [combining MergeHub and BroadcastHub](http://doc.akka.io/docs/akka/current/scala/stream/stream-dynamic.html#Dynamic_fan-in_and_fan-out_with_MergeHub_and_BroadcastHub), you can get publish/subscribe functionality. diff --git a/play-scala-chatroom-example/build.sbt b/play-scala-chatroom-example/build.sbt index 00bd15903..10479de12 100644 --- a/play-scala-chatroom-example/build.sbt +++ b/play-scala-chatroom-example/build.sbt @@ -4,7 +4,7 @@ lazy val root = (project in file(".")).enablePlugins(PlayScala) name := """play-chatroom-scala-example""" -version := "2.7.x" +version := "2.8.x" scalaVersion := "2.12.8" diff --git a/play-scala-chatroom-example/conf/application.conf b/play-scala-chatroom-example/conf/application.conf index abc7fbd2e..3041c7f3f 100644 --- a/play-scala-chatroom-example/conf/application.conf +++ b/play-scala-chatroom-example/conf/application.conf @@ -5,11 +5,11 @@ akka { logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" } -// https://www.playframework.com/documentation/2.6.x/SecurityHeaders +// https://www.playframework.com/documentation/2.8.x/SecurityHeaders // Disable the out of the box content security policy in SecurityHeadersFilter play.filters.headers.contentSecurityPolicy = null -// https://www.playframework.com/documentation/2.6.x/AllowedHostsFilter +// https://www.playframework.com/documentation/2.8.x/AllowedHostsFilter play.filters.hosts.allowed = ["localhost:9000", "localhost:19001"] // Add CSP header in explicitly in a custom filter. diff --git a/play-scala-compile-di-example/README.md b/play-scala-compile-di-example/README.md index a2e870f1c..71c402561 100644 --- a/play-scala-compile-di-example/README.md +++ b/play-scala-compile-di-example/README.md @@ -1,7 +1,5 @@ # play-scala-compile-di-example -[](https://travis-ci.org/playframework/play-scala-compile-di-example) - This is an example of Play using the Scala API with manually wired compile time dependency injection. The application loader here is `MyApplicationLoader` which uses `MyComponents` to wire together an injector. diff --git a/play-scala-fileupload-example/conf/application.conf b/play-scala-fileupload-example/conf/application.conf index 2a19bd837..c70be3a61 100644 --- a/play-scala-fileupload-example/conf/application.conf +++ b/play-scala-fileupload-example/conf/application.conf @@ -1,9 +1,9 @@ # https://www.playframework.com/documentation/latest/Configuration # Sets the maximum file size that can be uploaded to 1024k. -# https://www.playframework.com/documentation/2.6.x/ScalaBodyParsers#Max-content-length +# https://www.playframework.com/documentation/2.8.x/ScalaBodyParsers#Max-content-length play.http.parser.maxMemoryBuffer=1024k # For upload large file -# https://www.playframework.com/documentation/2.6.x/ScalaBodyParsers#Max-content-length +# https://www.playframework.com/documentation/2.8.x/ScalaBodyParsers#Max-content-length play.http.parser.maxDiskBuffer=1g diff --git a/play-scala-forms-example/README.md b/play-scala-forms-example/README.md index 3a911ec29..7a5568700 100644 --- a/play-scala-forms-example/README.md +++ b/play-scala-forms-example/README.md @@ -1,8 +1,6 @@ # play-scala-forms-example -[![Build Status](https://travis-ci.org/playframework/play-scala-forms-example.svg?branch=2.6.x)](https://travis-ci.org/playframework/play-scala-forms-example) - -This example shows form processing and form helper handling under Play 2.6.x. +This example shows form processing and form helper handling under Play 2.8.x. ## How to run diff --git a/play-scala-forms-example/app/controllers/WidgetController.scala b/play-scala-forms-example/app/controllers/WidgetController.scala index dbab2cb57..11221f041 100644 --- a/play-scala-forms-example/app/controllers/WidgetController.scala +++ b/play-scala-forms-example/app/controllers/WidgetController.scala @@ -14,7 +14,7 @@ import play.api.mvc._ * which provides implicits that create a Messages instance from a request * using implicit conversion. * - * See https://www.playframework.com/documentation/2.6.x/ScalaForms#passing-messagesprovider-to-form-helpers + * See https://www.playframework.com/documentation/2.8.x/ScalaForms#passing-messagesprovider-to-form-helpers * for details. */ class WidgetController @Inject()(cc: MessagesControllerComponents) extends MessagesAbstractController(cc) { diff --git a/play-scala-forms-example/build.sbt b/play-scala-forms-example/build.sbt index 2ee2b24c1..a745ba37a 100644 --- a/play-scala-forms-example/build.sbt +++ b/play-scala-forms-example/build.sbt @@ -1,6 +1,6 @@ name := """play-scala-forms-example""" -version := "2.7.x" +version := "2.8.x" scalaVersion := "2.12.8" diff --git a/play-scala-forms-example/test/functional/FunctionalSpec.scala b/play-scala-forms-example/test/functional/FunctionalSpec.scala index 770585628..c57d59c5e 100644 --- a/play-scala-forms-example/test/functional/FunctionalSpec.scala +++ b/play-scala-forms-example/test/functional/FunctionalSpec.scala @@ -16,12 +16,12 @@ import scala.concurrent.Future * * This is good for testing filter functionality, such as CSRF token and template checks. * - * See https://www.playframework.com/documentation/2.6.x/ScalaFunctionalTestingWithScalaTest for more details. + * See https://www.playframework.com/documentation/2.8.x/ScalaFunctionalTestingWithScalaTest for more details. */ class FunctionalSpec extends PlaySpec with GuiceOneAppPerSuite with Injecting with ScalaFutures { // CSRF token helper adds "withCSRFToken" to FakeRequest: - // https://www.playframework.com/documentation/2.6.x/ScalaCsrf#Testing-CSRF + // https://www.playframework.com/documentation/2.8.x/ScalaCsrf#Testing-CSRF import CSRFTokenHelper._ "WidgetController" must { diff --git a/play-scala-hello-world-tutorial/app/views/tutorial.scala.html b/play-scala-hello-world-tutorial/app/views/tutorial.scala.html index 1e31f3adc..0e81c5315 100644 --- a/play-scala-hello-world-tutorial/app/views/tutorial.scala.html +++ b/play-scala-hello-world-tutorial/app/views/tutorial.scala.html @@ -65,7 +65,7 @@

Define a route

A route tells Play how to handle incoming requests and includes the request path, an HTTP method, and the controller action to invoke. When you add a route to the routes file, Play's routes compiler will automatically generate a router class that calls that action using an instance of that - controller. For more information see HTTP Routing. By default, the controller instances are created using dependency injection. See Dependency Injection for more information.

diff --git a/play-scala-isolated-slick-example/README.md b/play-scala-isolated-slick-example/README.md index b61f8dadd..da4b79550 100644 --- a/play-scala-isolated-slick-example/README.md +++ b/play-scala-isolated-slick-example/README.md @@ -1,7 +1,5 @@ # Play with Slick 3.1 -[![Build Status](https://travis-ci.org/playframework/play-scala-isolated-slick-example.svg?branch=2.6.x)](https://travis-ci.org/playframework/play-scala-isolated-slick-example) - This project shows Play working with Slick. This project is configured to keep all the modules self-contained. diff --git a/play-scala-log4j2-example/README.md b/play-scala-log4j2-example/README.md index b06e5ea16..40f90ff25 100644 --- a/play-scala-log4j2-example/README.md +++ b/play-scala-log4j2-example/README.md @@ -1,7 +1,5 @@ # Play using Log4j 2 -[![Build Status](https://travis-ci.org/playframework/play-scala-log4j2-example.svg?branch=2.7.x)](https://travis-ci.org/playframework/play-scala-log4j2-example) - This is an example project showing a sample Play application that use Log4J 2 instead of using Logback. Please see [Using a custom logging framework](https://www.playframework.com/documentation/latest/SettingsLogger#Using-a-Custom-Logging-Framework) in the Play documentation for more details. diff --git a/play-scala-macwire-di-example/README.md b/play-scala-macwire-di-example/README.md index 0d52307df..1a11f2afd 100644 --- a/play-scala-macwire-di-example/README.md +++ b/play-scala-macwire-di-example/README.md @@ -1,11 +1,9 @@ # play-scala-macwire-di-example -[](https://travis-ci.org/playframework/play-scala-macwire-di-example) - This is an example project for setting up Play with Macwire compile time dependency injection. For further details, please see: * * -* \ No newline at end of file +* diff --git a/play-scala-macwire-di-example/build.sbt b/play-scala-macwire-di-example/build.sbt index f68aeae19..684f84f57 100644 --- a/play-scala-macwire-di-example/build.sbt +++ b/play-scala-macwire-di-example/build.sbt @@ -1,6 +1,6 @@ name := """play-scala-macwire-di-example""" -version := "2.6.x" +version := "2.8.x" lazy val root = (project in file(".")).enablePlugins(PlayScala) diff --git a/play-scala-rest-api-example/README.md b/play-scala-rest-api-example/README.md index eeb23f188..db85966e5 100644 --- a/play-scala-rest-api-example/README.md +++ b/play-scala-rest-api-example/README.md @@ -1,7 +1,5 @@ # Play REST API -[![Build Status](https://travis-ci.org/playframework/play-scala-rest-api-example.svg?branch=2.6.x)](https://travis-ci.org/playframework/play-scala-rest-api-example) - This is the example project for [Making a REST API in Play](http://developer.lightbend.com/guides/play-rest-api/index.html). ## Appendix diff --git a/play-scala-rest-api-example/docs/src/main/paradox/appendix.md b/play-scala-rest-api-example/docs/src/main/paradox/appendix.md index 0a2e967b5..28f3a930e 100644 --- a/play-scala-rest-api-example/docs/src/main/paradox/appendix.md +++ b/play-scala-rest-api-example/docs/src/main/paradox/appendix.md @@ -11,7 +11,7 @@ You will need to have [git](https://git-scm.com/) installed. ## Downloading -You can clone the example project from Github: +You can clone the example project from GitHub: ```bash git clone https://github.com/playframework/play-scala-rest-api-example.git diff --git a/play-scala-rest-api-example/docs/src/main/paradox/index.md b/play-scala-rest-api-example/docs/src/main/paradox/index.md index 403973dba..d921ebf33 100644 --- a/play-scala-rest-api-example/docs/src/main/paradox/index.md +++ b/play-scala-rest-api-example/docs/src/main/paradox/index.md @@ -6,7 +6,7 @@ We’ll demonstrate with a "best practices" REST API. You can get source code f ## From Lightbend Tech Hub -Download a pre-packaged bundle with this link [https://example.lightbend.com/v1/download/play-scala-rest-api-example](https://example.lightbend.com/v1/download/play-scala-rest-api-example) +Download a pre-packaged bundle with this link: . **Linux/Mac:** @@ -25,14 +25,16 @@ cd play-scala-rest-api-example sbt.bat ``` -## [From Github](https://github.com/playframework/play-scala-rest-api-example/tree/2.6.x): +## [From GitHub](https://github.com/playframework/play-samples): ```bash -git clone https://github.com/playframework/play-scala-rest-api-example.git -git checkout 2.6.x +git clone https://github.com/playframework/play-samples.git +cd play-scala-rest-api-example ``` -This example is in Scala, but Play also has a [Java API](https://www.playframework.com/documentation/latest/JavaHome) which looks and acts just like the [Scala API](https://www.playframework.com/documentation/latest/ScalaHome), and has a corresponding [play-java-rest-api-example](https://github.com/playframework/play-java-rest-api-example) project. For instructions on running and using the project, please see the [[appendix]]. This project also comes with an integrated [Gatling](http://gatling.io/) load test -- again, instructions are in the appendix. +Make sure you're using the right Play version branch. + +This example is in Scala, but Play also has a [Java API](https://www.playframework.com/documentation/latest/JavaHome) which looks and acts just like the [Scala API](https://www.playframework.com/documentation/latest/ScalaHome), and has a corresponding play-java-rest-api-example project in the [play-samples](https://github.com/playframework/play-samples) repo. For instructions on running and using the project, please see the [[appendix]]. This project also comes with an integrated [Gatling](http://gatling.io/) load test -- again, instructions are in the appendix. Note that there’s more involved in a REST API -- monitoring, representation, and managing access to back end resources -- that we'll cover in subsequent posts. But first, let's address why Play is so effective as a REST API. @@ -52,11 +54,11 @@ Play provides an easy to use MVC paradigm, including hot-reloading without any J Play combines this with a **reactive programming API** that lets you write async, non-blocking code in a straightforward fashion without worrying about complex and confusing "callback hell." In both Java or Scala, Play works on the same principle: leverage the asynchronous computation API that the language provides to you. In Play, you work with [`java.util.concurrent.CompletionStage`](https://docs.oracle.com/javase/8/docs/technotes/guides/concurrency/changes8.html) or [`scala.concurrent.Future`](http://docs.scala-lang.org/overviews/core/futures.html) API directly, and Play passes that asynchronous computation back through the framework. -Finally, Play is modular and extensible. Play works with multiple runtime and compile time dependency injection frameworks like [Guice](https://www.playframework.com/documentation/latest/ScalaDependencyInjection), [Macwire](https://di-in-scala.github.io/), [Dagger](https://github.com/playframework/play-java-dagger2-example), and leverages DI principles to integrate authentication and authorization frameworks built on top of Play. +Finally, Play is modular and extensible. Play works with multiple runtime and compile time dependency injection frameworks like [Guice](https://www.playframework.com/documentation/latest/ScalaDependencyInjection), [Macwire](https://di-in-scala.github.io/), [Dagger](https://google.github.io/dagger/), and leverages DI principles to integrate authentication and authorization frameworks built on top of Play. ## Community -To learn more about Play, check out the [Play tutorials](https://playframework.com/documentation/latest/Tutorials) and see more examples and blog posts about Play, including streaming [Server Side Events](https://github.com/playframework/play-streaming-scala) and first class [WebSocket support](https://github.com/playframework/play-websocket-scala). +To learn more about Play, check out the [Play tutorials](https://playframework.com/documentation/latest/Tutorials) and see more examples and blog posts about Play, including streaming server-side events ("play-scala-streaming-example") and first class WebSocket support ("play-scala-websocket-example") in the [Play Samples](https://github.com/playframework/play-samples). To get more involved and if you have questions, join the [forums](https://discuss.playframework.com) at and follow [PlayFramework on Twitter](https://twitter.com/playframework). diff --git a/play-scala-rest-api-example/docs/src/main/paradox/part-1/index.md b/play-scala-rest-api-example/docs/src/main/paradox/part-1/index.md index 99af52a51..c50bbbe58 100644 --- a/play-scala-rest-api-example/docs/src/main/paradox/part-1/index.md +++ b/play-scala-rest-api-example/docs/src/main/paradox/part-1/index.md @@ -2,12 +2,15 @@ This guide will walk you through how to make a REST API with JSON using [Play Framework](https://playframework.com). -To see the associated Github project, please go to or clone the project: +To see the associated GitHub project, please go to or clone the project: ```bash -git clone https://github.com/playframework/play-scala-rest-api-example.git +git clone https://github.com/playframework/play-samples.git +cd play-scala-rest-api-example ``` +Make sure you're using the right Play version branch. + We're going to be showing an already working Play project with most of the code available under the `app/v1` directory. There will be several different versions of the same project as this series expands, so you can compare different versions of the project against each other. To run Play on your own local computer, please see the instructions in the @ref[appendix](../appendix.md). @@ -20,7 +23,7 @@ We'll start off with a REST API that displays information for blog posts. Users The way to do this in REST is to model the represented state as a resource. A blog post resource will have a unique id, a URL hyperlink that indicates the canonical location of the resource, the title of the blog post, and the body of the blog post. -This resource is represented as a single case class in the Play application [here](https://github.com/playframework/play-scala-rest-api-example/blob/2.6.x/app/v1/post/PostResourceHandler.scala#L13): +This resource is represented as a single case class in the Play application: ```scala case class PostResource( @@ -45,13 +48,13 @@ GET / controllers.HomeController.index() This is useful for situations where a front end service is rendering HTML. However, Play also contains a more powerful routing DSL that we will use for the REST API. -For every HTTP request starting with `/v1/posts`, Play routes it to a dedicated `PostRouter` class to handle the Posts resource, through the [`conf/routes`](https://github.com/playframework/play-scala-rest-api-example/blob/2.6.x/conf/routes) file: +For every HTTP request starting with `/v1/posts`, Play routes it to a dedicated `PostRouter` class to handle the Posts resource, through the `conf/routes` file: ``` -> /v1/posts v1.post.PostRouter ``` -The `PostRouter` examines the URL and extracts data to pass along to the controller [here](https://github.com/playframework/play-scala-rest-api-example/blob/2.6.x/app/v1/post/PostRouter.scala): +The `PostRouter` examines the URL and extracts data to pass along to the controller: ```scala package v1.post @@ -101,7 +104,7 @@ SIRD is especially useful in a REST API where there can be many possible query p ## Using a Controller -The `PostRouter` has a `PostController` injected into it through standard [JSR-330 dependency injection](https://github.com/google/guice/wiki/JSR330) [here](https://github.com/playframework/play-scala-rest-api-example/blob/2.6.x/app/v1/post/PostRouter.scala#L12): +The `PostRouter` has a `PostController` injected into it through standard [JSR-330 dependency injection](https://github.com/google/guice/wiki/JSR330): ```scala class PostRouter @Inject()(controller: PostController) extends SimpleRouter @@ -143,7 +146,7 @@ In this example, `index1` and `asyncIndex` have exactly the same behavior. Inte However, if you're already working with `Future`, async makes it easier to pass that `Future` around. You can read more about this in the [handling asynchronous results](https://www.playframework.com/documentation/latest/ScalaAsync) section of the Play documentation. -The PostController methods dealing with GET requests is [here](https://github.com/playframework/play-scala-rest-api-example/blob/2.6.x/app/v1/post/PostController.scala). Let's take a look at the most important parts: +Let's take a look at the most important parts of the PostController: ```scala package v1.post @@ -244,7 +247,7 @@ private val form: Form[PostFormInput] = { } ``` -The form binds to the HTTP request using the names in the mapping -- `title` and `body` to the `PostFormInput` case class [here](https://github.com/playframework/play-scala-rest-api-example/blob/2.6.x/app/v1/post/PostController.scala#L12). +The form binds to the HTTP request using the names in the mapping -- `title` and `body` to the `PostFormInput` case class: ```scala case class PostFormInput(title: String, body: String) @@ -254,7 +257,7 @@ That's all you need to do to handle a basic web application! As with most thing ## Using Actions -We saw in the `PostController` that each method is connected to an Action through the `PostAction.async` method [here](https://github.com/playframework/play-scala-rest-api-example/blob/2.6.x/app/v1/post/PostController.scala#L33): +We saw in the `PostController` that each method is connected to an Action through the `PostAction.async` method: ```scala def index: Action[AnyContent] = PostAction.async { implicit request => @@ -265,7 +268,7 @@ def index: Action[AnyContent] = PostAction.async { implicit request => } ``` -The `PostAction.async` is a [custom action builder](https://www.playframework.com/documentation/2.6.x/ScalaActionsComposition#Custom-action-builders) defined [here](https://github.com/playframework/play-scala-rest-api-example/blob/2.6.x/app/v1/post/PostActionBuilder.scala#L49-L53) that can handle `PostRequest`s (see definition [here](https://github.com/playframework/play-scala-rest-api-example/blob/2.6.x/app/v1/post/PostActionBuilder.scala#L20)): +The `PostAction.async` is a [custom action builder](https://www.playframework.com/documentation/2.8.x/ScalaActionsComposition#Custom-action-builders) that can handle `PostRequest`s: `PostAction` is involved in each action in the controller -- it mediates the paperwork involved with processing a request into a response, adding context to the request and enriching the response with headers and cookies. ActionBuilders are essential for handling authentication, authorization and monitoring functionality. @@ -302,7 +305,7 @@ And `request.foo` will be added automatically. You can keep composing action builders inside each other, so you don't have to layer all the functionality in one single ActionBuilder, or you can create a custom `ActionBuilder` for each package you work with, according to your taste. For the purposes of this blog post, we'll keep everything together in a single class. -You can see `PostAction` builder [here](https://github.com/playframework/play-scala-rest-api-example/blob/2.6.x/app/v1/post/PostActionBuilder.scala#L49-L78): +You can see `PostAction` builder: ```scala trait PostRequestHeader extends MessagesRequestHeader with PreferredMessagesProvider @@ -358,7 +361,7 @@ The `PostResourceHandler` is responsible for converting backend data from a repo A REST resource has information that a backend repository does not -- it knows about the operations available on the resource, and contains URI information that a single backend may not have. As such, we want to be able to change the representation that we use internally without changing the resource that we expose publicly. -You can see the `PostResourceHandler` [here](https://github.com/playframework/play-scala-rest-api-example/blob/2.6.x/app/v1/post/PostResourceHandler.scala#L35-L66): +You can see the `PostResourceHandler`: ```scala class PostResourceHandler @Inject()( @@ -404,7 +407,7 @@ Here, it's a straight conversion in `createPostResource`, with the only hook bei Play handles the work of converting a `PostResource` through [Play JSON](https://www.playframework.com/documentation/latest/ScalaJson). Play JSON provides a DSL that looks up the conversion for the `PostResource` singleton object, so you don't need to declare it at the use point. -You can see the `PostResource` object [here](https://github.com/playframework/play-scala-rest-api-example/blob/2.6.x/app/v1/post/PostResourceHandler.scala#L15-L30): +You can see the `PostResource` object: ```scala object PostResource { diff --git a/play-scala-secure-session-example/README.md b/play-scala-secure-session-example/README.md index 9287342dd..e96349ece 100644 --- a/play-scala-secure-session-example/README.md +++ b/play-scala-secure-session-example/README.md @@ -1,7 +1,5 @@ # play-scala-secure-session-example -[![Build Status](https://travis-ci.org/playframework/play-scala-secure-session-example.svg?branch=2.6.x)](https://travis-ci.org/playframework/play-scala-secure-session-example) - This is an example application that shows how to do simple secure session management in Play, using the Scala API and session cookies. ## Overview diff --git a/play-scala-slick-example/README.md b/play-scala-slick-example/README.md index 5dd084313..c1d13a729 100644 --- a/play-scala-slick-example/README.md +++ b/play-scala-slick-example/README.md @@ -1,7 +1,5 @@ # play-scala-slick-example -[](https://travis-ci.org/playframework/play-scala-slick-example) - This project demonstrates how to create a simple CRUD application with [Play](https://www.playframework.com/) and [Slick](http://slick.lightbend.com/doc/3.1.1/) using [Play-Slick](https://www.playframework.com/documentation/latest/PlaySlick). To see an example of a Play application using Slick outside of the application lifecycle, please see: diff --git a/play-scala-slick-example/build.sbt b/play-scala-slick-example/build.sbt index baa615291..984932b25 100644 --- a/play-scala-slick-example/build.sbt +++ b/play-scala-slick-example/build.sbt @@ -1,6 +1,6 @@ name := """play-scala-slick-example""" -version := "2.7.x" +version := "2.8.x" lazy val root = (project in file(".")).enablePlugins(PlayScala) diff --git a/play-scala-starter-example/README.md b/play-scala-starter-example/README.md index 750fd9c48..6dda9e64f 100644 --- a/play-scala-starter-example/README.md +++ b/play-scala-starter-example/README.md @@ -1,7 +1,5 @@ # play-scala-starter-example -[](https://travis-ci.org/playframework/play-scala-starter-example) - This is a starter application that shows how Play works. Please see the documentation at for more details. ## Running diff --git a/play-scala-streaming-example/README.md b/play-scala-streaming-example/README.md index 921f2b10f..661a9c8c6 100644 --- a/play-scala-streaming-example/README.md +++ b/play-scala-streaming-example/README.md @@ -1,7 +1,5 @@ # play-streaming-scala -[![Build Status](https://travis-ci.org/playframework/play-scala-streaming-example.svg?branch=2.6.x)](https://travis-ci.org/playframework/play-scala-streaming-example) - This is an example Play template that demonstrates Streaming with Server Sent Events or Comet, using Akka Streams. Please see the documentation at: diff --git a/play-scala-streaming-example/build.sbt b/play-scala-streaming-example/build.sbt index f63a2e9a3..5c6b2bd82 100644 --- a/play-scala-streaming-example/build.sbt +++ b/play-scala-streaming-example/build.sbt @@ -1,6 +1,6 @@ name := "play-scala-streaming-example" -version := "2.6.x" +version := "2.8.x" scalaVersion := "2.12.8" diff --git a/play-scala-websocket-example/README.md b/play-scala-websocket-example/README.md index ab8be9d01..a4a75afeb 100644 --- a/play-scala-websocket-example/README.md +++ b/play-scala-websocket-example/README.md @@ -1,7 +1,5 @@ # play-scala-websocket-example -[](https://travis-ci.org/playframework/play-scala-websocket-example) - This is an example Play application that shows how to use Play's Websocket API in Scala, by showing a series of stock tickers updated using WebSocket. The Websocket API is built on Akka Streams, and so is async, non-blocking, and backpressure aware. Using Akka Streams also means that interacting with Akka Actors is simple. diff --git a/play-scala-websocket-example/app/stocks/Stock.scala b/play-scala-websocket-example/app/stocks/Stock.scala index b359509bc..d9d6f8b38 100644 --- a/play-scala-websocket-example/app/stocks/Stock.scala +++ b/play-scala-websocket-example/app/stocks/Stock.scala @@ -92,7 +92,7 @@ object StockPrice { } // Used for automatic JSON conversion -// https://www.playframework.com/documentation/2.6.x/ScalaJson +// https://www.playframework.com/documentation/2.8.x/ScalaJson // JSON presentation class for stock history case class StockHistory(symbol: StockSymbol, prices: Seq[StockPrice])