├── .github
├── mergify.yml
├── dependabot.yml
└── renovate.json
├── play-java-chatroom-example
├── conf
│ ├── messages
│ ├── routes
│ └── application.conf
├── project
│ ├── build.properties
│ └── plugins.sbt
├── public
│ ├── images
│ │ └── favicon.png
│ └── stylesheets
│ │ └── main.css
├── NOTICE
└── app
│ └── filters
│ └── ContentSecurityPolicyFilter.java
├── play-scala-chatroom-example
├── conf
│ ├── messages
│ ├── routes
│ └── application.conf
├── project
│ ├── build.properties
│ └── plugins.sbt
├── public
│ ├── images
│ │ └── favicon.png
│ └── stylesheets
│ │ └── main.css
├── NOTICE
└── app
│ ├── controllers
│ ├── InputSanitizer.scala
│ └── RequestMarkerContext.scala
│ └── filters
│ └── ContentSecurityPolicyFilter.scala
├── play-scala-tls-example
├── .gitignore
├── scripts
│ ├── password
│ ├── client.p12
│ ├── clientca.p12
│ ├── exampleca.p12
│ ├── example.com.p12
│ ├── exampletrust.p12
│ ├── test-sbt
│ ├── gencerts.sh
│ ├── gentrustanchor.sh
│ ├── client.csr
│ ├── example.com.csr
│ ├── one.example.com.csr
│ ├── two.example.com.csr
│ ├── wildcard.example.com.csr
│ └── genca.sh
├── project
│ ├── build.properties
│ └── plugins.sbt
├── modules
│ ├── one
│ │ ├── project
│ │ │ └── build.properties
│ │ ├── conf
│ │ │ └── one.routes
│ │ └── app
│ │ │ ├── views
│ │ │ └── one
│ │ │ │ └── index.scala.html
│ │ │ └── controllers
│ │ │ └── HomeController.scala
│ └── two
│ │ ├── project
│ │ └── build.properties
│ │ ├── conf
│ │ └── two.routes
│ │ └── app
│ │ ├── views
│ │ └── two
│ │ │ └── index.scala.html
│ │ └── controllers
│ │ └── HomeController.scala
├── app
│ ├── views
│ │ └── index.scala.html
│ └── controllers
│ │ └── HomeController.scala
├── conf
│ ├── generated.keystore
│ ├── routes
│ ├── application.conf
│ └── ws.conf
└── NOTICE
├── play-java-dagger2-example
├── public
│ ├── stylesheets
│ │ └── main.css
│ ├── javascripts
│ │ └── main.js
│ └── images
│ │ └── favicon.png
├── project
│ ├── build.properties
│ └── plugins.sbt
├── conf
│ ├── application.conf
│ └── routes
├── app
│ ├── dagger
│ │ ├── ApplicationLoaderContextModule.java
│ │ ├── ClockModule.java
│ │ ├── ApplicationModule.java
│ │ └── ApplicationComponent.java
│ └── views
│ │ └── index.scala.html
└── NOTICE
├── play-java-forms-example
├── public
│ ├── javascripts
│ │ └── main.js
│ ├── stylesheets
│ │ └── main.css
│ └── images
│ │ └── favicon.png
├── project
│ ├── build.properties
│ └── plugins.sbt
├── .settings
│ └── org.eclipse.buildship.core.prefs
├── conf
│ ├── application.conf
│ └── routes
├── app
│ ├── views
│ │ ├── index.scala.html
│ │ └── main.scala.html
│ └── models
│ │ └── Widget.java
├── NOTICE
├── build.sbt
└── README.md
├── play-java-jpa-example
├── public
│ ├── stylesheets
│ │ └── main.css
│ └── images
│ │ └── favicon.png
├── project
│ ├── build.properties
│ └── plugins.sbt
├── app
│ ├── assets
│ │ └── javascripts
│ │ │ └── index.coffee
│ ├── views
│ │ ├── main.scala.html
│ │ └── index.scala.html
│ └── models
│ │ ├── PersonRepository.java
│ │ ├── DatabaseExecutionContext.java
│ │ └── Person.java
├── NOTICE
├── conf
│ ├── routes
│ └── META-INF
│ │ └── persistence.xml
├── test
│ └── AcceptanceTest.java
└── README.md
├── play-java-rest-api-example
├── public
│ ├── javascripts
│ │ └── main.js
│ ├── stylesheets
│ │ └── main.css
│ └── images
│ │ └── favicon.png
├── project
│ ├── build.properties
│ └── plugins.sbt
├── conf
│ ├── routes
│ ├── posts.routes
│ └── META-INF
│ │ └── persistence.xml
├── app
│ ├── views
│ │ └── timeout.scala.html
│ ├── controllers
│ │ └── HomeController.java
│ └── v1
│ │ └── post
│ │ ├── PostRepository.java
│ │ ├── PostExecutionContext.java
│ │ └── PostData.java
├── scripts
│ └── test-sbt
└── NOTICE
├── play-scala-forms-example
├── public
│ ├── stylesheets
│ │ └── main.css
│ ├── javascripts
│ │ └── hello.js
│ └── images
│ │ └── favicon.png
├── project
│ ├── build.properties
│ └── plugins.sbt
├── conf
│ ├── application.conf
│ ├── routes
│ └── logback.xml
├── app
│ ├── views
│ │ ├── index.scala.html
│ │ └── main.scala.html
│ └── models
│ │ └── Widget.scala
├── NOTICE
└── build.sbt
├── play-scala-log4j2-example
├── public
│ ├── stylesheets
│ │ └── main.css
│ ├── javascripts
│ │ └── hello.js
│ └── images
│ │ └── favicon.png
├── project
│ ├── build.properties
│ └── plugins.sbt
├── conf
│ ├── logger-configurator.properties
│ ├── log4j2.xml
│ └── routes
├── NOTICE
├── app
│ ├── views
│ │ └── index.scala.html
│ └── controllers
│ │ └── HomeController.scala
└── test
│ └── IntegrationSpec.scala
├── play-java-fileupload-example
├── public
│ ├── stylesheets
│ │ └── main.css
│ ├── javascripts
│ │ └── hello.js
│ └── images
│ │ └── favicon.png
├── conf
│ ├── messages.es
│ ├── messages
│ ├── application.conf
│ └── routes
├── project
│ ├── build.properties
│ └── plugins.sbt
├── NOTICE
├── app
│ ├── controllers
│ │ └── FormData.java
│ └── views
│ │ └── index.scala.html
└── build.sbt
├── play-java-hello-world-tutorial
├── public
│ ├── javascripts
│ │ └── main.js
│ └── images
│ │ ├── external.png
│ │ ├── favicon.png
│ │ ├── favicon0.png
│ │ ├── hello-one.png
│ │ ├── play-stack.png
│ │ ├── hello-custom.png
│ │ ├── header-pattern.png
│ │ ├── play-components.png
│ │ ├── request-response.png
│ │ ├── compilation-error.png
│ │ ├── play-request-response.png
│ │ └── play_icon_reverse.svg
├── project
│ ├── build.properties
│ └── plugins.sbt
├── .gitignore
├── conf
│ ├── application.conf
│ └── routes
├── gradle
│ ├── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ └── libs.versions.toml
├── .gitattributes
├── settings.gradle.kts
├── NOTICE
└── build.sbt
├── play-java-pekko-cluster-example
├── public
│ ├── javascripts
│ │ └── main.js
│ ├── stylesheets
│ │ └── main.css
│ └── images
│ │ └── favicon.png
├── project
│ ├── build.properties
│ └── plugins.sbt
├── .gitignore
├── conf
│ ├── local1.conf
│ ├── local2.conf
│ ├── local3.conf
│ ├── application.conf
│ ├── cluster.conf
│ ├── serialization.conf
│ ├── local-shared.conf
│ └── routes
└── app
│ ├── views
│ └── index.scala.html
│ └── services
│ └── CborSerializable.java
├── play-scala-compile-di-example
├── public
│ ├── stylesheets
│ │ └── main.css
│ ├── javascripts
│ │ └── hello.js
│ └── images
│ │ └── favicon.png
├── project
│ ├── build.properties
│ └── plugins.sbt
├── conf
│ ├── application.conf
│ └── routes
├── .gitignore
├── NOTICE
├── app
│ ├── views
│ │ └── index.scala.html
│ ├── controllers
│ │ └── HomeController.scala
│ └── MyApplicationLoader.scala
└── test
│ ├── SeleniumSpec.scala
│ ├── MyApplicationFactory.scala
│ └── ServerSpec.scala
├── play-scala-fileupload-example
├── public
│ ├── stylesheets
│ │ └── main.css
│ ├── javascripts
│ │ └── hello.js
│ └── images
│ │ └── favicon.png
├── project
│ ├── build.properties
│ └── plugins.sbt
├── NOTICE
├── app
│ └── views
│ │ └── index.scala.html
├── conf
│ ├── routes
│ └── application.conf
└── build.sbt
├── play-scala-hello-world-tutorial
├── public
│ ├── javascripts
│ │ └── main.js
│ └── images
│ │ ├── favicon.png
│ │ ├── external.png
│ │ ├── hello-one.png
│ │ ├── play-stack.png
│ │ ├── hello-custom.png
│ │ ├── header-pattern.png
│ │ ├── compilation-error.png
│ │ ├── play-request-response.png
│ │ └── play_icon_reverse.svg
├── project
│ ├── build.properties
│ └── plugins.sbt
├── conf
│ ├── messages
│ ├── application.conf
│ └── routes
├── NOTICE
└── build.sbt
├── play-scala-macwire-di-example
├── public
│ ├── stylesheets
│ │ └── main.css
│ ├── javascripts
│ │ └── hello.js
│ └── images
│ │ └── favicon.png
├── project
│ ├── build.properties
│ └── plugins.sbt
├── conf
│ ├── application.conf
│ └── routes
├── app
│ ├── services
│ │ ├── ServicesModule.scala
│ │ └── GreetingService.scala
│ ├── models
│ │ └── package.scala
│ └── GreetingModule.scala
├── NOTICE
├── test
│ ├── SeleniumSpec.scala
│ ├── ServerSpec.scala
│ ├── GreeterApplicationFactory.scala
│ └── ApplicationSpec.scala
└── README.md
├── play-scala-secure-session-example
├── public
│ ├── stylesheets
│ │ └── main.css
│ ├── javascripts
│ │ └── hello.js
│ └── images
│ │ └── favicon.png
├── project
│ ├── build.properties
│ └── plugins.sbt
├── NOTICE
├── app
│ ├── Module.scala
│ └── controllers
│ │ ├── HomeController.scala
│ │ └── LogoutController.scala
└── conf
│ └── routes
├── play-java-ebean-example
├── project
│ ├── build.properties
│ └── plugins.sbt
├── conf
│ └── messages
├── public
│ └── stylesheets
│ │ └── main.css
├── test
│ └── TestSuite.java
├── NOTICE
└── app
│ ├── models
│ ├── BaseModel.java
│ └── Company.java
│ ├── repository
│ └── DatabaseExecutionContext.java
│ └── views
│ └── tags
│ └── forms
│ ├── field_constructor.scala.html
│ └── FormHelper.scala
├── play-java-grpc-example
├── project
│ ├── build.properties
│ ├── project
│ │ └── buildinfo.sbt
│ └── plugins.sbt
├── docs
│ ├── build.sbt
│ └── src
│ │ └── main
│ │ └── paradox
│ │ └── running.md
├── public
│ ├── javascripts
│ │ └── hello.js
│ └── images
│ │ ├── external.png
│ │ ├── favicon.png
│ │ └── header-pattern.png
├── conf
│ ├── selfsigned.keystore
│ └── routes
├── .gitignore
├── deployment
│ ├── base
│ │ ├── kustomization.yaml
│ │ └── service.yml
│ └── overlays
│ │ ├── minikube
│ │ ├── ingress.yml
│ │ └── kustomization.yaml
│ │ └── my-openshift-cluster
│ │ ├── kustomization.yaml
│ │ └── route.yml
├── NOTICE
├── app
│ └── protobuf
│ │ └── helloworld.proto
└── README.md
├── play-java-starter-example
├── project
│ ├── build.properties
│ └── plugins.sbt
├── public
│ ├── javascripts
│ │ └── hello.js
│ └── images
│ │ ├── external.png
│ │ ├── favicon.png
│ │ └── header-pattern.png
├── NOTICE
├── app
│ ├── services
│ │ ├── Counter.java
│ │ └── AtomicCounter.java
│ └── views
│ │ └── index.scala.html
└── conf
│ └── routes
├── play-scala-anorm-example
├── project
│ ├── build.properties
│ └── plugins.sbt
├── conf
│ └── messages
├── app
│ ├── views
│ │ └── helper
│ │ │ └── date.scala.html
│ └── models
│ │ └── DatabaseExecutionContext.scala
└── NOTICE
├── play-scala-grpc-example
├── project
│ ├── build.properties
│ ├── project
│ │ └── buildinfo.sbt
│ └── plugins.sbt
├── docs
│ ├── build.sbt
│ └── src
│ │ └── main
│ │ └── paradox
│ │ └── running.md
├── public
│ ├── javascripts
│ │ └── hello.js
│ └── images
│ │ ├── external.png
│ │ ├── favicon.png
│ │ └── header-pattern.png
├── conf
│ ├── selfsigned.keystore
│ └── routes
├── .gitignore
├── deployment
│ ├── base
│ │ ├── kustomization.yaml
│ │ └── service.yml
│ └── overlays
│ │ ├── minikube
│ │ ├── ingress.yml
│ │ └── kustomization.yaml
│ │ └── my-openshift-cluster
│ │ ├── kustomization.yaml
│ │ └── route.yml
├── NOTICE
├── app
│ ├── protobuf
│ │ └── helloworld.proto
│ └── Module.scala
└── README.md
├── play-scala-slick-example
├── project
│ ├── build.properties
│ └── plugins.sbt
├── samples
│ ├── basic
│ │ ├── build.sbt
│ │ ├── public
│ │ │ ├── stylesheets
│ │ │ │ └── main.css
│ │ │ └── images
│ │ │ │ └── favicon.png
│ │ ├── conf
│ │ │ ├── evolutions
│ │ │ │ └── default
│ │ │ │ │ └── 1.sql
│ │ │ ├── test.conf
│ │ │ └── routes
│ │ ├── app
│ │ │ ├── models
│ │ │ │ └── Models.scala
│ │ │ └── views
│ │ │ │ └── main.scala.html
│ │ └── test
│ │ │ └── IntegrationSpec.scala
│ ├── person
│ │ ├── build.sbt
│ │ ├── conf
│ │ │ ├── messages
│ │ │ ├── evolutions
│ │ │ │ └── default
│ │ │ │ │ └── 1.sql
│ │ │ ├── test.conf
│ │ │ └── routes
│ │ ├── app
│ │ │ ├── models
│ │ │ │ └── Person.scala
│ │ │ └── views
│ │ │ │ ├── main.scala.html
│ │ │ │ └── index.scala.html
│ │ └── test
│ │ │ ├── BrowserSpec.scala
│ │ │ └── IntegrationSpec.scala
│ └── computer-database
│ │ ├── build.sbt
│ │ ├── conf
│ │ ├── messages
│ │ ├── test.conf
│ │ └── evolutions
│ │ │ └── default
│ │ │ └── 1.sql
│ │ └── app
│ │ ├── bootstrap
│ │ └── ComputersDatabaseModule.scala
│ │ └── views
│ │ ├── twitterBootstrapInput.scala.html
│ │ └── main.scala.html
└── NOTICE
├── play-java-compile-di-example
├── project
│ ├── build.properties
│ └── plugins.sbt
├── conf
│ └── application.conf
├── NOTICE
└── build.sbt
├── play-java-streaming-example
├── project
│ ├── build.properties
│ └── plugins.sbt
├── public
│ ├── images
│ │ └── favicon.png
│ └── javascripts
│ │ ├── comet.js
│ │ └── eventsource.js
├── NOTICE
├── conf
│ └── application.conf
├── app
│ ├── views
│ │ ├── javaeventsource.scala.html
│ │ ├── index.scala.html
│ │ ├── javacomet.scala.html
│ │ └── main.scala.html
│ └── controllers
│ │ ├── HomeController.java
│ │ └── JavaEventSourceController.java
├── test
│ └── controllers
│ │ ├── JavaCometControllerTest.java
│ │ └── JavaEventSourceControllerTest.java
├── README.md
└── build.sbt
├── play-java-websocket-example
├── project
│ ├── build.properties
│ └── plugins.sbt
├── public
│ └── images
│ │ ├── buy.png
│ │ ├── hold.png
│ │ ├── sell.png
│ │ └── favicon.png
├── app
│ └── stocks
│ │ ├── StockQuoteGenerator.java
│ │ ├── StockQuote.java
│ │ ├── StockHistory.java
│ │ ├── StockUpdate.java
│ │ └── FakeStockQuoteGenerator.java
├── NOTICE
└── conf
│ └── routes
├── play-scala-isolated-slick-example
├── .gitignore
├── project
│ ├── build.properties
│ └── plugins.sbt
├── public
│ ├── javascripts
│ │ └── hello.js
│ └── images
│ │ └── favicon.png
├── modules
│ ├── flyway
│ │ └── src
│ │ │ └── main
│ │ │ └── resources
│ │ │ └── db
│ │ │ └── migration
│ │ │ ├── V20150409131208__add_user.sql
│ │ │ └── V20150409112518__create_users_table.sql
│ └── api
│ │ └── src
│ │ └── main
│ │ └── scala
│ │ └── com
│ │ └── example
│ │ └── user
│ │ └── UserDAO.scala
├── scripts
│ └── test-sbt
├── NOTICE
├── app
│ ├── views
│ │ ├── create.scala.html
│ │ ├── update.scala.html
│ │ └── main.scala.html
│ └── models
│ │ └── UserRequest.scala
└── conf
│ └── routes
├── play-scala-rest-api-example
├── project
│ ├── build.properties
│ └── plugins.sbt
├── conf
│ ├── routes
│ ├── generated.keystore
│ ├── application.conf
│ └── secure.conf
├── docs
│ └── build.sbt
├── scripts
│ └── test-sbt
├── NOTICE
└── app
│ ├── Module.scala
│ └── v1
│ └── post
│ └── PostRouter.scala
├── play-scala-starter-example
├── project
│ ├── build.properties
│ └── plugins.sbt
├── public
│ ├── javascripts
│ │ └── hello.js
│ └── images
│ │ ├── favicon.png
│ │ ├── external.png
│ │ └── header-pattern.png
├── NOTICE
├── test
│ └── BrowserSpec.scala
├── conf
│ └── routes
├── app
│ ├── views
│ │ └── index.scala.html
│ ├── filters
│ │ └── ExampleFilter.scala
│ └── controllers
│ │ └── HomeController.scala
└── build.sbt
├── play-scala-streaming-example
├── project
│ ├── build.properties
│ └── plugins.sbt
├── public
│ └── images
│ │ └── favicon.png
├── NOTICE
├── app
│ ├── controllers
│ │ ├── HomeController.scala
│ │ ├── ScalaEventSourceController.scala
│ │ ├── ScalaCometController.scala
│ │ └── ScalaTicker.scala
│ └── views
│ │ ├── index.scala.html
│ │ ├── main.scala.html
│ │ └── scalacomet.scala.html
├── conf
│ ├── application.conf
│ └── routes
└── build.sbt
├── play-scala-websocket-example
├── project
│ ├── build.properties
│ └── plugins.sbt
├── public
│ └── images
│ │ ├── buy.png
│ │ ├── hold.png
│ │ ├── sell.png
│ │ └── favicon.png
├── NOTICE
└── conf
│ └── routes
└── .gitignore
/.github/mergify.yml:
--------------------------------------------------------------------------------
1 | extends: .github
2 |
--------------------------------------------------------------------------------
/play-java-chatroom-example/conf/messages:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-scala-chatroom-example/conf/messages:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-scala-tls-example/.gitignore:
--------------------------------------------------------------------------------
1 | /certs
2 |
--------------------------------------------------------------------------------
/play-java-dagger2-example/public/stylesheets/main.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-java-forms-example/public/javascripts/main.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-java-forms-example/public/stylesheets/main.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-java-jpa-example/public/stylesheets/main.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-java-rest-api-example/public/javascripts/main.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-scala-forms-example/public/stylesheets/main.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-scala-log4j2-example/public/stylesheets/main.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-java-fileupload-example/public/stylesheets/main.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/public/javascripts/main.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-java-pekko-cluster-example/public/javascripts/main.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-java-rest-api-example/public/stylesheets/main.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-scala-compile-di-example/public/stylesheets/main.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-scala-fileupload-example/public/stylesheets/main.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-scala-hello-world-tutorial/public/javascripts/main.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-scala-macwire-di-example/public/stylesheets/main.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-scala-tls-example/scripts/password:
--------------------------------------------------------------------------------
1 | 3fKrFtcFP9
2 |
--------------------------------------------------------------------------------
/play-java-fileupload-example/conf/messages.es:
--------------------------------------------------------------------------------
1 | name=File name
--------------------------------------------------------------------------------
/play-java-pekko-cluster-example/public/stylesheets/main.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-scala-secure-session-example/public/stylesheets/main.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-java-fileupload-example/conf/messages:
--------------------------------------------------------------------------------
1 | name=Nombre del archivo
--------------------------------------------------------------------------------
/play-java-dagger2-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-java-ebean-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-java-forms-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-java-grpc-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-java-jpa-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-java-starter-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-anorm-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-forms-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-grpc-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-log4j2-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-slick-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-tls-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-java-chatroom-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-java-compile-di-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-java-fileupload-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-java-rest-api-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-java-streaming-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-java-websocket-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-chatroom-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-compile-di-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-fileupload-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-isolated-slick-example/.gitignore:
--------------------------------------------------------------------------------
1 | test.mv.db
2 | test.trace.db
3 |
--------------------------------------------------------------------------------
/play-scala-macwire-di-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-rest-api-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/basic/build.sbt:
--------------------------------------------------------------------------------
1 | name := "basic-sample"
2 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/person/build.sbt:
--------------------------------------------------------------------------------
1 | name := "person-sample"
2 |
--------------------------------------------------------------------------------
/play-scala-starter-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-streaming-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-websocket-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-java-pekko-cluster-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-hello-world-tutorial/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-isolated-slick-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-secure-session-example/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-tls-example/modules/one/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-tls-example/modules/two/project/build.properties:
--------------------------------------------------------------------------------
1 | sbt.version=1.11.3
2 |
--------------------------------------------------------------------------------
/play-scala-forms-example/conf/application.conf:
--------------------------------------------------------------------------------
1 | play.http.secret.key = "changeme"
2 |
--------------------------------------------------------------------------------
/play-scala-rest-api-example/conf/routes:
--------------------------------------------------------------------------------
1 | -> /v1/posts v1.post.PostRouter
--------------------------------------------------------------------------------
/play-scala-compile-di-example/conf/application.conf:
--------------------------------------------------------------------------------
1 | play.application.loader=MyApplicationLoader
2 |
--------------------------------------------------------------------------------
/play-java-compile-di-example/conf/application.conf:
--------------------------------------------------------------------------------
1 |
2 | play.application.loader= "MyApplicationLoader"
3 |
--------------------------------------------------------------------------------
/play-scala-forms-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
2 |
--------------------------------------------------------------------------------
/play-java-compile-di-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
2 |
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
2 |
--------------------------------------------------------------------------------
/play-scala-chatroom-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
2 |
--------------------------------------------------------------------------------
/play-scala-compile-di-example/.gitignore:
--------------------------------------------------------------------------------
1 | /db
2 | /lib/
3 | /modules
4 | test-result
5 | server.pid
6 | *.eml
7 |
--------------------------------------------------------------------------------
/play-scala-compile-di-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
2 |
--------------------------------------------------------------------------------
/play-scala-hello-world-tutorial/conf/messages:
--------------------------------------------------------------------------------
1 | # https://www.playframework.com/documentation/latest/ScalaI18N
2 |
--------------------------------------------------------------------------------
/play-scala-macwire-di-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
2 |
--------------------------------------------------------------------------------
/play-java-grpc-example/project/project/buildinfo.sbt:
--------------------------------------------------------------------------------
1 | addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.13.1")
2 |
--------------------------------------------------------------------------------
/play-scala-grpc-example/project/project/buildinfo.sbt:
--------------------------------------------------------------------------------
1 | addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.13.1")
2 |
--------------------------------------------------------------------------------
/play-scala-hello-world-tutorial/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
2 |
--------------------------------------------------------------------------------
/play-scala-log4j2-example/conf/logger-configurator.properties:
--------------------------------------------------------------------------------
1 | play.logger.configurator=Log4J2LoggerConfigurator
2 |
--------------------------------------------------------------------------------
/play-scala-macwire-di-example/conf/application.conf:
--------------------------------------------------------------------------------
1 |
2 | play.application.loader=GreetingApplicationLoader
3 |
4 |
--------------------------------------------------------------------------------
/play-java-forms-example/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | connection.project.dir=
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/play-scala-hello-world-tutorial/conf/application.conf:
--------------------------------------------------------------------------------
1 | # https://www.playframework.com/documentation/latest/Configuration
2 |
--------------------------------------------------------------------------------
/play-scala-tls-example/app/views/index.scala.html:
--------------------------------------------------------------------------------
1 | @(subdomain: String)
2 |
3 | This is the page for the @subdomain site.
4 |
--------------------------------------------------------------------------------
/play-scala-tls-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | // The Play plugin
2 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
3 |
--------------------------------------------------------------------------------
/play-java-chatroom-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | // The Play plugin
2 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
3 |
--------------------------------------------------------------------------------
/play-java-dagger2-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | // The Play plugin
2 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
3 |
--------------------------------------------------------------------------------
/play-java-forms-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | // The Play plugin
2 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
3 |
--------------------------------------------------------------------------------
/play-java-starter-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | // The Play plugin
2 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
3 |
--------------------------------------------------------------------------------
/play-scala-anorm-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | // The Play plugin
2 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
3 |
--------------------------------------------------------------------------------
/play-scala-log4j2-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | // The Play plugin
2 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
3 |
--------------------------------------------------------------------------------
/play-scala-slick-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | // The Play plugin
2 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
3 |
--------------------------------------------------------------------------------
/play-scala-starter-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | // The Play plugin
2 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
3 |
--------------------------------------------------------------------------------
/play-java-fileupload-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | // The Play plugin
2 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
3 |
--------------------------------------------------------------------------------
/play-java-grpc-example/docs/build.sbt:
--------------------------------------------------------------------------------
1 | paradoxTheme := Some(builtinParadoxTheme("generic"))
2 |
3 | scalaVersion := "2.13.16"
4 |
5 |
--------------------------------------------------------------------------------
/play-java-pekko-cluster-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | // The Play plugin
2 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
3 |
--------------------------------------------------------------------------------
/play-scala-grpc-example/docs/build.sbt:
--------------------------------------------------------------------------------
1 | paradoxTheme := Some(builtinParadoxTheme("generic"))
2 |
3 | scalaVersion := "2.13.16"
4 |
5 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/computer-database/build.sbt:
--------------------------------------------------------------------------------
1 | name := "computer-database-sample"
2 |
3 | libraryDependencies += guice
4 |
--------------------------------------------------------------------------------
/play-scala-secure-session-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | // The Play plugin
2 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
3 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/person/conf/messages:
--------------------------------------------------------------------------------
1 | name = Name
2 | age = Age
3 |
4 | user.created = You have successfully created a user!
--------------------------------------------------------------------------------
/play-scala-forms-example/public/javascripts/hello.js:
--------------------------------------------------------------------------------
1 | if (window.console) {
2 | console.log("Welcome to your Play application's JavaScript!");
3 | }
--------------------------------------------------------------------------------
/play-scala-tls-example/scripts/client.p12:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-tls-example/scripts/client.p12
--------------------------------------------------------------------------------
/play-java-dagger2-example/public/javascripts/main.js:
--------------------------------------------------------------------------------
1 | if (window.console) {
2 | console.log("Welcome to your Play application's JavaScript!");
3 | }
4 |
--------------------------------------------------------------------------------
/play-java-grpc-example/public/javascripts/hello.js:
--------------------------------------------------------------------------------
1 | if (window.console) {
2 | console.log("Welcome to your Play application's JavaScript!");
3 | }
4 |
--------------------------------------------------------------------------------
/play-scala-grpc-example/public/javascripts/hello.js:
--------------------------------------------------------------------------------
1 | if (window.console) {
2 | console.log("Welcome to your Play application's JavaScript!");
3 | }
4 |
--------------------------------------------------------------------------------
/play-scala-macwire-di-example/public/javascripts/hello.js:
--------------------------------------------------------------------------------
1 | if (window.console) {
2 | console.log("Welcome to your Play application's JavaScript!");
3 | }
--------------------------------------------------------------------------------
/play-scala-rest-api-example/docs/build.sbt:
--------------------------------------------------------------------------------
1 | // Uses the out of the box generic theme.
2 | paradoxTheme := Some(builtinParadoxTheme("generic"))
3 |
4 |
--------------------------------------------------------------------------------
/play-scala-tls-example/scripts/clientca.p12:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-tls-example/scripts/clientca.p12
--------------------------------------------------------------------------------
/play-scala-tls-example/scripts/exampleca.p12:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-tls-example/scripts/exampleca.p12
--------------------------------------------------------------------------------
/play-java-fileupload-example/public/javascripts/hello.js:
--------------------------------------------------------------------------------
1 | if (window.console) {
2 | console.log("Welcome to your Play application's JavaScript!");
3 | }
4 |
--------------------------------------------------------------------------------
/play-java-grpc-example/conf/selfsigned.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-grpc-example/conf/selfsigned.keystore
--------------------------------------------------------------------------------
/play-java-jpa-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-jpa-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-java-pekko-cluster-example/.gitignore:
--------------------------------------------------------------------------------
1 | logs
2 | target
3 | /.idea
4 | /.idea_modules
5 | /.classpath
6 | /.project
7 | /.settings
8 | /RUNNING_PID
9 |
--------------------------------------------------------------------------------
/play-java-starter-example/public/javascripts/hello.js:
--------------------------------------------------------------------------------
1 | if (window.console) {
2 | console.log("Welcome to your Play application's JavaScript!");
3 | }
4 |
--------------------------------------------------------------------------------
/play-scala-compile-di-example/public/javascripts/hello.js:
--------------------------------------------------------------------------------
1 | if (window.console) {
2 | console.log("Welcome to your Play application's JavaScript!");
3 | }
4 |
--------------------------------------------------------------------------------
/play-scala-fileupload-example/public/javascripts/hello.js:
--------------------------------------------------------------------------------
1 | if (window.console) {
2 | console.log("Welcome to your Play application's JavaScript!");
3 | }
4 |
--------------------------------------------------------------------------------
/play-scala-isolated-slick-example/public/javascripts/hello.js:
--------------------------------------------------------------------------------
1 | if (window.console) {
2 | console.log("Welcome to your Play application's JavaScript!");
3 | }
--------------------------------------------------------------------------------
/play-scala-log4j2-example/public/javascripts/hello.js:
--------------------------------------------------------------------------------
1 | if (window.console) {
2 | console.log("Welcome to your Play application's JavaScript!");
3 | }
4 |
--------------------------------------------------------------------------------
/play-scala-starter-example/public/javascripts/hello.js:
--------------------------------------------------------------------------------
1 | if (window.console) {
2 | console.log("Welcome to your Play application's JavaScript!");
3 | }
4 |
--------------------------------------------------------------------------------
/play-scala-tls-example/conf/generated.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-tls-example/conf/generated.keystore
--------------------------------------------------------------------------------
/play-scala-tls-example/scripts/example.com.p12:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-tls-example/scripts/example.com.p12
--------------------------------------------------------------------------------
/play-scala-tls-example/scripts/exampletrust.p12:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-tls-example/scripts/exampletrust.p12
--------------------------------------------------------------------------------
/play-java-forms-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-forms-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-java-grpc-example/public/images/external.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-grpc-example/public/images/external.png
--------------------------------------------------------------------------------
/play-java-grpc-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-grpc-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-java-streaming-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | // Use the Play sbt plugin for Play projects
2 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
3 |
--------------------------------------------------------------------------------
/play-java-websocket-example/public/images/buy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-websocket-example/public/images/buy.png
--------------------------------------------------------------------------------
/play-java-websocket-example/public/images/hold.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-websocket-example/public/images/hold.png
--------------------------------------------------------------------------------
/play-java-websocket-example/public/images/sell.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-websocket-example/public/images/sell.png
--------------------------------------------------------------------------------
/play-scala-anorm-example/conf/messages:
--------------------------------------------------------------------------------
1 | # Messages
2 |
3 | computers.list.title={0,choice,0#No computers|1#One computer|1<{0,number,integer} computers} found
4 |
--------------------------------------------------------------------------------
/play-scala-forms-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-forms-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-scala-grpc-example/conf/selfsigned.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-grpc-example/conf/selfsigned.keystore
--------------------------------------------------------------------------------
/play-scala-grpc-example/public/images/external.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-grpc-example/public/images/external.png
--------------------------------------------------------------------------------
/play-scala-grpc-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-grpc-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-scala-secure-session-example/public/javascripts/hello.js:
--------------------------------------------------------------------------------
1 | if (window.console) {
2 | console.log("Welcome to your Play application's JavaScript!");
3 | }
4 |
--------------------------------------------------------------------------------
/play-scala-streaming-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | // Use the Play sbt plugin for Play projects
2 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
3 |
--------------------------------------------------------------------------------
/play-scala-websocket-example/public/images/buy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-websocket-example/public/images/buy.png
--------------------------------------------------------------------------------
/play-java-chatroom-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-chatroom-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-java-dagger2-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-dagger2-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-java-grpc-example/.gitignore:
--------------------------------------------------------------------------------
1 | logs
2 | target
3 | /.idea
4 | /.idea_modules
5 | /.classpath
6 | /.project
7 | /.settings
8 | /RUNNING_PID
9 | *.iml
10 |
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore Gradle project-specific cache directory
2 | .gradle
3 |
4 | # Ignore Gradle build output directory
5 | build
6 |
--------------------------------------------------------------------------------
/play-java-rest-api-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-rest-api-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-java-starter-example/public/images/external.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-starter-example/public/images/external.png
--------------------------------------------------------------------------------
/play-java-starter-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-starter-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-scala-grpc-example/.gitignore:
--------------------------------------------------------------------------------
1 | logs
2 | target
3 | /.idea
4 | /.idea_modules
5 | /.classpath
6 | /.project
7 | /.settings
8 | /RUNNING_PID
9 | *.iml
10 |
--------------------------------------------------------------------------------
/play-scala-log4j2-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-log4j2-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-scala-rest-api-example/conf/generated.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-rest-api-example/conf/generated.keystore
--------------------------------------------------------------------------------
/play-scala-starter-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-starter-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-scala-websocket-example/public/images/hold.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-websocket-example/public/images/hold.png
--------------------------------------------------------------------------------
/play-scala-websocket-example/public/images/sell.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-websocket-example/public/images/sell.png
--------------------------------------------------------------------------------
/play-java-ebean-example/conf/messages:
--------------------------------------------------------------------------------
1 | # Messages
2 |
3 | computers.list.title={0,choice,0#No computers|1#One computer|1<{0,number,integer} computers} found
4 |
5 |
6 |
--------------------------------------------------------------------------------
/play-java-fileupload-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-fileupload-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-java-grpc-example/public/images/header-pattern.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-grpc-example/public/images/header-pattern.png
--------------------------------------------------------------------------------
/play-java-rest-api-example/conf/routes:
--------------------------------------------------------------------------------
1 | GET / controllers.HomeController.index
2 |
3 | -> /v1/posts posts.Routes
4 |
--------------------------------------------------------------------------------
/play-java-streaming-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-streaming-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-java-websocket-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-websocket-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-scala-chatroom-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-chatroom-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-scala-compile-di-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-compile-di-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-scala-fileupload-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-fileupload-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-scala-macwire-di-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-macwire-di-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-scala-starter-example/public/images/external.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-starter-example/public/images/external.png
--------------------------------------------------------------------------------
/play-scala-streaming-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-streaming-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-scala-websocket-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-websocket-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-java-forms-example/conf/application.conf:
--------------------------------------------------------------------------------
1 | # This is the main configuration file for the application.
2 | # https://www.playframework.com/documentation/latest/ConfigFile
3 |
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/public/images/external.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-hello-world-tutorial/public/images/external.png
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-hello-world-tutorial/public/images/favicon.png
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/public/images/favicon0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-hello-world-tutorial/public/images/favicon0.png
--------------------------------------------------------------------------------
/play-java-pekko-cluster-example/conf/local1.conf:
--------------------------------------------------------------------------------
1 | include "application"
2 | include "local-shared"
3 |
4 | pekko.remote.artery.canonical.port = 73551
5 | http.port = 9001
6 |
--------------------------------------------------------------------------------
/play-java-pekko-cluster-example/conf/local2.conf:
--------------------------------------------------------------------------------
1 | include "application"
2 | include "local-shared"
3 |
4 | pekko.remote.artery.canonical.port = 73552
5 | http.port = 9002
6 |
--------------------------------------------------------------------------------
/play-java-pekko-cluster-example/conf/local3.conf:
--------------------------------------------------------------------------------
1 | include "application"
2 | include "local-shared"
3 |
4 | pekko.remote.artery.canonical.port = 73553
5 | http.port = 9003
6 |
--------------------------------------------------------------------------------
/play-java-pekko-cluster-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-pekko-cluster-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-scala-fileupload-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | resolvers += Resolver.jcenterRepo
2 |
3 | // The Play plugin
4 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
5 |
--------------------------------------------------------------------------------
/play-scala-grpc-example/public/images/header-pattern.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-grpc-example/public/images/header-pattern.png
--------------------------------------------------------------------------------
/play-scala-hello-world-tutorial/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-hello-world-tutorial/public/images/favicon.png
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/conf/application.conf:
--------------------------------------------------------------------------------
1 | # This is the main configuration file for the application.
2 | # https://www.playframework.com/documentation/latest/ConfigFile
3 |
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/public/images/hello-one.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-hello-world-tutorial/public/images/hello-one.png
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/public/images/play-stack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-hello-world-tutorial/public/images/play-stack.png
--------------------------------------------------------------------------------
/play-java-starter-example/public/images/header-pattern.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-starter-example/public/images/header-pattern.png
--------------------------------------------------------------------------------
/play-scala-hello-world-tutorial/public/images/external.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-hello-world-tutorial/public/images/external.png
--------------------------------------------------------------------------------
/play-scala-hello-world-tutorial/public/images/hello-one.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-hello-world-tutorial/public/images/hello-one.png
--------------------------------------------------------------------------------
/play-scala-hello-world-tutorial/public/images/play-stack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-hello-world-tutorial/public/images/play-stack.png
--------------------------------------------------------------------------------
/play-scala-isolated-slick-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-isolated-slick-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-scala-secure-session-example/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-secure-session-example/public/images/favicon.png
--------------------------------------------------------------------------------
/play-scala-starter-example/public/images/header-pattern.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-starter-example/public/images/header-pattern.png
--------------------------------------------------------------------------------
/play-scala-tls-example/conf/routes:
--------------------------------------------------------------------------------
1 | GET / controllers.HomeController.index
2 |
3 | GET /assets/*file controllers.Assets.at(path="/public", file)
4 |
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/public/images/hello-custom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-hello-world-tutorial/public/images/hello-custom.png
--------------------------------------------------------------------------------
/play-java-pekko-cluster-example/conf/application.conf:
--------------------------------------------------------------------------------
1 | include "cluster"
2 | include "serialization"
3 |
4 |
5 | play.modules.enabled += modules.AppModule
6 |
7 | pekko.loglevel = INFO
--------------------------------------------------------------------------------
/play-scala-hello-world-tutorial/public/images/hello-custom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-hello-world-tutorial/public/images/hello-custom.png
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/basic/public/stylesheets/main.css:
--------------------------------------------------------------------------------
1 | #cats {
2 | float: left;
3 | width: 400px;
4 | }
5 |
6 | #dogs {
7 | float: left;
8 | margin-left: 50px;
9 | }
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/computer-database/conf/messages:
--------------------------------------------------------------------------------
1 | # Messages
2 |
3 | computers.list.title={0,choice,0#No computers|1#One computer|1<{0,number,integer} computers} found
4 |
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-hello-world-tutorial/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/public/images/header-pattern.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-hello-world-tutorial/public/images/header-pattern.png
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/public/images/play-components.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-hello-world-tutorial/public/images/play-components.png
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/public/images/request-response.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-hello-world-tutorial/public/images/request-response.png
--------------------------------------------------------------------------------
/play-scala-hello-world-tutorial/public/images/header-pattern.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-hello-world-tutorial/public/images/header-pattern.png
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/basic/public/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-slick-example/samples/basic/public/images/favicon.png
--------------------------------------------------------------------------------
/play-java-grpc-example/deployment/base/kustomization.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: kustomize.config.k8s.io/v1beta1
3 | kind: Kustomization
4 |
5 | resources:
6 | - deployment.yml
7 | - service.yml
8 |
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/public/images/compilation-error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-hello-world-tutorial/public/images/compilation-error.png
--------------------------------------------------------------------------------
/play-scala-grpc-example/deployment/base/kustomization.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: kustomize.config.k8s.io/v1beta1
3 | kind: Kustomization
4 |
5 | resources:
6 | - deployment.yml
7 | - service.yml
8 |
--------------------------------------------------------------------------------
/play-scala-hello-world-tutorial/public/images/compilation-error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-hello-world-tutorial/public/images/compilation-error.png
--------------------------------------------------------------------------------
/play-java-ebean-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | // The Play plugin
2 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
3 |
4 | addSbtPlugin("org.playframework" % "sbt-play-ebean" % "8.3.0")
5 |
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/public/images/play-request-response.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-java-hello-world-tutorial/public/images/play-request-response.png
--------------------------------------------------------------------------------
/play-java-jpa-example/app/assets/javascripts/index.coffee:
--------------------------------------------------------------------------------
1 | $ ->
2 | $.get "/persons", (persons) ->
3 | $.each persons, (index, person) ->
4 | $("#persons").append $("
").text person.name
--------------------------------------------------------------------------------
/play-java-streaming-example/public/javascripts/comet.js:
--------------------------------------------------------------------------------
1 | // Called for each Comet message
2 | var clockChanged = function(time) {
3 | $('#clock').html(time.replace(/(\d)/g, '$1 '))
4 | }
5 |
--------------------------------------------------------------------------------
/play-scala-hello-world-tutorial/public/images/play-request-response.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/playframework/play-samples/3.0.x/play-scala-hello-world-tutorial/public/images/play-request-response.png
--------------------------------------------------------------------------------
/play-scala-tls-example/modules/one/conf/one.routes:
--------------------------------------------------------------------------------
1 | GET / controllers.one.HomeController.index()
2 |
3 | GET /assets/*file controllers.Assets.at(path="/public/lib/one", file)
4 |
--------------------------------------------------------------------------------
/play-scala-tls-example/modules/two/conf/two.routes:
--------------------------------------------------------------------------------
1 | GET / controllers.two.HomeController.index()
2 |
3 |
4 | GET /assets/*file controllers.Assets.at(path="/public/lib/two", file)
5 |
--------------------------------------------------------------------------------
/play-java-websocket-example/app/stocks/StockQuoteGenerator.java:
--------------------------------------------------------------------------------
1 | package stocks;
2 |
3 | public interface StockQuoteGenerator {
4 | StockQuote newQuote(StockQuote last);
5 |
6 | StockQuote seed();
7 | }
8 |
--------------------------------------------------------------------------------
/play-java-pekko-cluster-example/conf/cluster.conf:
--------------------------------------------------------------------------------
1 | pekko {
2 | actor.provider = cluster
3 |
4 | cluster {
5 | downing-provider-class = "org.apache.pekko.cluster.sbr.SplitBrainResolverProvider"
6 | }
7 | }
8 |
9 |
--------------------------------------------------------------------------------
/play-java-dagger2-example/conf/application.conf:
--------------------------------------------------------------------------------
1 | # This is the main configuration file for the application.
2 | # https://www.playframework.com/documentation/latest/ConfigFile
3 |
4 | play.application.loader= dagger.MyApplicationLoader
5 |
--------------------------------------------------------------------------------
/play-scala-macwire-di-example/app/services/ServicesModule.scala:
--------------------------------------------------------------------------------
1 | package services
2 |
3 | trait ServicesModule {
4 |
5 | import com.softwaremill.macwire._
6 |
7 | lazy val greetingService = wire[GreetingService]
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/play-java-websocket-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
2 |
3 | addSbtPlugin("com.github.sbt" % "sbt-less" % "2.0.1")
4 |
5 | addSbtPlugin("com.github.sbt" % "sbt-coffeescript" % "2.0.1")
6 |
--------------------------------------------------------------------------------
/play-scala-websocket-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
2 |
3 | addSbtPlugin("com.github.sbt" % "sbt-less" % "2.0.1")
4 |
5 | addSbtPlugin("com.github.sbt" % "sbt-coffeescript" % "2.0.1")
6 |
--------------------------------------------------------------------------------
/play-java-pekko-cluster-example/conf/serialization.conf:
--------------------------------------------------------------------------------
1 | # See also https://pekko.apache.org/docs/pekko/current/serialization-jackson.html#introduction
2 | pekko.actor.serialization-bindings {
3 | "services.CborSerializable" = jackson-cbor
4 | }
5 |
--------------------------------------------------------------------------------
/play-java-chatroom-example/public/stylesheets/main.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | height: 100%;
3 | }
4 |
5 | .wrap {
6 | min-height: 100%;
7 | height: 100%;
8 | margin: 0 auto -60px;
9 | }
10 |
11 | .footer {
12 | height: 60px;
13 | }
--------------------------------------------------------------------------------
/play-scala-chatroom-example/public/stylesheets/main.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | height: 100%;
3 | }
4 |
5 | .wrap {
6 | min-height: 100%;
7 | height: 100%;
8 | margin: 0 auto -60px;
9 | }
10 |
11 | .footer {
12 | height: 60px;
13 | }
--------------------------------------------------------------------------------
/play-scala-macwire-di-example/app/services/GreetingService.scala:
--------------------------------------------------------------------------------
1 | package services
2 |
3 | class GreetingService {
4 |
5 | def greetingMessage(language: String) = language match {
6 | case "it" => "Messi"
7 | case _ => "Hello"
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/play-java-ebean-example/public/stylesheets/main.css:
--------------------------------------------------------------------------------
1 | .sort-link-inactive i {
2 | visibility: hidden;
3 | }
4 |
5 | .sort-link-inactive:hover i {
6 | visibility: visible;
7 | }
8 |
9 | .top-right {
10 | position: absolute;
11 | right: 20px;
12 | top: 70px;
13 | }
14 |
--------------------------------------------------------------------------------
/play-java-pekko-cluster-example/app/views/index.scala.html:
--------------------------------------------------------------------------------
1 | @(hitCount: Int)
2 |
3 | @main("Welcome to Play") {
4 | Welcome to Play!
5 |
6 | Counter: @hitCount
7 |
8 | Increment
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/play-scala-forms-example/app/views/index.scala.html:
--------------------------------------------------------------------------------
1 | @()
2 |
3 | @main("Welcome to Play") {
4 |
9 | }
10 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/person/app/models/Person.scala:
--------------------------------------------------------------------------------
1 | package models
2 |
3 | import play.api.libs.json._
4 |
5 | case class Person(id: Long, name: String, age: Int)
6 |
7 | object Person {
8 | implicit val personFormat: OFormat[Person] = Json.format[Person]
9 | }
10 |
--------------------------------------------------------------------------------
/play-java-rest-api-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | // The Play plugin
2 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
3 |
4 | // Load testing tool:
5 | // https://gatling.io/docs/gatling/reference/current/extensions/sbt_plugin/
6 | addSbtPlugin("io.gatling" % "gatling-sbt" % "4.16.1")
7 |
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/.gitattributes:
--------------------------------------------------------------------------------
1 | #
2 | # https://help.github.com/articles/dealing-with-line-endings/
3 | #
4 | # Linux start script should use lf
5 | /gradlew text eol=lf
6 |
7 | # These are Windows script files and should use crlf
8 | *.bat text eol=crlf
9 |
10 |
--------------------------------------------------------------------------------
/play-java-rest-api-example/app/views/timeout.scala.html:
--------------------------------------------------------------------------------
1 | @()
2 |
3 |
4 |
5 |
6 | Timeout Page
7 |
8 |
9 | Timeout Page
10 |
11 | Database timed out, so showing this page instead.
12 |
13 |
14 |
--------------------------------------------------------------------------------
/play-scala-isolated-slick-example/modules/flyway/src/main/resources/db/migration/V20150409131208__add_user.sql:
--------------------------------------------------------------------------------
1 | INSERT INTO "users" VALUES (
2 | 'd074bce8-a8ca-49ec-9225-a50ffe83dc2f',
3 | 'myuser@example.com',
4 | (TIMESTAMP '2013-03-26T17:50:06Z'),
5 | (TIMESTAMP '2013-03-26T17:50:06Z')
6 | );
7 |
--------------------------------------------------------------------------------
/play-java-forms-example/app/views/index.scala.html:
--------------------------------------------------------------------------------
1 | @()
2 |
3 | @main("Welcome to Play") {
4 |
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/play-scala-tls-example/scripts/test-sbt:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | export KEY_PASSWORD=`cat scripts/password`
4 |
5 | echo "+---------------------------------------+"
6 | echo "| Executing tests using (modified sbt) |"
7 | echo "+---------------------------------------+"
8 | ./play ++$MATRIX_SCALA test
9 |
--------------------------------------------------------------------------------
/play-java-fileupload-example/conf/application.conf:
--------------------------------------------------------------------------------
1 | # https://www.playframework.com/documentation/latest/Configuration
2 |
3 | # Sets the maximum file size that can be uploaded to 1024k.
4 | # https://www.playframework.com/documentation/latest/JavaBodyParsers#Content-length-limits
5 | play.http.parser.maxMemoryBuffer=1024k
6 |
--------------------------------------------------------------------------------
/play-scala-isolated-slick-example/scripts/test-sbt:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | echo "+----------------------------+"
4 | echo "| Executing tests using sbt |"
5 | echo "+----------------------------+"
6 | rm -f test.mv.db test.trace.db
7 | sbt ++$MATRIX_SCALA clean reload ++$MATRIX_SCALA flyway/flywayMigrate slickCodegen test
8 |
--------------------------------------------------------------------------------
/play-java-grpc-example/docs/src/main/paradox/running.md:
--------------------------------------------------------------------------------
1 |
2 | ## Running
3 |
4 | * Running on a cluster: refer to the specific guides for @ref:[OpenShift](openshift.md) and @ref:[Kubernetes (`minikube`)](kubernetes.md)
5 | for specific information on deploying in Kubernetes-based clusters.
6 |
7 | * Run @ref[locally](locally.md)
8 |
--------------------------------------------------------------------------------
/play-scala-grpc-example/docs/src/main/paradox/running.md:
--------------------------------------------------------------------------------
1 |
2 | ## Running
3 |
4 | * Running on a cluster: refer to the specific guides for @ref:[OpenShift](openshift.md) and @ref:[Kubernetes (`minikube`)](kubernetes.md)
5 | for specific information on deploying in Kubernetes-based clusters.
6 |
7 | * Run @ref[locally](locally.md)
8 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/basic/conf/evolutions/default/1.sql:
--------------------------------------------------------------------------------
1 | # --- !Ups
2 |
3 | CREATE TABLE "CAT" ("NAME" VARCHAR NOT NULL PRIMARY KEY,"COLOR" VARCHAR NOT NULL);
4 | create TABLE "DOG" ("NAME" VARCHAR NOT NULL PRIMARY KEY,"COLOR" VARCHAR NOT NULL);
5 |
6 | # --- !Downs
7 |
8 | DROP TABLE "CAT";
9 | DROP TABLE "DOG";
10 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/person/conf/evolutions/default/1.sql:
--------------------------------------------------------------------------------
1 | # --- !Ups
2 |
3 | create table "people" (
4 | "id" bigint generated by default as identity(start with 1) not null primary key,
5 | "name" varchar not null,
6 | "age" int not null
7 | );
8 |
9 | # --- !Downs
10 |
11 | drop table "people" if exists;
12 |
--------------------------------------------------------------------------------
/play-scala-macwire-di-example/app/models/package.scala:
--------------------------------------------------------------------------------
1 | import play.api.libs.json.{Json, OFormat}
2 |
3 | package object models {
4 |
5 | case class Greeting(id: Int = -1, message: String, name: String)
6 |
7 | object Greeting {
8 | implicit val GreetingFormat: OFormat[Greeting] = Json.format[Greeting]
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/play-scala-rest-api-example/scripts/test-sbt:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -e
4 | set -o pipefail
5 |
6 | echo "+----------------------------+"
7 | echo "| Executing tests using sbt |"
8 | echo "+----------------------------+"
9 | sbt ++$MATRIX_SCALA test docs/paradox
10 | sbt ++$MATRIX_SCALA ";project gatling;gatling:compile"
11 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/basic/conf/test.conf:
--------------------------------------------------------------------------------
1 | include "application.conf"
2 |
3 | // Remove DB_CLOSE_DELAY=-1 as it will cause the database to persist between tests. However we want the database to
4 | // persist between application loads when we are running the application normally.
5 | slick.dbs.default.db.url="jdbc:h2:mem:play"
6 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/computer-database/app/bootstrap/ComputersDatabaseModule.scala:
--------------------------------------------------------------------------------
1 | package bootstrap
2 |
3 | import com.google.inject.AbstractModule
4 |
5 | class ComputersDatabaseModule extends AbstractModule {
6 | override def configure(): Unit = {
7 | bind(classOf[InitialData]).asEagerSingleton()
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/person/conf/test.conf:
--------------------------------------------------------------------------------
1 | include "application.conf"
2 |
3 | // Remove DB_CLOSE_DELAY=-1 as it will cause the database to persist between tests. However we want the database to
4 | // persist between application loads when we are running the application normally.
5 | slick.dbs.default.db.url="jdbc:h2:mem:play"
6 |
--------------------------------------------------------------------------------
/play-scala-tls-example/modules/one/app/views/one/index.scala.html:
--------------------------------------------------------------------------------
1 | @()
2 |
3 |
4 |
5 |
6 | You are reading the page for one.example.com
7 |
8 |
9 | The X.509 certificate the server sent you should be specifically for "one.example.com".
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/play-scala-tls-example/modules/two/app/views/two/index.scala.html:
--------------------------------------------------------------------------------
1 | @()
2 |
3 |
4 |
5 |
6 | You are reading the page for two.example.com
7 |
8 |
9 | The X.509 certificate the server sent you should be specifically for "two.example.com".
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/computer-database/conf/test.conf:
--------------------------------------------------------------------------------
1 | include "application.conf"
2 |
3 | // Remove DB_CLOSE_DELAY=-1 as it will cause the database to persist between tests. However we want the database to
4 | // persist between application loads when we are running the application normally.
5 | slick.dbs.default.db.url="jdbc:h2:mem:play"
6 |
--------------------------------------------------------------------------------
/play-java-pekko-cluster-example/conf/local-shared.conf:
--------------------------------------------------------------------------------
1 | pekko.remote.artery.canonical.hostname = "127.0.0.1"
2 |
3 | play {
4 | http.secret.key=some-random-secret
5 | server.pidfile.path = "/dev/null"
6 | }
7 |
8 | pekko.cluster.seed-nodes = [
9 | "pekko://application@127.0.0.1:73551",
10 | "pekko://application@127.0.0.1:73552"
11 | ]
12 |
--------------------------------------------------------------------------------
/play-scala-isolated-slick-example/modules/flyway/src/main/resources/db/migration/V20150409112518__create_users_table.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE "users" (
2 | id VARCHAR(255) PRIMARY KEY NOT NULL,
3 | email VARCHAR(1024) NOT NULL,
4 | created_at TIMESTAMP NOT NULL,
5 | updated_at TIMESTAMP NULL
6 | );
7 |
--------------------------------------------------------------------------------
/play-java-rest-api-example/conf/posts.routes:
--------------------------------------------------------------------------------
1 |
2 | GET / v1.post.PostController.list(request:Request)
3 | POST / v1.post.PostController.create(request:Request)
4 |
5 | GET /:id v1.post.PostController.show(request:Request,id)
6 | PUT /:id v1.post.PostController.update(request:Request, id)
7 |
--------------------------------------------------------------------------------
/play-java-dagger2-example/app/dagger/ApplicationLoaderContextModule.java:
--------------------------------------------------------------------------------
1 | package dagger;
2 |
3 | @Module
4 | public abstract class ApplicationLoaderContextModule {
5 |
6 | @Provides
7 | public static play.api.ApplicationLoader.Context providesScalaContext(play.ApplicationLoader.Context context) {
8 | return context.asScala();
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/play-java-dagger2-example/app/dagger/ClockModule.java:
--------------------------------------------------------------------------------
1 | package dagger;
2 |
3 | import java.time.Clock;
4 |
5 | /**
6 | * A module that provides a clock implementation.
7 | */
8 | @Module
9 | public abstract class ClockModule {
10 |
11 | @Provides
12 | public static Clock clock() {
13 | return java.time.Clock.systemUTC();
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/play-scala-rest-api-example/conf/application.conf:
--------------------------------------------------------------------------------
1 | include "secure"
2 |
3 | # db connections = ((physical_core_count * 2) + effective_spindle_count)
4 | fixedConnectionPool = 5
5 |
6 | repository.dispatcher {
7 | executor = "thread-pool-executor"
8 | throughput = 1
9 | thread-pool-executor {
10 | fixed-pool-size = ${fixedConnectionPool}
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/play-java-dagger2-example/app/dagger/ApplicationModule.java:
--------------------------------------------------------------------------------
1 | package dagger;
2 |
3 | import play.Application;
4 |
5 | @Module
6 | public abstract class ApplicationModule {
7 |
8 | @Provides
9 | public static Application providesApplication(MyComponentsFromContext myComponentsFromContext) {
10 | return myComponentsFromContext.application();
11 | }
12 |
13 | }
--------------------------------------------------------------------------------
/play-scala-forms-example/app/models/Widget.scala:
--------------------------------------------------------------------------------
1 | package models
2 |
3 | /**
4 | * Presentation object used for displaying data in a template.
5 | *
6 | * Note that it's a good practice to keep the presentation DTO,
7 | * which are used for reads, distinct from the form processing DTO,
8 | * which are used for writes.
9 | */
10 | case class Widget(name: String, price: Int)
--------------------------------------------------------------------------------
/play-scala-tls-example/modules/two/app/controllers/HomeController.scala:
--------------------------------------------------------------------------------
1 | package controllers.two
2 |
3 | import javax.inject._
4 | import play.api._
5 | import play.api.mvc._
6 |
7 | @Singleton
8 | class HomeController @Inject()(cc: ControllerComponents) extends AbstractController(cc) {
9 |
10 | def index = Action {
11 | Ok(views.html.two.index())
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/play-java-grpc-example/deployment/overlays/minikube/ingress.yml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: "extensions/v1beta1"
3 | kind: Ingress
4 | metadata:
5 | name: "play-java-grpc-ingress"
6 | spec:
7 | rules:
8 | - host: "myservice.example.org"
9 | http:
10 | paths:
11 | - backend:
12 | serviceName: "play-java-grpc-example"
13 | servicePort: 9000
14 |
15 |
--------------------------------------------------------------------------------
/play-scala-grpc-example/deployment/overlays/minikube/ingress.yml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: "extensions/v1beta1"
3 | kind: Ingress
4 | metadata:
5 | name: "play-scala-grpc-ingress"
6 | spec:
7 | rules:
8 | - host: "myservice.example.org"
9 | http:
10 | paths:
11 | - backend:
12 | serviceName: "play-scala-grpc-example"
13 | servicePort: 9000
14 |
15 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/person/app/views/main.scala.html:
--------------------------------------------------------------------------------
1 | @(title: String)(content: Html)
2 |
3 |
4 |
5 |
6 |
7 | @title
8 |
9 |
10 |
11 | @content
12 |
13 |
14 |
--------------------------------------------------------------------------------
/play-java-rest-api-example/scripts/test-sbt:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -e
4 | set -o pipefail
5 |
6 | echo "+----------------------------+"
7 | echo "| Executing tests using sbt |"
8 | echo "+----------------------------+"
9 | sbt ++$MATRIX_SCALA test
10 |
11 | # At least verifies that Gatling tests are compiling
12 | sbt ++$MATRIX_SCALA ";project gatling; gatling:compile"
13 |
--------------------------------------------------------------------------------
/play-java-ebean-example/test/TestSuite.java:
--------------------------------------------------------------------------------
1 | import org.junit.runner.RunWith;
2 | import org.junit.runners.Suite;
3 |
4 | @RunWith(Suite.class)
5 | @Suite.SuiteClasses({
6 | ModelTest.class,
7 | FunctionalTest.class,
8 | BrowserTest.class
9 | })
10 | public class TestSuite {
11 | // the class remains empty,
12 | // used only as a holder for the above annotations
13 | }
14 |
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | rootProject.name = "play-java-hello-world-tutorial"
2 |
3 | // TODO: Remove after release Play Gradle Plugin
4 | pluginManagement {
5 | repositories {
6 | gradlePluginPortal()
7 | maven {
8 | url = uri("https://central.sonatype.com/repository/maven-snapshots")
9 | }
10 | mavenLocal()
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/play-java-rest-api-example/app/controllers/HomeController.java:
--------------------------------------------------------------------------------
1 | package controllers;
2 |
3 | import play.mvc.*;
4 |
5 | /**
6 | * This controller contains an action to handle HTTP requests
7 | * to the application's home page.
8 | */
9 | public class HomeController extends Controller {
10 |
11 | public Result index() {
12 | return ok(views.html.index.render());
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/play-scala-anorm-example/app/views/helper/date.scala.html:
--------------------------------------------------------------------------------
1 | @(field: play.api.data.Field, args: (Symbol,Any)*)(implicit handler: FieldConstructor, messages: play.api.i18n.MessagesProvider)
2 |
3 | @inputType = @{ "date" }
4 |
5 | @input(field, args.filter(_._1 != Symbol("type")):_*) { (id, name, value, htmlArgs) =>
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/play-scala-grpc-example/deployment/overlays/my-openshift-cluster/kustomization.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: kustomize.config.k8s.io/v1beta1
3 | kind: Kustomization
4 |
5 | bases:
6 | - ../../base/
7 | resources:
8 | - route.yml
9 |
10 | images:
11 | - name: "play-scala-grpc-example"
12 | newName: "my-docker-registry.mycompany.com/play-scala-grpc-example/play-scala-grpc-example"
13 | newTag: "1.0-SNAPSHOT"
--------------------------------------------------------------------------------
/play-java-dagger2-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-java-ebean-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-java-forms-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-java-grpc-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-java-grpc-example/deployment/overlays/my-openshift-cluster/kustomization.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: kustomize.config.k8s.io/v1beta1
3 | kind: Kustomization
4 |
5 | bases:
6 | - ../../base/
7 | resources:
8 | - route.yml
9 |
10 |
11 | images:
12 | - name: "play-java-grpc-example"
13 | newName: "my-docker-registry.mycompany.com/play-java-grpc-example/play-java-grpc-example"
14 | newTag: "1.0-SNAPSHOT"
--------------------------------------------------------------------------------
/play-java-jpa-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-java-pekko-cluster-example/app/services/CborSerializable.java:
--------------------------------------------------------------------------------
1 | package services;
2 |
3 | /**
4 | * Marker trait for serialization with Jackson CBOR.
5 | * Enabled in serialization.conf `pekko.actor.serialization-bindings` (via application.conf).
6 | *
7 | * See also https://pekko.apache.org/docs/pekko/current/serialization-jackson.html#introduction
8 | */
9 | public interface CborSerializable {
10 | }
11 |
--------------------------------------------------------------------------------
/play-java-starter-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-scala-anorm-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-scala-forms-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-scala-grpc-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-scala-log4j2-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-scala-slick-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-scala-tls-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-java-chatroom-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-java-compile-di-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-java-fileupload-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-java-rest-api-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-java-streaming-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-java-websocket-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-scala-chatroom-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-scala-compile-di-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-scala-fileupload-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-scala-macwire-di-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-scala-rest-api-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-scala-starter-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-scala-streaming-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-scala-websocket-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-java-grpc-example/deployment/base/service.yml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: v1
3 | kind: Service
4 | metadata:
5 | labels:
6 | appName: "play-java-grpc-example"
7 | name: "play-java-grpc-example"
8 | spec:
9 | ports:
10 | - name: http
11 | port: 9000
12 | protocol: TCP
13 | - name: https
14 | port: 9443
15 | protocol: TCP
16 | selector:
17 | appName: "play-java-grpc-example"
18 |
--------------------------------------------------------------------------------
/play-java-streaming-example/conf/application.conf:
--------------------------------------------------------------------------------
1 | # https://www.playframework.com/documentation/latest/SecurityHeaders
2 | # Allow URLs from the same origin to be loaded by frames and scripts
3 | play.filters.headers {
4 | frameOptions = "SAMEORIGIN"
5 | }
6 |
7 | play.filters.enabled += play.filters.csp.CSPFilter
8 |
9 | play.filters.csp.directives {
10 | connect-src = "'self'"
11 | default-src = "'self'"
12 | }
13 |
--------------------------------------------------------------------------------
/play-scala-fileupload-example/app/views/index.scala.html:
--------------------------------------------------------------------------------
1 | @(form: Form[controllers.FormData])(implicit request: MessagesRequestHeader)
2 |
3 | @main("Welcome to Play") {
4 | @helper.form(action = routes.HomeController.upload, Symbol("enctype") -> "multipart/form-data") {
5 | @helper.inputFile(form("name"))
6 | @helper.CSRF.formField
7 |
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/play-scala-grpc-example/deployment/base/service.yml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: v1
3 | kind: Service
4 | metadata:
5 | labels:
6 | appName: "play-scala-grpc-example"
7 | name: "play-scala-grpc-example"
8 | spec:
9 | ports:
10 | - name: http
11 | port: 9000
12 | protocol: TCP
13 | - name: https
14 | port: 9443
15 | protocol: TCP
16 | selector:
17 | appName: "play-scala-grpc-example"
18 |
--------------------------------------------------------------------------------
/play-scala-hello-world-tutorial/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-scala-isolated-slick-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-scala-secure-session-example/NOTICE:
--------------------------------------------------------------------------------
1 | To the extent possible under law, the author(s) have dedicated all copyright and
2 | related and neighboring rights to this software to the public domain worldwide.
3 | This software is distributed without any warranty.
4 |
5 | You should have received a copy of the CC0 Public Domain Dedication along with
6 | this software. If not, see .
7 |
--------------------------------------------------------------------------------
/play-scala-tls-example/scripts/gencerts.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4 |
5 | export PW=`pwgen -Bs 10 1`
6 | echo ${PW} > ${DIR}/password
7 |
8 | ${DIR}/genca.sh
9 | ${DIR}/genclient.sh
10 |
11 | ${DIR}/gen-example.com.sh
12 | ${DIR}/gen-one.example.com.sh
13 | ${DIR}/gen-two.example.com.sh
14 | ${DIR}/gen-wildcard.example.com.sh
15 |
16 | ${DIR}/gentrustanchor.sh
17 |
--------------------------------------------------------------------------------
/play-java-fileupload-example/app/controllers/FormData.java:
--------------------------------------------------------------------------------
1 | package controllers;
2 |
3 | public class FormData {
4 | private String name;
5 |
6 | public FormData() {}
7 |
8 | public FormData(String name) {
9 | this.name = name;
10 | }
11 | public String getName() {
12 | return name;
13 | }
14 | public void setName(String name) {
15 | this.name = name;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionSha256Sum=20f1b1176237254a6fc204d8434196fa11a4cfb387567519c61556e8710aed78
4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
5 | networkTimeout=10000
6 | validateDistributionUrl=true
7 | zipStoreBase=GRADLE_USER_HOME
8 | zipStorePath=wrapper/dists
9 |
--------------------------------------------------------------------------------
/play-scala-isolated-slick-example/app/views/create.scala.html:
--------------------------------------------------------------------------------
1 | @(userForm: Form[UserRequest])(implicit messages: Messages)
2 |
3 | @import views.html.helper._
4 |
5 | @main("Create User") {
6 |
7 | Create a new User
8 |
9 | @form(action = routes.UserController.save) {
10 | @inputText(userForm("email"))
11 | Create
12 | }
13 | }
--------------------------------------------------------------------------------
/play-java-streaming-example/app/views/javaeventsource.scala.html:
--------------------------------------------------------------------------------
1 | @()(implicit request: JRequestHeader)
2 |
3 | @main {
4 | Server Sent Event clock
5 |
6 |
7 |
8 |
9 | Clock events are pushed from the Server using a Server Sent Event connection.
10 |
11 |
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/play-scala-isolated-slick-example/app/views/update.scala.html:
--------------------------------------------------------------------------------
1 | @(userForm: Form[UserRequest])(implicit messages: Messages)
2 |
3 | @import views.html.helper._
4 |
5 | @main("Update User") {
6 |
7 | Update User
8 |
9 | @form(routes.UserController.update(userForm("id").value.get)) {
10 |
11 | @inputText(userForm("email"))
12 |
13 | Update
14 |
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/play-java-streaming-example/app/views/index.scala.html:
--------------------------------------------------------------------------------
1 | @()(implicit request: JRequestHeader)
2 |
3 | @main {
4 |
5 | Comet Clock
6 |
9 |
10 |
11 | Server Sent Event Clock
12 |
15 | }
16 |
--------------------------------------------------------------------------------
/play-scala-secure-session-example/app/Module.scala:
--------------------------------------------------------------------------------
1 | import com.google.inject.AbstractModule
2 | import play.api.libs.concurrent.PekkoGuiceSupport
3 | import services.session.{ ClusterSystem, SessionCache }
4 |
5 | class Module extends AbstractModule with PekkoGuiceSupport {
6 | override def configure(): Unit = {
7 | bind(classOf[ClusterSystem]).asEagerSingleton()
8 | bindTypedActor(SessionCache(), "replicatedCache")
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/play-java-ebean-example/app/models/BaseModel.java:
--------------------------------------------------------------------------------
1 | package models;
2 |
3 | import io.ebean.Model;
4 |
5 | import jakarta.persistence.Id;
6 | import jakarta.persistence.MappedSuperclass;
7 |
8 | @MappedSuperclass
9 | public class BaseModel extends Model {
10 | @Id
11 | private Long id;
12 |
13 | public Long getId() {
14 | return id;
15 | }
16 |
17 | public void setId(Long id) {
18 | this.id = id;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/play-scala-secure-session-example/app/controllers/HomeController.scala:
--------------------------------------------------------------------------------
1 | package controllers
2 |
3 | import javax.inject._
4 |
5 | import play.api.mvc._
6 |
7 | @Singleton
8 | class HomeController @Inject() (
9 | userAction: UserInfoAction,
10 | cc: ControllerComponents
11 | ) extends AbstractController(cc) {
12 |
13 | def index = userAction { implicit request: UserRequest[_] =>
14 | Ok(views.html.index(form))
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/play-scala-streaming-example/app/controllers/HomeController.scala:
--------------------------------------------------------------------------------
1 | package controllers
2 |
3 | import javax.inject.Inject
4 | import play.api.mvc.{AbstractController, Action, AnyContent, ControllerComponents, RequestHeader}
5 |
6 | class HomeController @Inject()(cc: ControllerComponents) extends AbstractController(cc) {
7 |
8 | def index(): Action[AnyContent] = Action { implicit request =>
9 | Ok(views.html.index())
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/play-scala-streaming-example/app/views/index.scala.html:
--------------------------------------------------------------------------------
1 | @()(implicit request: RequestHeader)
2 |
3 | @main {
4 |
5 | Comet Clock
6 |
9 |
10 |
11 | Server Sent Event Clock
12 |
15 | }
16 |
--------------------------------------------------------------------------------
/play-java-websocket-example/app/stocks/StockQuote.java:
--------------------------------------------------------------------------------
1 | package stocks;
2 |
3 | import java.util.Objects;
4 |
5 | import static java.util.Objects.requireNonNull;
6 |
7 | public class StockQuote {
8 | public final String symbol;
9 | public final Double price;
10 |
11 | public StockQuote(String symbol, Double price) {
12 | this.symbol = requireNonNull(symbol);
13 | this.price = requireNonNull(price);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/play-scala-compile-di-example/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | # An example controller showing a sample home page
6 | GET / controllers.HomeController.index
7 |
8 | # Map static resources from the /public folder to the /assets URL path
9 | GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
10 |
--------------------------------------------------------------------------------
/play-scala-grpc-example/deployment/overlays/minikube/kustomization.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: kustomize.config.k8s.io/v1beta1
3 | kind: Kustomization
4 |
5 | bases:
6 | - ../../base/
7 | resources:
8 | - ingress.yml
9 |
10 | ## The minikube kustomization doesn't doe anything because the deployment.yml has all the right defaults.
11 | #images:
12 | #- name: "play-scala-grpc-example"
13 | # newName: "play-scala-grpc-example"
14 | # newTag: "1.0-SNAPSHOT"
--------------------------------------------------------------------------------
/play-java-fileupload-example/app/views/index.scala.html:
--------------------------------------------------------------------------------
1 | @import play.mvc.Http.Request
2 | @(form: Form[controllers.FormData])(implicit request: Request, messages: play.i18n.Messages)
3 |
4 | @main("Welcome to Play") {
5 |
6 | @helper.form(action = routes.HomeController.upload(), Symbol("enctype") -> "multipart/form-data") {
7 | @helper.inputFile(form("name"))
8 | @helper.CSRF.formField
9 |
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/play-scala-secure-session-example/conf/routes:
--------------------------------------------------------------------------------
1 | GET / controllers.HomeController.index
2 |
3 | POST /login controllers.LoginController.login
4 |
5 | POST /logout controllers.LogoutController.logout
6 |
7 |
8 | # Map static resources from the /public folder to the /assets URL path
9 | GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
10 |
--------------------------------------------------------------------------------
/play-scala-macwire-di-example/app/GreetingModule.scala:
--------------------------------------------------------------------------------
1 | import controllers.GreeterController
2 | import play.api.i18n.Langs
3 | import play.api.mvc.ControllerComponents
4 | import services.ServicesModule
5 |
6 | trait GreetingModule extends ServicesModule {
7 |
8 | import com.softwaremill.macwire._
9 |
10 | lazy val greeterController = wire[GreeterController]
11 |
12 | def langs: Langs
13 |
14 | def controllerComponents: ControllerComponents
15 | }
16 |
--------------------------------------------------------------------------------
/play-java-jpa-example/app/views/main.scala.html:
--------------------------------------------------------------------------------
1 | @(title: String)(content: Html)
2 |
3 |
4 |
5 |
6 |
7 | @title
8 |
9 |
10 |
11 |
12 | @content
13 |
14 |
15 |
--------------------------------------------------------------------------------
/play-java-starter-example/app/services/Counter.java:
--------------------------------------------------------------------------------
1 | package services;
2 |
3 | /**
4 | * This interface demonstrates how to create a component that is injected
5 | * into a controller. The interface represents a counter that returns a
6 | * incremented number each time it is called.
7 | *
8 | * The {@link Modules} class binds this interface to the
9 | * {@link AtomicCounter} implementation.
10 | */
11 | public interface Counter {
12 | int nextCount();
13 | }
14 |
--------------------------------------------------------------------------------
/play-java-forms-example/app/views/main.scala.html:
--------------------------------------------------------------------------------
1 | @(title: String)(content: Html)
2 |
3 |
4 |
5 |
6 |
7 | @title
8 |
9 |
10 |
11 |
12 | @content
13 |
14 |
15 |
--------------------------------------------------------------------------------
/play-java-grpc-example/deployment/overlays/minikube/kustomization.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: kustomize.config.k8s.io/v1beta1
3 | kind: Kustomization
4 | resources:
5 | - ../../base/deployment.yml
6 | - ../../base/service.yml
7 | - ingress.yml
8 |
9 | ## The minikube kustomization doesn't doe anything because the deployment.yml has all the right defaults.
10 | #images:
11 | #- name: "play-java-grpc-example"
12 | # newName: "play-java-grpc-example"
13 | # newTag: "1.0-SNAPSHOT"
--------------------------------------------------------------------------------
/play-java-jpa-example/app/views/index.scala.html:
--------------------------------------------------------------------------------
1 | @(implicit request: Http.Request)
2 |
3 | @main("Welcome to Play") {
4 |
5 |
6 |
7 |
8 |
13 | }
14 |
--------------------------------------------------------------------------------
/play-scala-fileupload-example/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | GET / controllers.HomeController.index
6 |
7 | POST /upload controllers.HomeController.upload
8 |
9 | # Map static resources from the /public folder to the /assets URL path
10 | GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
11 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/basic/app/models/Models.scala:
--------------------------------------------------------------------------------
1 | package models
2 |
3 | case class Cat(name: String, color: String)
4 | object Cat {
5 | def unapply(cat: Cat): Option[(String, String)] = Some((cat.name, cat.color))
6 | def tupled = (this.apply _).tupled
7 | }
8 |
9 | case class Dog(name: String, color: String)
10 | object Dog {
11 | def unapply(dog: Dog): Option[(String, String)] = Some((dog.name, dog.color))
12 | def tupled = (this.apply _).tupled
13 | }
14 |
--------------------------------------------------------------------------------
/play-java-dagger2-example/conf/routes:
--------------------------------------------------------------------------------
1 | GET / controllers.TimeController.index(request:Request)
2 | POST / controllers.TimeController.indexPost(request:Request)
3 |
4 | GET /ws controllers.TimeController.ws(request:Request)
5 | GET /now controllers.TimeController.now
6 |
7 | # Map static resources from the /public folder to the /assets URL path
8 | GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
9 |
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | [versions]
2 | twirl = "2.0.9"
3 | play = "3.0.9"
4 | junit = "4.13.2"
5 |
6 | [libraries]
7 | junit = { group = "junit", name = "junit", version.ref = "junit" }
8 | play-bom = { group = "org.playframework", name = "play-bom_3", version.ref = "play" }
9 |
10 | [plugins]
11 | twirl = { id = "org.playframework.twirl", version.ref = "twirl" }
12 | play = { id = "org.playframework.play", version = "3.1.0-M2-573139bb-SNAPSHOT" }
13 |
--------------------------------------------------------------------------------
/play-scala-compile-di-example/app/views/index.scala.html:
--------------------------------------------------------------------------------
1 | @*
2 | * This template takes a single argument, a String containing a
3 | * message to display.
4 | *@
5 | @(message: String)
6 |
7 | @*
8 | * Call the `main` template with two arguments. The first
9 | * argument is a `String` with the title of the page, the second
10 | * argument is an `Html` object containing the body of the page.
11 | *@
12 | @main("Welcome to Play") {
13 | Your message is: @message
14 | }
15 |
--------------------------------------------------------------------------------
/play-scala-fileupload-example/conf/application.conf:
--------------------------------------------------------------------------------
1 | # https://www.playframework.com/documentation/latest/Configuration
2 |
3 | # Sets the maximum file size that can be uploaded to 1024k.
4 | # https://www.playframework.com/documentation/latest/ScalaBodyParsers#Max-content-length
5 | play.http.parser.maxMemoryBuffer=1024k
6 |
7 | # For upload large file
8 | # https://www.playframework.com/documentation/latest/ScalaBodyParsers#Max-content-length
9 | play.http.parser.maxDiskBuffer=1g
10 |
--------------------------------------------------------------------------------
/play-scala-macwire-di-example/conf/routes:
--------------------------------------------------------------------------------
1 |
2 | GET / controllers.GreeterController.index
3 | GET /greetings controllers.GreeterController.greetings
4 | GET /greet controllers.GreeterController.greetInMyLanguage
5 |
6 | GET /assets/*file controllers.Assets.at(path="/public", file)
7 | GET /favicon.ico controllers.Assets.at(path="/images", file ="favicon.png")
8 |
--------------------------------------------------------------------------------
/play-java-grpc-example/app/protobuf/helloworld.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | option java_multiple_files = true;
4 | option java_package = "example.myapp.helloworld.grpc";
5 | option java_outer_classname = "HelloWorldProto";
6 |
7 | package helloworld;
8 |
9 | service GreeterService {
10 | rpc SayHello (HelloRequest) returns (HelloReply) {}
11 | }
12 |
13 | message HelloRequest {
14 | string name = 1;
15 | }
16 |
17 | message HelloReply {
18 | string message = 1;
19 | }
20 |
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/build.sbt:
--------------------------------------------------------------------------------
1 | name := """play-java-hello-world-tutorial"""
2 | organization := "com.example"
3 |
4 | version := "1.0-SNAPSHOT"
5 |
6 | lazy val root = (project in file(".")).enablePlugins(PlayJava)
7 | //.enablePlugins(PlayNettyServer).disablePlugins(PlayPekkoHttpServer) // uncomment to use the Netty backend
8 |
9 | crossScalaVersions := Seq("2.13.16", "3.3.6")
10 |
11 | scalaVersion := crossScalaVersions.value.head
12 |
13 | libraryDependencies += guice
14 |
--------------------------------------------------------------------------------
/play-scala-compile-di-example/test/SeleniumSpec.scala:
--------------------------------------------------------------------------------
1 | import org.scalatestplus.play._
2 |
3 | class SeleniumSpec extends PlaySpec
4 | with BaseOneServerPerTest
5 | with OneBrowserPerTest
6 | with MyApplicationFactory
7 | with HtmlUnitFactory {
8 |
9 | "SeleniumSpec" should {
10 |
11 | "work from within a browser" in {
12 |
13 | go to ("http://localhost:" + port)
14 |
15 | pageSource must include("Your new application is ready.")
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/play-scala-grpc-example/app/protobuf/helloworld.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | option java_multiple_files = true;
4 | option java_package = "example.myapp.helloworld.grpc";
5 | option java_outer_classname = "HelloWorldProto";
6 |
7 | package helloworld;
8 |
9 | service GreeterService {
10 | rpc SayHello (HelloRequest) returns (HelloReply) {}
11 | }
12 |
13 | message HelloRequest {
14 | string name = 1;
15 | }
16 |
17 | message HelloReply {
18 | string message = 1;
19 | }
20 |
--------------------------------------------------------------------------------
/play-scala-isolated-slick-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | libraryDependencies += "com.h2database" % "h2" % "2.3.232"
2 |
3 | // Database migration
4 | // https://github.com/flyway/flyway-sbt
5 | addSbtPlugin("com.github.sbt" % "flyway-sbt" % "10.21.0")
6 |
7 | // Slick code generation
8 | // https://github.com/tototoshi/sbt-slick-codegen
9 | addSbtPlugin("com.github.tototoshi" % "sbt-slick-codegen" % "2.2.0")
10 |
11 | // The Play plugin
12 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
13 |
--------------------------------------------------------------------------------
/play-scala-macwire-di-example/test/SeleniumSpec.scala:
--------------------------------------------------------------------------------
1 | import org.scalatestplus.play._
2 |
3 | class SeleniumSpec
4 | extends PlaySpec
5 | with BaseOneServerPerTest
6 | with OneBrowserPerTest
7 | with GreeterApplicationFactory
8 | with HtmlUnitFactory {
9 |
10 | "SeleniumSpec" should {
11 |
12 | "work from within a browser" in {
13 |
14 | go to ("http://localhost:" + port)
15 |
16 | pageSource must include ("Your new application is ready.")
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/play-scala-streaming-example/conf/application.conf:
--------------------------------------------------------------------------------
1 | # https://www.playframework.com/documentation/latest/Configuration
2 |
3 | # https://www.playframework.com/documentation/latest/SecurityHeaders
4 | # Allow URLs from the same origin to be loaded by frames and scripts
5 | play.filters.headers {
6 | frameOptions = "SAMEORIGIN"
7 | }
8 |
9 | play.filters.enabled += play.filters.csp.CSPFilter
10 |
11 | play.filters.csp.directives {
12 | connect-src = "'self'"
13 | default-src = "'self'"
14 | }
15 |
--------------------------------------------------------------------------------
/play-java-jpa-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | // The Play plugin
2 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
3 |
4 | // Web plugins
5 | addSbtPlugin("com.github.sbt" % "sbt-coffeescript" % "2.0.1")
6 | addSbtPlugin("com.github.sbt" % "sbt-less" % "2.0.1")
7 | addSbtPlugin("com.github.sbt" % "sbt-jshint" % "2.0.1")
8 | addSbtPlugin("com.github.sbt" % "sbt-rjs" % "2.0.0")
9 | addSbtPlugin("com.github.sbt" % "sbt-digest" % "2.1.0")
10 | addSbtPlugin("com.github.sbt" % "sbt-mocha" % "2.1.0")
11 |
--------------------------------------------------------------------------------
/play-java-streaming-example/app/views/javacomet.scala.html:
--------------------------------------------------------------------------------
1 | @()(implicit request: JRequestHeader)
2 |
3 | @main {
4 |
5 | Comet clock
6 |
7 |
8 |
9 |
10 | Clock events are pushed from the Server using a Comet connection.
11 |
12 |
13 |
14 |
15 |
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/computer-database/conf/evolutions/default/1.sql:
--------------------------------------------------------------------------------
1 | # --- !Ups
2 |
3 | CREATE TABLE "COMPANY" ("ID" BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,"NAME" VARCHAR NOT NULL);
4 | CREATE TABLE "COMPUTER" ("ID" BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,"NAME" VARCHAR NOT NULL,"INTRODUCED" BIGINT,"DISCONTINUED" BIGINT,"COMPANY_ID" BIGINT);
5 |
6 | # --- !Downs
7 |
8 | DROP TABLE "COMPUTER";
9 | DROP TABLE "COMPANY";
10 |
11 |
--------------------------------------------------------------------------------
/play-scala-log4j2-example/conf/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/play-java-jpa-example/app/models/PersonRepository.java:
--------------------------------------------------------------------------------
1 | package models;
2 |
3 | import com.google.inject.ImplementedBy;
4 |
5 | import java.util.concurrent.CompletionStage;
6 | import java.util.stream.Stream;
7 |
8 | /**
9 | * This interface provides a non-blocking API for possibly blocking operations.
10 | */
11 | @ImplementedBy(JPAPersonRepository.class)
12 | public interface PersonRepository {
13 |
14 | CompletionStage add(Person person);
15 |
16 | CompletionStage> list();
17 | }
18 |
--------------------------------------------------------------------------------
/play-scala-rest-api-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | // The Play plugin
2 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
3 |
4 | // sbt-paradox, used for documentation
5 | addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.10.7")
6 |
7 | // Load testing tool:
8 | // https://gatling.io/docs/gatling/reference/current/extensions/sbt_plugin/
9 | addSbtPlugin("io.gatling" % "gatling-sbt" % "4.16.1")
10 |
11 | // Scala formatting: "sbt scalafmt"
12 | addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.16")
13 |
--------------------------------------------------------------------------------
/play-java-rest-api-example/app/v1/post/PostRepository.java:
--------------------------------------------------------------------------------
1 | package v1.post;
2 |
3 | import java.util.Optional;
4 | import java.util.concurrent.CompletionStage;
5 | import java.util.stream.Stream;
6 |
7 | public interface PostRepository {
8 |
9 | CompletionStage> list();
10 |
11 | CompletionStage create(PostData postData);
12 |
13 | CompletionStage> get(Long id);
14 |
15 | CompletionStage> update(Long id, PostData postData);
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/play-scala-anorm-example/app/models/DatabaseExecutionContext.scala:
--------------------------------------------------------------------------------
1 | package models
2 |
3 | import javax.inject._
4 |
5 | import org.apache.pekko.actor.ActorSystem
6 | import play.api.libs.concurrent.CustomExecutionContext
7 |
8 | /**
9 | * This class is a pointer to an execution context configured to point to "database.dispatcher"
10 | * in the "application.conf" file.
11 | */
12 | @Singleton
13 | class DatabaseExecutionContext @Inject()(system: ActorSystem) extends CustomExecutionContext(system, "database.dispatcher")
14 |
--------------------------------------------------------------------------------
/play-java-pekko-cluster-example/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | # An example controller showing a sample home page
6 | GET / controllers.HomeController.index
7 | GET /increment controllers.HomeController.increment
8 |
9 | # Map static resources from the /public folder to the /assets URL path
10 | GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
11 |
--------------------------------------------------------------------------------
/play-scala-compile-di-example/test/MyApplicationFactory.scala:
--------------------------------------------------------------------------------
1 | import java.io.File
2 |
3 | import org.scalatestplus.play.FakeApplicationFactory
4 | import play.api._
5 | import play.api.inject._
6 |
7 | trait MyApplicationFactory extends FakeApplicationFactory {
8 |
9 | override def fakeApplication(): Application = {
10 | val env = Environment.simple(new File("."))
11 | val context = ApplicationLoader.Context.create(env)
12 | val loader = new MyApplicationLoader()
13 | loader.load(context)
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/play-scala-log4j2-example/app/views/index.scala.html:
--------------------------------------------------------------------------------
1 | @*
2 | * This template takes a single argument, a String containing a
3 | * message to display.
4 | *@
5 | @(message: String)
6 |
7 | @*
8 | * Call the the `main` template with two arguments. The first
9 | * argument is a `String` with the title of the page, the second
10 | * argument is an `Html` object containing the body of the page.
11 | *@
12 | @main("Welcome to Play") {
13 | Welcome to PlayFramework!
14 | Your new application is ready.
15 | }
16 |
--------------------------------------------------------------------------------
/play-scala-tls-example/conf/application.conf:
--------------------------------------------------------------------------------
1 | # See http://www.playframework.com/documentation/latest/ApplicationSecret for more details.
2 | play.http.secret.key="my super secret secret which is long enough"
3 | play.http.secret.key=${?APPLICATION_SECRET}
4 |
5 | play.http.requestHandler = "router.MultiSiteRequestHandler"
6 |
7 | play.server.https.engineProvider=https.CustomSSLEngineProvider
8 |
9 | play.server.https.port = 9443
10 |
11 | // Allow example.com and subdomains
12 | play.filters.hosts.allowed = [".example.com"]
13 |
14 |
--------------------------------------------------------------------------------
/play-java-rest-api-example/app/v1/post/PostExecutionContext.java:
--------------------------------------------------------------------------------
1 | package v1.post;
2 |
3 | import org.apache.pekko.actor.ActorSystem;
4 | import play.libs.concurrent.CustomExecutionContext;
5 |
6 | import javax.inject.Inject;
7 |
8 | /**
9 | * Custom execution context wired to "post.repository" thread pool
10 | */
11 | public class PostExecutionContext extends CustomExecutionContext {
12 |
13 | @Inject
14 | public PostExecutionContext(ActorSystem actorSystem) {
15 | super(actorSystem, "post.repository");
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/play-java-forms-example/app/models/Widget.java:
--------------------------------------------------------------------------------
1 | package models;
2 |
3 | /**
4 | * Presentation object used for displaying data in a template.
5 | *
6 | * Note that it's a good practice to keep the presentation DTO,
7 | * which are used for reads, distinct from the form processing DTO,
8 | * which are used for writes.
9 | */
10 | public class Widget {
11 | public String name;
12 | public int price;
13 |
14 | public Widget(String name, int price) {
15 | this.name = name;
16 | this.price = price;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/play-scala-tls-example/conf/ws.conf:
--------------------------------------------------------------------------------
1 | play.ws.ssl {
2 |
3 | keyManager = {
4 | stores = [
5 | // Note: must be run from ./play, which loads the KEY_PASSWORD environment variable.
6 | { type: "PKCS12", path: "scripts/client.p12", password: ${?KEY_PASSWORD} },
7 | ]
8 | }
9 |
10 | trustManager = {
11 | stores = [
12 | // Note: must be run from ./play, which loads the KEY_PASSWORD environment variable.
13 | { type = "PKCS12", path = "scripts/exampletrust.p12", password: "changeit" }
14 | ]
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/play-java-jpa-example/app/models/DatabaseExecutionContext.java:
--------------------------------------------------------------------------------
1 | package models;
2 |
3 | import org.apache.pekko.actor.ActorSystem;
4 | import play.libs.concurrent.CustomExecutionContext;
5 |
6 | import javax.inject.Inject;
7 |
8 | /**
9 | * Custom execution context wired to "database.dispatcher" thread pool
10 | */
11 | public class DatabaseExecutionContext extends CustomExecutionContext {
12 | @Inject
13 | public DatabaseExecutionContext(ActorSystem actorSystem) {
14 | super(actorSystem, "database.dispatcher");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: "github-actions"
4 | directory: "/"
5 | schedule:
6 | interval: "weekly"
7 | commit-message:
8 | prefix: "[3.0.x] "
9 | - package-ecosystem: "github-actions"
10 | directory: "/"
11 | schedule:
12 | interval: "weekly"
13 | target-branch: "main"
14 | - package-ecosystem: "github-actions"
15 | directory: "/"
16 | schedule:
17 | interval: "weekly"
18 | target-branch: "2.9.x"
19 | commit-message:
20 | prefix: "[2.9.x] "
21 |
--------------------------------------------------------------------------------
/play-java-fileupload-example/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | # An example controller showing a sample home page
6 | GET / controllers.HomeController.index(request: Request)
7 |
8 | POST /upload controllers.HomeController.upload(request:Request)
9 |
10 | # Map static resources from the /public folder to the /assets URL path
11 | GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
12 |
--------------------------------------------------------------------------------
/play-java-grpc-example/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | # An example controller showing a sample home page
6 | GET / controllers.HomeController.index
7 |
8 | # ---- gRPC services ----
9 | -> / routers.HelloWorldRouter
10 | # ---- end of gRPC services ----
11 |
12 | # Map static resources from the /public folder to the /assets URL path
13 | GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
14 |
--------------------------------------------------------------------------------
/play-java-streaming-example/public/javascripts/eventsource.js:
--------------------------------------------------------------------------------
1 | if (!!window.EventSource) {
2 | var stringSource = new EventSource(jsRoutes.controllers.JavaEventSourceController.streamClock().url);
3 | stringSource.addEventListener('message', function(e) {
4 | $('#clock').html(e.data.replace(/(\d)/g, '$1 '))
5 | });
6 | } else {
7 | $("#clock").html("Sorry. This browser doesn't seem to support Server sent event. Check html5test for browser compatibility.");
8 | }
9 |
--------------------------------------------------------------------------------
/play-scala-chatroom-example/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | # An example controller showing a sample home page
6 | GET / controllers.HomeController.index()
7 | GET /chat controllers.HomeController.chat()
8 |
9 | # Map static resources from the /public folder to the /assets URL path
10 | GET /assets/*file controllers.Assets.at(path="/public", file)
11 |
12 | -> /webjars webjars.Routes
13 |
--------------------------------------------------------------------------------
/play-scala-grpc-example/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | # An example controller showing a sample home page
6 | GET / controllers.HomeController.index
7 |
8 | # ---- gRPC services ----
9 | -> / routers.HelloWorldRouter
10 | # ---- end of gRPC services ----
11 |
12 | # Map static resources from the /public folder to the /assets URL path
13 | GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
14 |
--------------------------------------------------------------------------------
/play-java-jpa-example/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | # Home page
6 | GET / controllers.PersonController.index(req: Request)
7 | POST /person controllers.PersonController.addPerson(req: Request)
8 | GET /persons controllers.PersonController.getPersons()
9 |
10 | # Map static resources from the /public folder to the /assets URL path
11 | GET /assets/*file controllers.Assets.at(path="/public", file)
12 |
--------------------------------------------------------------------------------
/play-java-rest-api-example/app/v1/post/PostData.java:
--------------------------------------------------------------------------------
1 | package v1.post;
2 |
3 | import jakarta.persistence.*;
4 |
5 | /**
6 | * Data returned from the database
7 | */
8 | @Entity
9 | @Table(name = "posts")
10 | public class PostData {
11 |
12 | public PostData() {
13 | }
14 |
15 | public PostData(String title, String body) {
16 | this.title = title;
17 | this.body = body;
18 | }
19 |
20 | @Id
21 | @GeneratedValue(strategy= GenerationType.AUTO)
22 | public Long id;
23 | public String title;
24 | public String body;
25 | }
26 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/basic/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | # Home page
6 | GET / controllers.Application.index
7 |
8 | # Home page
9 | POST /insert/cat controllers.Application.insertCat
10 | POST /insert/dog controllers.Application.insertDog
11 |
12 |
13 | # Map static resources from the /public folder to the /assets URL path
14 | GET /assets/*file controllers.Assets.at(path="/public", file)
15 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/computer-database/app/views/twitterBootstrapInput.scala.html:
--------------------------------------------------------------------------------
1 | @(elements: helper.FieldElements)
2 |
3 | @**************************************************
4 | * Generate input according twitter bootstrap rules *
5 | **************************************************@
6 |
7 |
@elements.label
8 |
9 | @elements.input
10 | @elements.infos.mkString(", ")
11 |
12 |
13 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/person/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | # Home page
6 | GET / controllers.PersonController.index
7 | POST /person controllers.PersonController.addPerson
8 | GET /persons controllers.PersonController.getPersons
9 |
10 | # Map static resources from the /public folder to the /assets URL path
11 | GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
12 |
--------------------------------------------------------------------------------
/play-java-chatroom-example/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | # An example controller showing a sample home page
6 | GET / controllers.HomeController.index(request: Request)
7 | GET /chat controllers.HomeController.chat
8 |
9 | # Map static resources from the /public folder to the /assets URL path
10 | GET /assets/*file controllers.Assets.at(path="/public", file)
11 |
12 | -> /webjars webjars.Routes
13 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/basic/app/views/main.scala.html:
--------------------------------------------------------------------------------
1 | @(title: String)(content: Html)
2 |
3 |
4 |
5 |
6 |
7 | @title
8 |
9 |
10 |
11 |
12 |
13 | @content
14 |
15 |
16 |
--------------------------------------------------------------------------------
/play-scala-forms-example/app/views/main.scala.html:
--------------------------------------------------------------------------------
1 | @(title: String)(content: Html)
2 |
3 |
4 |
5 |
6 |
7 | @title
8 |
9 |
10 |
11 |
12 |
13 | @content
14 |
15 |
16 |
--------------------------------------------------------------------------------
/play-scala-forms-example/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | # Home page
6 | GET / controllers.WidgetController.index
7 |
8 | # Widgets
9 | GET /widgets controllers.WidgetController.listWidgets
10 | POST /widgets controllers.WidgetController.createWidget
11 |
12 | # Map static resources from the /public folder to the /assets URL path
13 | GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
14 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/person/app/views/index.scala.html:
--------------------------------------------------------------------------------
1 | @(person: Form[CreatePersonForm])(implicit request: MessagesRequestHeader)
2 |
3 | @import helper._
4 |
5 | @request.flash.get("success").map { key =>
6 | @request.messages(key)
7 | }
8 |
9 | @main("Welcome to Play") {
10 | @form(routes.PersonController.addPerson) {
11 | @inputText(person("name"))
12 | @inputText(person("age"))
13 | @CSRF.formField
14 |
15 |
16 |
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/play-scala-websocket-example/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | GET / controllers.HomeController.index
6 | GET /ws controllers.HomeController.ws
7 | GET /sentiment/:symbol controllers.StockSentiment.get(symbol)
8 |
9 | # Map static resources from the /public folder to the /assets URL path
10 | GET /assets/*file controllers.Assets.at(path="/public", file)
11 |
12 | -> /webjars webjars.Routes
13 |
--------------------------------------------------------------------------------
/play-java-ebean-example/app/models/Company.java:
--------------------------------------------------------------------------------
1 | package models;
2 |
3 | import play.data.validation.Constraints;
4 |
5 | import jakarta.persistence.Entity;
6 |
7 |
8 |
9 | /**
10 | * Company entity managed by Ebean
11 | */
12 | @Entity
13 | public class Company extends BaseModel {
14 |
15 | private static final long serialVersionUID = 1L;
16 |
17 | @Constraints.Required
18 | private String name;
19 |
20 | public String getName() {
21 | return name;
22 | }
23 |
24 | public void setName(String name) {
25 | this.name = name;
26 | }
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/play-java-grpc-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | enablePlugins(BuildInfoPlugin)
2 | val playGrpcV = "0.12.2"
3 | buildInfoKeys := Seq[BuildInfoKey]("playGrpcVersion" -> playGrpcV)
4 | buildInfoPackage := "play.java.grpc.sample"
5 |
6 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
7 |
8 | addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.10.7")
9 |
10 | // #grpc_sbt_plugin
11 | // project/plugins.sbt
12 | addSbtPlugin("org.apache.pekko" % "pekko-grpc-sbt-plugin" % "1.0.2")
13 | libraryDependencies += "org.playframework" %% "play-grpc-generators" % playGrpcV
14 | // #grpc_sbt_plugin
15 |
--------------------------------------------------------------------------------
/play-java-jpa-example/app/models/Person.java:
--------------------------------------------------------------------------------
1 | package models;
2 |
3 | import jakarta.persistence.*;
4 |
5 | @Entity
6 | public class Person {
7 |
8 | @Id
9 | @GeneratedValue(strategy = GenerationType.AUTO)
10 | public Long id;
11 |
12 | public String name;
13 |
14 | public Long getId() {
15 | return id;
16 | }
17 |
18 | public void setId(Long id) {
19 | this.id = id;
20 | }
21 |
22 | public String getName() {
23 | return name;
24 | }
25 |
26 | public void setName(String name) {
27 | this.name = name;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/play-java-websocket-example/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | GET / controllers.HomeController.index(request :Request)
6 | GET /ws controllers.HomeController.ws
7 | GET /sentiment/:symbol controllers.StockSentiment.get(symbol)
8 |
9 | # Map static resources from the /public folder to the /assets URL path
10 | GET /assets/*file controllers.Assets.at(path="/public", file)
11 |
12 | -> /webjars webjars.Routes
13 |
--------------------------------------------------------------------------------
/play-scala-chatroom-example/conf/application.conf:
--------------------------------------------------------------------------------
1 | // Enable richer pekko logging
2 | pekko {
3 | loggers = ["org.apache.pekko.event.slf4j.Slf4jLogger"]
4 | loglevel = "DEBUG"
5 | logging-filter = "org.apache.pekko.event.slf4j.Slf4jLoggingFilter"
6 | }
7 |
8 | // https://www.playframework.com/documentation/latest/AllowedHostsFilter
9 | play.filters.hosts.allowed = ["localhost:9000", "localhost:19001"]
10 |
11 | // Add CSP header in explicitly in a custom filter.
12 | play.filters.enabled += filters.ContentSecurityPolicyFilter
13 |
14 | play.modules.enabled += controllers.InputSanitizerModule
15 |
--------------------------------------------------------------------------------
/play-scala-tls-example/scripts/gentrustanchor.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | export PW=`cat password`
4 |
5 | # Create a PKCS12 keystore that trusts the example CA, with the default password.
6 | # This is used by the client in the trustmanager section.
7 | keytool -import -v \
8 | -alias exampleca \
9 | -file exampleca.crt \
10 | -keypass:env PW \
11 | -storepass changeit \
12 | -storetype PKCS12 \
13 | -keystore exampletrust.p12 << EOF
14 | yes
15 | EOF
16 |
17 | # List out the details of the store password.
18 | keytool -list -v \
19 | -keystore exampletrust.p12 \
20 | -storepass changeit
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | # An example controller showing a sample home page
6 | GET / controllers.HomeController.index
7 | GET /explore controllers.HomeController.explore
8 | GET /tutorial controllers.HomeController.tutorial
9 |
10 |
11 | # Map static resources from the /public folder to the /assets URL path
12 | GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
13 |
--------------------------------------------------------------------------------
/play-java-hello-world-tutorial/public/images/play_icon_reverse.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-scala-grpc-example/project/plugins.sbt:
--------------------------------------------------------------------------------
1 | enablePlugins(BuildInfoPlugin)
2 | val playGrpcV = "0.12.2"
3 | buildInfoKeys := Seq[BuildInfoKey]("playGrpcVersion" -> playGrpcV)
4 | buildInfoPackage := "play.scala.grpc.sample"
5 |
6 |
7 | addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.9")
8 |
9 | addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.10.7")
10 |
11 | // #grpc_sbt_plugin
12 | // project/plugins.sbt
13 | addSbtPlugin("org.apache.pekko" % "pekko-grpc-sbt-plugin" % "1.0.2")
14 | libraryDependencies += "org.playframework" %% "play-grpc-generators" % playGrpcV
15 | // #grpc_sbt_plugin
16 |
--------------------------------------------------------------------------------
/play-scala-hello-world-tutorial/public/images/play_icon_reverse.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/play-scala-isolated-slick-example/app/views/main.scala.html:
--------------------------------------------------------------------------------
1 | @(title: String)(content: Html)
2 |
3 |
4 |
5 |
6 |
7 | @title
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | @content
16 |
17 |
18 |
--------------------------------------------------------------------------------
/play-java-chatroom-example/conf/application.conf:
--------------------------------------------------------------------------------
1 | // Enable richer pekko logging
2 | pekko {
3 | loggers = ["org.apache.pekko.event.slf4j.Slf4jLogger"]
4 | loglevel = "DEBUG"
5 | logging-filter = "org.apache.pekko.event.slf4j.Slf4jLoggingFilter"
6 | }
7 |
8 | // https://www.playframework.com/documentation/latest/AllowedHostsFilter
9 | play.filters.hosts.allowed = ["localhost:9000", "localhost:19001"]
10 |
11 | // Add CSP header in explicitly in a custom filter.
12 | play.filters.enabled += filters.ContentSecurityPolicyFilter
13 |
14 | play.http.secret.key = a-long-secret-to-calm-the-rage-of-the-entropy-gods
15 |
--------------------------------------------------------------------------------
/play-scala-streaming-example/app/views/main.scala.html:
--------------------------------------------------------------------------------
1 | @(content: Html)(implicit request: RequestHeader)
2 |
3 |
4 |
5 |
6 |
7 | EventSource clock
8 |
9 |
10 |
11 |
12 |
13 | @content
14 |
15 |
16 |
--------------------------------------------------------------------------------
/play-java-forms-example/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | # Home page
6 | GET / controllers.WidgetController.index
7 |
8 | # Widgets
9 | GET /widgets controllers.WidgetController.listWidgets(request: Request)
10 | POST /widgets controllers.WidgetController.createWidget(request: Request)
11 |
12 | # Map static resources from the /public folder to the /assets URL path
13 | GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
14 |
--------------------------------------------------------------------------------
/play-scala-chatroom-example/app/controllers/InputSanitizer.scala:
--------------------------------------------------------------------------------
1 | package controllers
2 |
3 | import org.jsoup.Jsoup
4 | import org.jsoup.safety.Safelist
5 | import play.api.inject._
6 |
7 | /**
8 | * To provide sanitization for chat messages.
9 | */
10 | trait InputSanitizer {
11 | def sanitize(input: String): String
12 | }
13 |
14 | class JSoupInputSanitizer extends InputSanitizer {
15 | override def sanitize(input: String): String = {
16 | Jsoup.clean(input, Safelist.basic())
17 | }
18 | }
19 |
20 | class InputSanitizerModule extends SimpleModule(
21 | bind[InputSanitizer].to[JSoupInputSanitizer]
22 | )
23 |
--------------------------------------------------------------------------------
/play-scala-grpc-example/app/Module.scala:
--------------------------------------------------------------------------------
1 | import com.google.inject.AbstractModule
2 |
3 | /**
4 | * This class is a Guice module that tells Guice how to bind several
5 | * different types. This Guice module is created when the Play
6 | * application starts.
7 | *
8 | * Play will automatically use any class called `Module` that is in
9 | * the root package. You can create modules in other locations by
10 | * adding `play.modules.enabled` settings to the `application.conf`
11 | * configuration file.
12 | */
13 | class Module extends AbstractModule {
14 |
15 | override def configure(): Unit = {
16 |
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/play-java-fileupload-example/build.sbt:
--------------------------------------------------------------------------------
1 | lazy val root = (project in file("."))
2 | .enablePlugins(PlayJava)
3 | //.enablePlugins(PlayNettyServer).disablePlugins(PlayPekkoHttpServer) // uncomment to use the Netty backend
4 | .settings(
5 | name := """play-java-fileupload-example""",
6 | version := "1.0-SNAPSHOT",
7 | crossScalaVersions := Seq("2.13.16", "3.3.6"),
8 | scalaVersion := crossScalaVersions.value.head,
9 | libraryDependencies += guice,
10 | testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-v"),
11 | javacOptions ++= Seq("-Xlint:unchecked", "-Xlint:deprecation", "-Werror")
12 | )
13 |
--------------------------------------------------------------------------------
/play-scala-starter-example/test/BrowserSpec.scala:
--------------------------------------------------------------------------------
1 | import org.scalatestplus.play._
2 | import org.scalatestplus.play.guice.GuiceOneServerPerTest
3 |
4 | /**
5 | * Runs a browser test using Fluentium against a play application on a server port.
6 | */
7 | class BrowserSpec extends PlaySpec
8 | with OneBrowserPerTest
9 | with GuiceOneServerPerTest
10 | with HtmlUnitFactory
11 | with ServerProvider {
12 |
13 | "Application" should {
14 |
15 | "work from within a browser" in {
16 |
17 | go to ("http://localhost:" + port)
18 |
19 | pageSource must include ("Your new application is ready.")
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/play-scala-log4j2-example/test/IntegrationSpec.scala:
--------------------------------------------------------------------------------
1 | import org.scalatestplus.play._
2 | import org.scalatestplus.play.guice.GuiceOneServerPerTest
3 |
4 | /**
5 | * add your integration spec here.
6 | * An integration test will fire up a whole play application in a real (or headless) browser
7 | */
8 | class IntegrationSpec extends PlaySpec with GuiceOneServerPerTest with OneBrowserPerTest with HtmlUnitFactory {
9 |
10 | "Application" should {
11 |
12 | "work from within a browser" in {
13 |
14 | go to ("http://localhost:" + port)
15 |
16 | pageSource must include ("Your new application is ready.")
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/play-scala-rest-api-example/app/Module.scala:
--------------------------------------------------------------------------------
1 | import javax.inject._
2 |
3 | import com.google.inject.AbstractModule
4 | import net.codingwell.scalaguice.ScalaModule
5 | import play.api.{Configuration, Environment}
6 | import v1.post._
7 |
8 | /**
9 | * Sets up custom components for Play.
10 | *
11 | * https://www.playframework.com/documentation/latest/ScalaDependencyInjection
12 | */
13 | class Module(environment: Environment, configuration: Configuration)
14 | extends AbstractModule
15 | with ScalaModule {
16 |
17 | override def configure() = {
18 | bind[PostRepository].to[PostRepositoryImpl].in[Singleton]()
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/play-scala-tls-example/scripts/client.csr:
--------------------------------------------------------------------------------
1 | -----BEGIN NEW CERTIFICATE REQUEST-----
2 | MIIBajCCAQ0CAQAwezELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWEx
3 | FjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xGDAWBgNVBAoTD0V4YW1wbGUgQ29tcGFu
4 | eTEUMBIGA1UECxMLRXhhbXBsZSBPcmcxDzANBgNVBAMTBmNsaWVudDBZMBMGByqG
5 | SM49AgEGCCqGSM49AwEHA0IABBqoe79k89+zgHC4Wa4VM2R1kQSvFQRP5GoLyQms
6 | aYuvDj07/Wn9edaS8w8lNS8L0cDYgyNczceMwoa+npQV6LWgMDAuBgkqhkiG9w0B
7 | CQ4xITAfMB0GA1UdDgQWBBTDmCLRFpOoYkkuLDqdKdqMP8Y3uDAMBggqhkjOPQQD
8 | AgUAA0kAMEYCIQCyQLkVa8yjp4WzzlsME7N0Xo6+kwL9atpInBQ7iEETlQIhAIwe
9 | VcoPuh4IziDxWDRmFwUiHRkpMvLoW1kC43YwOeFr
10 | -----END NEW CERTIFICATE REQUEST-----
11 |
--------------------------------------------------------------------------------
/play-scala-tls-example/scripts/example.com.csr:
--------------------------------------------------------------------------------
1 | -----BEGIN NEW CERTIFICATE REQUEST-----
2 | MIIBbzCCARMCAQAwgYAxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlh
3 | MRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMRgwFgYDVQQKEw9FeGFtcGxlIENvbXBh
4 | bnkxFDASBgNVBAsTC0V4YW1wbGUgT3JnMRQwEgYDVQQDEwtleGFtcGxlLmNvbTBZ
5 | MBMGByqGSM49AgEGCCqGSM49AwEHA0IABOL80x+EpQC+pL7n4VuD6Wz3GNNP3c/k
6 | g+uFdJtCIMthPsQ+/Xg+Ta2ZXgv94V+w/0nyaC/d0N7KSrciLIMZmeqgMDAuBgkq
7 | hkiG9w0BCQ4xITAfMB0GA1UdDgQWBBRFjEpuBU2phJis7ZH60e+gJoaxoTAMBggq
8 | hkjOPQQDAgUAA0gAMEUCIHq/4SmQwvgK2gOZ4JjDttfWaZKI5j0ux1DdpBg2K5xY
9 | AiEAsXcaxDz8gAf3ozbNTl9diByJwXWDPfF0NngN9wlh8eY=
10 | -----END NEW CERTIFICATE REQUEST-----
11 |
--------------------------------------------------------------------------------
/play-scala-tls-example/scripts/one.example.com.csr:
--------------------------------------------------------------------------------
1 | -----BEGIN NEW CERTIFICATE REQUEST-----
2 | MIIBcjCCARcCAQAwgYQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlh
3 | MRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMRgwFgYDVQQKEw9FeGFtcGxlIENvbXBh
4 | bnkxFDASBgNVBAsTC0V4YW1wbGUgT3JnMRgwFgYDVQQDEw9vbmUuZXhhbXBsZS5j
5 | b20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQccBL7oo2DdYd+NQEuFqN0vsOr
6 | Ps8DmntUouhI5j0HaB9h9qEkpgdVhe/S7mQnQVfUNSzbElZM36n3rk8nGqdBoDAw
7 | LgYJKoZIhvcNAQkOMSEwHzAdBgNVHQ4EFgQUOA9CUGX9I0CVVpOUUS46GxdHizww
8 | DAYIKoZIzj0EAwIFAANHADBEAiAzd8bUNlsOQLgdznFtWiB64Ojxdst8zlXGL6MF
9 | 8rKK7AIgSE46/pAC0I3fTPkHpyAvfMTt4cPMmwfzrqyOL9RliXM=
10 | -----END NEW CERTIFICATE REQUEST-----
11 |
--------------------------------------------------------------------------------
/play-scala-tls-example/scripts/two.example.com.csr:
--------------------------------------------------------------------------------
1 | -----BEGIN NEW CERTIFICATE REQUEST-----
2 | MIIBdDCCARcCAQAwgYQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlh
3 | MRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMRgwFgYDVQQKEw9FeGFtcGxlIENvbXBh
4 | bnkxFDASBgNVBAsTC0V4YW1wbGUgT3JnMRgwFgYDVQQDEw90d28uZXhhbXBsZS5j
5 | b20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAART4xDZHuptoQOWd1iEMmn/T4ls
6 | KdWHFlwpnyzTLmExzOIoFZM2hkOWS6xQAP7KqD4V6QS3M6HbWpU9YSl0sy3hoDAw
7 | LgYJKoZIhvcNAQkOMSEwHzAdBgNVHQ4EFgQUIWFc+NvAwbPeCdbHL1zVKbPCGNIw
8 | DAYIKoZIzj0EAwIFAANJADBGAiEA0ZHjbT5vz7j4VglXCsJkRHN9pkmBJ6ageFxz
9 | CwkNYYgCIQDsSd2mcpHxdZ5l3DB11+dMWhAGdKZyLVs2DDunDbiWjg==
10 | -----END NEW CERTIFICATE REQUEST-----
11 |
--------------------------------------------------------------------------------
/play-java-forms-example/build.sbt:
--------------------------------------------------------------------------------
1 | name := """play-java-forms-example"""
2 |
3 | version := "1.0-SNAPSHOT"
4 |
5 | lazy val root = (project in file(".")).enablePlugins(PlayJava)
6 | //.enablePlugins(PlayNettyServer).disablePlugins(PlayPekkoHttpServer) // uncomment to use the Netty backend
7 |
8 | crossScalaVersions := Seq("2.13.16", "3.3.6")
9 |
10 | scalaVersion := crossScalaVersions.value.head
11 |
12 | (Test / testOptions) := Seq(Tests.Argument(TestFrameworks.JUnit, "-a", "-v"))
13 |
14 | libraryDependencies += guice
15 |
16 | scalacOptions ++= List("-Werror")
17 | javacOptions ++= Seq(
18 | "-Xlint:unchecked",
19 | "-Xlint:deprecation",
20 | "-Werror"
21 | )
22 |
--------------------------------------------------------------------------------
/play-scala-tls-example/scripts/wildcard.example.com.csr:
--------------------------------------------------------------------------------
1 | -----BEGIN NEW CERTIFICATE REQUEST-----
2 | MIIBcTCCARUCAQAwgYIxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlh
3 | MRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMRgwFgYDVQQKEw9FeGFtcGxlIENvbXBh
4 | bnkxFDASBgNVBAsTC0V4YW1wbGUgT3JnMRYwFAYDVQQDDA0qLmV4YW1wbGUuY29t
5 | MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEMHpxxc3bDaLnxHHcGzpeYCI+6bWB
6 | ZhSKWdTKqtBJdnnJGq7O9JV8R37QVvmXSKvHXtlrAsrWLNZ7tD3s/M3xu6AwMC4G
7 | CSqGSIb3DQEJDjEhMB8wHQYDVR0OBBYEFMhveL7bS/vfm9qXBQDMRyCuARN8MAwG
8 | CCqGSM49BAMCBQADSAAwRQIgWINBxNaoJKqCCjOJksfGqQrVT/2SO8DhaDv8ed7+
9 | uG4CIQCcqOhaXxFJ1N2BT2qQJdZY56LUCFldqRxW+0HaOlN1Yw==
10 | -----END NEW CERTIFICATE REQUEST-----
11 |
--------------------------------------------------------------------------------
/play-java-compile-di-example/build.sbt:
--------------------------------------------------------------------------------
1 | name := """play-java-compile-di-example"""
2 |
3 | version := "1.0-SNAPSHOT"
4 |
5 | lazy val root = (project in file(".")).enablePlugins(PlayJava)
6 | //.enablePlugins(PlayNettyServer).disablePlugins(PlayPekkoHttpServer) // uncomment to use the Netty backend
7 |
8 | crossScalaVersions := Seq("2.13.16", "3.3.6")
9 |
10 | scalaVersion := crossScalaVersions.value.head
11 |
12 | ThisBuild / scalacOptions ++= List("-encoding", "utf8", "-deprecation", "-feature", "-unchecked")
13 | ThisBuild / javacOptions ++= List("-Xlint:unchecked", "-Xlint:deprecation", "-Werror")
14 |
15 | Test / testOptions := Seq(Tests.Argument(TestFrameworks.JUnit, "-a", "-v"))
16 |
--------------------------------------------------------------------------------
/play-java-dagger2-example/app/dagger/ApplicationComponent.java:
--------------------------------------------------------------------------------
1 | package dagger;
2 |
3 | import javax.inject.Singleton;
4 |
5 | /**
6 | * The application component that specifies all the modules backing
7 | * the injected components.
8 | */
9 | @Singleton
10 | @Component(modules = {
11 | ApplicationLoaderContextModule.class,
12 | ApplicationModule.class,
13 | ClockModule.class
14 | })
15 | public interface ApplicationComponent {
16 | play.Application application();
17 |
18 | @Component.Builder
19 | interface Builder {
20 | @BindsInstance Builder context(play.ApplicationLoader.Context context);
21 | ApplicationComponent build();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/play-java-dagger2-example/app/views/index.scala.html:
--------------------------------------------------------------------------------
1 | @import play.mvc.Http.Request
2 | @(form: play.data.Form[TimeZoneData], renderedTime: String, timeZones: List[String])(implicit request: Request, messages: play.i18n.Messages)
3 |
4 | @main("Welcome to Play!") {
5 |
6 | @renderedTime
7 |
8 | @request.flash.get("success").orElse("")
9 |
10 | @helper.form(action = routes.TimeController.indexPost()) {
11 |
12 | @helper.select(field = form("timeZone"), options = helper.options(timeZones).toSeq)
13 |
14 | }
15 |
16 | See time rendered from a remote REST API
17 | }
18 |
--------------------------------------------------------------------------------
/play-java-jpa-example/test/AcceptanceTest.java:
--------------------------------------------------------------------------------
1 | import org.junit.Test;
2 |
3 | import static org.hamcrest.CoreMatchers.containsString;
4 | import static org.hamcrest.MatcherAssert.assertThat;
5 | import static play.test.Helpers.*;
6 |
7 | public class AcceptanceTest {
8 |
9 | /**
10 | * in this example we just check if the welcome page is being shown
11 | */
12 | @Test
13 | public void test() {
14 | running(testServer(3333, fakeApplication(inMemoryDatabase())), HTMLUNIT, browser -> {
15 | browser.goTo("http://localhost:3333");
16 | assertThat(browser.pageSource(), containsString("Add Person"));
17 | });
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/play-java-ebean-example/app/repository/DatabaseExecutionContext.java:
--------------------------------------------------------------------------------
1 | package repository;
2 |
3 | import org.apache.pekko.actor.ActorSystem;
4 | import play.libs.concurrent.CustomExecutionContext;
5 |
6 | import javax.inject.Inject;
7 |
8 | /**
9 | * Custom execution context, so that blocking database operations don't
10 | * happen on the rendering thread pool.
11 | *
12 | * @link https://www.playframework.com/documentation/latest/ThreadPools
13 | */
14 | public class DatabaseExecutionContext extends CustomExecutionContext {
15 |
16 | @Inject
17 | public DatabaseExecutionContext(ActorSystem actorSystem) {
18 | super(actorSystem, "database.dispatcher");
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/play-java-ebean-example/app/views/tags/forms/field_constructor.scala.html:
--------------------------------------------------------------------------------
1 | @(elements : helper.FieldElements)
2 |
3 | @import views.tags.forms.FormHelper.addClassValue
4 |
5 | @input = @{
6 | if(elements.hasErrors) {
7 | addClassValue(elements.input.toString(), "form-control is-invalid")
8 | } else {
9 | addClassValue(elements.input.toString(), "form-control")
10 | }
11 | }
12 |
13 | @elements.label
14 |
15 | @Html(input)
16 | @elements.errors.mkString(", ")
17 | @elements.infos.mkString(", ")
18 |
19 |
20 |
--------------------------------------------------------------------------------
/play-scala-isolated-slick-example/app/models/UserRequest.scala:
--------------------------------------------------------------------------------
1 | package models
2 |
3 | import play.api.data.Forms._
4 | import play.api.data.Form
5 |
6 | /**
7 | * A UserRequest model to get the form to update/create users.
8 | * @param id The Optional User Id to counter add/edit actions
9 | * @param email The Email to be registered/edited
10 | */
11 | case class UserRequest(id: Option[String], email: String)
12 |
13 | /**
14 | * The Companion object of the form
15 | */
16 | object UserRequest {
17 | val form: Form[UserRequest] = Form(
18 | mapping(
19 | "id" -> optional(nonEmptyText),
20 | "email" -> email
21 | )(UserRequest.apply)(u => Some((u.id, u.email)))
22 | )
23 | }
--------------------------------------------------------------------------------
/play-java-grpc-example/deployment/overlays/my-openshift-cluster/route.yml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: route.openshift.io/v1
3 | kind: Route
4 | metadata:
5 | labels:
6 | appName: play-java-grpc-example
7 | name: play-java-grpc-route
8 | namespace: play-java-grpc-example
9 | selfLink: >-
10 | /apis/route.openshift.io/v1/namespaces/play-java-grpc-example/routes/play-java-grpc-route
11 | spec:
12 | host: myservice.example.org
13 | port:
14 | targetPort: http
15 | to:
16 | kind: Service
17 | name: play-java-grpc-example
18 | weight: 100
19 | wildcardPolicy: None
20 | status:
21 | ingress:
22 | - conditions:
23 | host: myservice.example.org
24 | routerName: router
25 |
--------------------------------------------------------------------------------
/play-java-starter-example/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | # An example controller showing a sample home page
6 | GET / controllers.HomeController.index
7 | # An example controller showing how to use dependency injection
8 | GET /count controllers.CountController.count
9 | # An example controller showing how to write asynchronous code
10 | GET /message controllers.AsyncController.message
11 |
12 | # Map static resources from the /public folder to the /assets URL path
13 | GET /assets/*file controllers.Assets.versioned(file)
14 |
--------------------------------------------------------------------------------
/play-scala-hello-world-tutorial/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # https://www.playframework.com/documentation/latest/ScalaRouting
4 | # ~~~~
5 |
6 | # An example controller showing a sample home page
7 | GET / controllers.HomeController.index()
8 | GET /explore controllers.HomeController.explore()
9 | GET /tutorial controllers.HomeController.tutorial()
10 |
11 |
12 | # Map static resources from the /public folder to the /assets URL path
13 | GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
14 |
--------------------------------------------------------------------------------
/play-scala-starter-example/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | # An example controller showing a sample home page
6 | GET / controllers.HomeController.index
7 | # An example controller showing how to use dependency injection
8 | GET /count controllers.CountController.count
9 | # An example controller showing how to write asynchronous code
10 | GET /message controllers.AsyncController.message
11 |
12 | # Map static resources from the /public folder to the /assets URL path
13 | GET /assets/*file controllers.Assets.versioned(file)
14 |
--------------------------------------------------------------------------------
/play-scala-streaming-example/app/controllers/ScalaEventSourceController.scala:
--------------------------------------------------------------------------------
1 | package controllers
2 |
3 | import javax.inject.{Inject, Singleton}
4 |
5 | import play.api.http.ContentTypes
6 | import play.api.libs.EventSource
7 | import play.api.mvc._
8 |
9 | @Singleton
10 | class ScalaEventSourceController @Inject()(cc: ControllerComponents) extends AbstractController(cc) with ScalaTicker {
11 |
12 | def index(): Action[AnyContent] = Action { implicit request =>
13 | Ok(views.html.scalaeventsource())
14 | }
15 |
16 | def streamClock(): Action[AnyContent] = Action { implicit request =>
17 | Ok.chunked(stringSource via EventSource.flow).as(ContentTypes.EVENT_STREAM)
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/play-scala-streaming-example/app/views/scalacomet.scala.html:
--------------------------------------------------------------------------------
1 | @()(implicit request: RequestHeader)
2 |
3 | @main {
4 |
5 | Comet clock
6 |
7 |
8 |
9 |
10 | Clock events are pushed from the Server using a Comet connection.
11 |
12 |
13 |
19 |
20 |
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/play-scala-grpc-example/deployment/overlays/my-openshift-cluster/route.yml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: route.openshift.io/v1
3 | kind: Route
4 | metadata:
5 | labels:
6 | appName: play-scala-grpc-example
7 | name: play-scala-grpc-route
8 | namespace: play-scala-grpc-example
9 | selfLink: >-
10 | /apis/route.openshift.io/v1/namespaces/play-scala-grpc-example/routes/play-scala-grpc-route
11 | spec:
12 | host: myservice.example.org
13 | port:
14 | targetPort: http
15 | to:
16 | kind: Service
17 | name: play-scala-grpc-example
18 | weight: 100
19 | wildcardPolicy: None
20 | status:
21 | ingress:
22 | - conditions:
23 | host: myservice.example.org
24 | routerName: router
25 |
--------------------------------------------------------------------------------
/play-java-starter-example/app/views/index.scala.html:
--------------------------------------------------------------------------------
1 | @*
2 | * This template takes a two arguments, a String containing a
3 | * message to display and an AssetsFinder to locate static assets.
4 | *@
5 | @(message: String)(implicit assetsFinder: AssetsFinder)
6 |
7 | @*
8 | * Call the `main` template with two arguments. The first
9 | * argument is a `String` with the title of the page, the second
10 | * argument is an `Html` object containing the body of the page.
11 | *@
12 | @main("Welcome to Play") {
13 |
14 | @*
15 | * Get an `Html` object by calling the built-in Play welcome
16 | * template and passing a `String` message.
17 | *@
18 | @welcome(message, style = "java")
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/play-scala-compile-di-example/test/ServerSpec.scala:
--------------------------------------------------------------------------------
1 | import org.scalatest.concurrent.{IntegrationPatience, ScalaFutures}
2 | import org.scalatestplus.play._
3 |
4 | /**
5 | * Runs a play server on a random port (Helpers.testServerPort == 0).
6 | */
7 | class ServerSpec extends PlaySpec
8 | with BaseOneServerPerSuite
9 | with MyApplicationFactory
10 | with ScalaFutures
11 | with IntegrationPatience {
12 |
13 | private implicit val implicitPort: Int = port
14 |
15 | "Server query should" should {
16 | "work" in {
17 | whenReady(play.api.test.WsTestClient.wsUrl("/").get()) { response =>
18 | response.status mustBe play.api.http.Status.OK
19 | }
20 | }
21 | }
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/play-scala-hello-world-tutorial/build.sbt:
--------------------------------------------------------------------------------
1 | lazy val root = (project in file("."))
2 | .enablePlugins(PlayScala)
3 | //.enablePlugins(PlayNettyServer).disablePlugins(PlayPekkoHttpServer) // uncomment to use the Netty backend
4 | .settings(
5 | name := """play-scala-hello-world-tutorial""",
6 | organization := "com.example",
7 | version := "1.0-SNAPSHOT",
8 | crossScalaVersions := Seq("2.13.16", "3.3.6"),
9 | scalaVersion := crossScalaVersions.value.head,
10 | libraryDependencies ++= Seq(
11 | guice,
12 | "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.2" % Test
13 | ),
14 | scalacOptions ++= Seq(
15 | "-feature",
16 | "-Werror"
17 | )
18 | )
19 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/person/test/BrowserSpec.scala:
--------------------------------------------------------------------------------
1 | import org.junit.runner._
2 | import org.specs2.mutable._
3 | import org.specs2.runner._
4 | import play.api.test._
5 |
6 | /**
7 | * add your integration spec here.
8 | * An integration test will fire up a whole play application in a real (or headless) browser
9 | */
10 | @RunWith(classOf[JUnitRunner])
11 | class BrowserSpec extends Specification {
12 |
13 | "Application" should {
14 |
15 | "work from within a browser" in new WithBrowser {
16 | override def running() = {
17 |
18 | browser.goTo("http://localhost:" + port)
19 |
20 | browser.pageSource must contain("Add Person")
21 | }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/play-scala-starter-example/app/views/index.scala.html:
--------------------------------------------------------------------------------
1 | @*
2 | * This template takes a two arguments, a String containing a
3 | * message to display and an AssetsFinder to locate static assets.
4 | *@
5 | @(message: String)(implicit assetsFinder: AssetsFinder)
6 |
7 | @*
8 | * Call the `main` template with two arguments. The first
9 | * argument is a `String` with the title of the page, the second
10 | * argument is an `Html` object containing the body of the page.
11 | *@
12 | @main("Welcome to Play") {
13 |
14 | @*
15 | * Get an `Html` object by calling the built-in Play welcome
16 | * template and passing a `String` message.
17 | *@
18 | @welcome(message, style = "scala")
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/play-java-ebean-example/app/views/tags/forms/FormHelper.scala:
--------------------------------------------------------------------------------
1 | package views.tags.forms
2 |
3 | import views.html.tags.forms.field_constructor
4 |
5 | object FormHelper {
6 | import views.html.helper.FieldConstructor
7 | implicit val inlineBootstrapConstructor: FieldConstructor = FieldConstructor(field_constructor.f)
8 |
9 | val classRegex = "(?s)(<(?:input|textarea|select)[^>]*\\sclass=[\"'])".r
10 | val noClassRegex = "(?s)(<(?:input|textarea|select))((?:(?!\\sclass=\").+)>)".r
11 |
12 | def addClassValue(text: String, classValue: String) = {
13 | val str = classRegex.replaceFirstIn(text, s"$$1$classValue ")
14 | noClassRegex.replaceFirstIn(str, s"""$$1 class="$classValue"$$2""")
15 | }
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/play-scala-macwire-di-example/test/ServerSpec.scala:
--------------------------------------------------------------------------------
1 | import org.scalatest.concurrent.{IntegrationPatience, ScalaFutures}
2 | import org.scalatestplus.play._
3 | import play.api.mvc.Results
4 | import play.api.test.Helpers._
5 | import play.api.test.WsTestClient
6 |
7 | class ServerSpec extends PlaySpec
8 | with BaseOneServerPerSuite
9 | with GreeterApplicationFactory
10 | with Results
11 | with ScalaFutures
12 | with IntegrationPatience {
13 |
14 | "Server query should" should {
15 | "work" in {
16 | WsTestClient.withClient { implicit client =>
17 | whenReady(wsUrl("/").get()) { response =>
18 | response.status mustBe OK
19 | }
20 | }
21 | }
22 | }
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | logs/
2 | target/
3 | RUNNING_PID
4 |
5 | # bloop and metals
6 | .bloop
7 | .bsp
8 |
9 | # metals
10 | project/metals.sbt
11 | .metals
12 | */project/metals.sbt
13 | */.metals
14 |
15 | # vs code
16 | .vscode
17 |
18 | # scala 3
19 | .tasty
20 |
21 | # sbt
22 | project/project/
23 | */project/project/
24 | project/target/
25 | target/
26 |
27 | # eclipse
28 | build/
29 | .classpath
30 | .project
31 | .settings
32 | .worksheet
33 | bin/
34 | .cache
35 |
36 | # intellij idea
37 | *.log
38 | *.iml
39 | *.ipr
40 | *.iws
41 | .idea
42 |
43 | # mac
44 | .DS_Store
45 |
46 | # other?
47 | .history
48 | .scala_dependencies
49 | .cache-main
50 |
51 | #general
52 | *.class
53 |
54 | # Gradle
55 | .gradle
56 | build
57 |
--------------------------------------------------------------------------------
/play-scala-log4j2-example/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | # An example controller showing a sample home page
6 | GET / controllers.HomeController.index
7 | # An example controller showing how to use dependency injection
8 | GET /count controllers.CountController.count
9 | # An example controller showing how to write asynchronous code
10 | GET /message controllers.AsyncController.message
11 |
12 | # Map static resources from the /public folder to the /assets URL path
13 | GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
14 |
--------------------------------------------------------------------------------
/play-java-jpa-example/conf/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 | DefaultDS
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/play-java-rest-api-example/conf/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 | org.hibernate.jpa.HibernatePersistenceProvider
8 | DefaultDS
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/basic/test/IntegrationSpec.scala:
--------------------------------------------------------------------------------
1 | package test
2 |
3 | import org.specs2.mutable._
4 |
5 | import play.api.test._
6 | import play.api.test.Helpers._
7 |
8 | /**
9 | * add your integration spec here.
10 | * An integration test will fire up a whole play application in a real (or headless) browser
11 | */
12 | class IntegrationSpec extends Specification {
13 |
14 | "Application" should {
15 |
16 | "work from within a browser" in {
17 | val port = 3333
18 | running(TestServer(port), HTMLUNIT) { browser =>
19 |
20 | browser.goTo("http://localhost:" + port)
21 |
22 | browser.pageSource must contain("kitty cat")
23 |
24 | }
25 | }
26 |
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/play-scala-chatroom-example/app/controllers/RequestMarkerContext.scala:
--------------------------------------------------------------------------------
1 | package controllers
2 |
3 | import play.api.MarkerContext
4 | import play.api.mvc._
5 |
6 | import scala.language.implicitConversions
7 |
8 | /**
9 | * Provide host and path logging on the request, available in application.json
10 | */
11 | trait RequestMarkerContext {
12 |
13 | implicit def requestHeaderToMarkerContext(implicit request: RequestHeader): MarkerContext = {
14 | import net.logstash.logback.marker.LogstashMarker
15 | import net.logstash.logback.marker.Markers._
16 |
17 | val requestMarkers: LogstashMarker = append("host", request.host)
18 | .and(append("path", request.path))
19 |
20 | MarkerContext(requestMarkers)
21 | }
22 |
23 | }
--------------------------------------------------------------------------------
/play-java-streaming-example/app/views/main.scala.html:
--------------------------------------------------------------------------------
1 | @(content: Html)(implicit request: play.api.mvc.RequestHeader)
2 |
3 |
4 |
5 |
6 |
7 | EventSource clock
8 |
9 |
10 |
11 |
12 |
13 |
14 | @content
15 |
16 |
17 |
--------------------------------------------------------------------------------
/play-java-streaming-example/test/controllers/JavaCometControllerTest.java:
--------------------------------------------------------------------------------
1 | package controllers;
2 |
3 | import org.junit.Test;
4 | import play.mvc.Http;
5 | import play.mvc.Result;
6 | import play.test.WithApplication;
7 |
8 | import static org.junit.Assert.assertEquals;
9 | import static play.test.Helpers.*;
10 |
11 | public class JavaCometControllerTest extends WithApplication {
12 |
13 | @Test
14 | public void testClock() {
15 | Http.RequestBuilder request = new Http.RequestBuilder()
16 | .host("localhost")
17 | .method(GET)
18 | .uri("/java/comet/liveClock");
19 |
20 | Result result = route(app, request);
21 | assertEquals(OK, result.status());
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/play-scala-compile-di-example/app/controllers/HomeController.scala:
--------------------------------------------------------------------------------
1 | package controllers
2 |
3 | import javax.inject.Inject
4 |
5 | import play.api.mvc._
6 |
7 | /**
8 | * This controller creates an `Action` to handle HTTP requests to the
9 | * application's home page.
10 | */
11 |
12 | class HomeController @Inject()(cc: ControllerComponents) extends AbstractController(cc) {
13 |
14 | /**
15 | * Create an Action to render an HTML page with a welcome message.
16 | * The configuration in the `routes` file means that this method
17 | * will be called when the application receives a `GET` request with
18 | * a path of `/`.
19 | */
20 | def index = Action {
21 | Ok(views.html.index("Your new application is ready."))
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/play-scala-tls-example/modules/one/app/controllers/HomeController.scala:
--------------------------------------------------------------------------------
1 | package controllers.one
2 |
3 | import javax.inject._
4 | import play.api._
5 | import play.api.mvc._
6 |
7 | /**
8 | * This controller creates an `Action` to handle HTTP requests to the
9 | * application's home page.
10 | */
11 | @Singleton
12 | class HomeController @Inject()(cc: ControllerComponents) extends AbstractController(cc) {
13 |
14 | /**
15 | * Create an Action to render an HTML page with a welcome message.
16 | * The configuration in the `routes` file means that this method
17 | * will be called when the application receives a `GET` request with
18 | * a path of `/`.
19 | */
20 | def index = Action {
21 | Ok(views.html.one.index())
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/play-java-streaming-example/README.md:
--------------------------------------------------------------------------------
1 | # play-java-streaming-example
2 |
3 | This is an example Play template that demonstrates Streaming with Server Sent Events or Comet, using Pekko Streams.
4 |
5 | Please see the documentation at:
6 |
7 | *
8 |
9 | ## Server backend
10 |
11 | By default, the project uses the Pekko HTTP Server backend. To switch to the Netty Server backend, enable the `PlayNettyServer` sbt plugin in the `build.sbt` file.
12 | In the `build.sbt` of this project, you'll find a commented line for this setting; simply uncomment it to make the switch.
13 | For more detailed information, refer to the Play Framework [documentation](https://www.playframework.com/documentation/3.0.x/Server).
14 |
--------------------------------------------------------------------------------
/play-scala-macwire-di-example/test/GreeterApplicationFactory.scala:
--------------------------------------------------------------------------------
1 | import org.scalatestplus.play.FakeApplicationFactory
2 | import play.api.inject.DefaultApplicationLifecycle
3 | import play.api.{Application, ApplicationLoader, Configuration, Environment}
4 | import play.core.DefaultWebCommands
5 |
6 | trait GreeterApplicationFactory extends FakeApplicationFactory {
7 |
8 | private class GreetingApplicationBuilder {
9 | def build(): Application = {
10 | val env = Environment.simple()
11 | val context = ApplicationLoader.Context.create(env)
12 | val loader = new GreetingApplicationLoader()
13 | loader.load(context)
14 | }
15 | }
16 |
17 | def fakeApplication(): Application = new GreetingApplicationBuilder().build()
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/play-java-streaming-example/app/controllers/HomeController.java:
--------------------------------------------------------------------------------
1 | package controllers;
2 |
3 | import javax.inject.Inject;
4 |
5 | import play.routing.*;
6 |
7 | import play.mvc.Controller;
8 | import play.mvc.Http;
9 | import play.mvc.Result;
10 |
11 | public class HomeController extends Controller {
12 |
13 | public Result index(final Http.Request request) {
14 | return ok(views.html.index.render(request));
15 | }
16 |
17 | public Result javascriptRoutes(final Http.Request request) {
18 | return ok(
19 | JavaScriptReverseRouter.create(
20 | "jsRoutes",
21 | "jQuery.ajax",
22 | request.host(),
23 | routes.javascript.JavaEventSourceController.streamClock()
24 | )
25 | ).as("text/javascript");
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/play-java-streaming-example/test/controllers/JavaEventSourceControllerTest.java:
--------------------------------------------------------------------------------
1 | package controllers;
2 |
3 | import org.junit.Test;
4 | import play.mvc.Http;
5 | import play.mvc.Result;
6 | import play.test.WithApplication;
7 |
8 | import static org.junit.Assert.assertEquals;
9 | import static play.test.Helpers.*;
10 |
11 | public class JavaEventSourceControllerTest extends WithApplication {
12 |
13 | @Test
14 | public void testClock() {
15 | Http.RequestBuilder request = new Http.RequestBuilder()
16 | .host("localhost")
17 | .method(GET)
18 | .uri("/java/eventSource/liveClock");
19 |
20 | Result result = route(app, request);
21 | assertEquals(OK, result.status());
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/play-scala-streaming-example/build.sbt:
--------------------------------------------------------------------------------
1 | lazy val root = (project in file("."))
2 | .enablePlugins(PlayScala)
3 | //.enablePlugins(PlayNettyServer).disablePlugins(PlayPekkoHttpServer) // uncomment to use the Netty backend
4 | .settings(
5 | name := "play-scala-streaming-example",
6 | version := "1.0-SNAPSHOT",
7 | crossScalaVersions := Seq("2.13.16", "3.3.6"),
8 | scalaVersion := crossScalaVersions.value.head,
9 | libraryDependencies ++= Seq(
10 | guice,
11 | ws % Test,
12 | "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.2" % Test
13 | ),
14 | scalacOptions ++= Seq(
15 | "-feature",
16 | "-Werror"
17 | )
18 | )
19 |
20 | TwirlKeys.templateImports ++= Seq(
21 | "views.html.helper.CSPNonce"
22 | )
23 |
--------------------------------------------------------------------------------
/play-java-websocket-example/app/stocks/StockHistory.java:
--------------------------------------------------------------------------------
1 | package stocks;
2 |
3 | import java.util.List;
4 |
5 | import static java.util.Objects.requireNonNull;
6 |
7 | /** A JSON presentation class for stock history. */
8 | public class StockHistory {
9 | private final String symbol;
10 | private final List prices;
11 |
12 | public StockHistory(String symbol, List prices) {
13 | this.symbol = requireNonNull(symbol);
14 | this.prices = requireNonNull(prices);
15 | }
16 |
17 | public String getType() {
18 | return "stockhistory";
19 | }
20 |
21 | public String getSymbol() {
22 | return symbol;
23 | }
24 |
25 | public List getHistory() {
26 | return prices;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/play-java-websocket-example/app/stocks/StockUpdate.java:
--------------------------------------------------------------------------------
1 | package stocks;
2 |
3 | import com.fasterxml.jackson.annotation.JsonTypeInfo;
4 |
5 | import static java.util.Objects.requireNonNull;
6 |
7 | /** A JSON presentation class for stock updates. */
8 | public class StockUpdate {
9 | private final String symbol;
10 | private final Double price;
11 |
12 | public StockUpdate(String symbol, Double price) {
13 | this.symbol = requireNonNull(symbol);
14 | this.price = requireNonNull(price);
15 | }
16 |
17 | public String getType() {
18 | return "stockupdate";
19 | }
20 |
21 | public Double getPrice() {
22 | return price;
23 | }
24 |
25 | public String getSymbol() {
26 | return symbol;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/play-scala-starter-example/app/filters/ExampleFilter.scala:
--------------------------------------------------------------------------------
1 | package filters
2 |
3 | import javax.inject._
4 | import play.api.mvc._
5 | import scala.concurrent.ExecutionContext
6 |
7 | /**
8 | * This is a simple filter that adds a header to all requests. It's
9 | * added to the application's list of filters by the
10 | * [[Filters]] class.
11 | *
12 | * @param ec This class is needed to execute code asynchronously.
13 | * It is used below by the `map` method.
14 | */
15 | @Singleton
16 | class ExampleFilter @Inject()(implicit ec: ExecutionContext) extends EssentialFilter {
17 | override def apply(next: EssentialAction) = EssentialAction { request =>
18 | next(request).map { result =>
19 | result.withHeaders("X-ExampleFilter" -> "foo")
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/play-scala-isolated-slick-example/modules/api/src/main/scala/com/example/user/UserDAO.scala:
--------------------------------------------------------------------------------
1 | package com.example.user
2 |
3 | import scala.concurrent.Future
4 | import java.time.Instant
5 |
6 | /**
7 | * An implementation dependent DAO. This could be implemented by Slick, Cassandra, or a REST API.
8 | */
9 | trait UserDAO {
10 |
11 | def lookup(id: String): Future[Option[User]]
12 |
13 | def all: Future[Seq[User]]
14 |
15 | def update(user: User): Future[Int]
16 |
17 | def delete(id: String): Future[Int]
18 |
19 | def create(user: User): Future[Int]
20 |
21 | def close(): Future[Unit]
22 | }
23 |
24 | /**
25 | * Implementation independent aggregate root.
26 | */
27 | case class User(id: String, email: String, createdAt: Instant, updatedAt: Option[Instant])
28 |
--------------------------------------------------------------------------------
/play-java-websocket-example/app/stocks/FakeStockQuoteGenerator.java:
--------------------------------------------------------------------------------
1 | package stocks;
2 |
3 | import java.util.concurrent.ThreadLocalRandom;
4 |
5 | public class FakeStockQuoteGenerator implements StockQuoteGenerator {
6 |
7 | private final String symbol;
8 |
9 | public FakeStockQuoteGenerator(String symbol) {
10 | this.symbol = symbol;
11 | }
12 |
13 | private Double random() {
14 | return ThreadLocalRandom.current().nextDouble();
15 | }
16 |
17 | @Override
18 | public StockQuote newQuote(StockQuote last) {
19 | return new StockQuote(last.symbol, last.price * (0.95 + (0.1 * random())));
20 | }
21 |
22 | @Override
23 | public StockQuote seed() {
24 | return new StockQuote(symbol, random() * 800);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/play-scala-log4j2-example/app/controllers/HomeController.scala:
--------------------------------------------------------------------------------
1 | package controllers
2 |
3 | import javax.inject._
4 | import play.api._
5 | import play.api.mvc._
6 |
7 | /**
8 | * This controller creates an `Action` to handle HTTP requests to the
9 | * application's home page.
10 | */
11 | @Singleton
12 | class HomeController @Inject() (val controllerComponents: ControllerComponents) extends BaseController {
13 |
14 | /**
15 | * Create an Action to render an HTML page with a welcome message.
16 | * The configuration in the `routes` file means that this method
17 | * will be called when the application receives a `GET` request with
18 | * a path of `/`.
19 | */
20 | def index = Action {
21 | Ok(views.html.index("Your new application is ready."))
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/play-java-grpc-example/README.md:
--------------------------------------------------------------------------------
1 | # Play Java gRPC Example
2 |
3 | This example is described in the [Play Java gRPC Example site](https://developer.lightbend.com/guides/play-java-grpc-example/).
4 |
5 | This is an example application that shows how to use Pekko gRPC to both expose and use gRPC services inside an Play application.
6 |
7 | For detailed documentation refer to https://www.playframework.com/documentation/latest/Home and https://pekko.apache.org/docs/pekko-grpc/current/.
8 |
9 |
10 | ## Sample license
11 |
12 | To the extent possible under law, the author(s) have dedicated all copyright and related
13 | and neighboring rights to this template to the public domain worldwide.
14 | This template is distributed without any warranty. See .
15 |
--------------------------------------------------------------------------------
/play-java-streaming-example/build.sbt:
--------------------------------------------------------------------------------
1 | name := "play-java-streaming-example"
2 |
3 | version := "1.0-SNAPSHOT"
4 |
5 | crossScalaVersions := Seq("2.13.16", "3.3.6")
6 | scalaVersion := crossScalaVersions.value.head
7 |
8 | lazy val root = (project in file(".")).enablePlugins(PlayJava)
9 | //.enablePlugins(PlayNettyServer).disablePlugins(PlayPekkoHttpServer) // uncomment to use the Netty backend
10 |
11 | libraryDependencies += guice
12 |
13 | // "-encoding", "utf8", "-deprecation" get set by Play automatically
14 | scalacOptions ++= List("-Werror")
15 | javacOptions ++= Seq(
16 | "-Xlint:unchecked",
17 | "-Xlint:deprecation",
18 | "-Werror"
19 | )
20 |
21 | TwirlKeys.templateImports ++= Seq(
22 | "play.mvc.Http.{ RequestHeader => JRequestHeader }",
23 | "views.html.helper.CSPNonce"
24 | )
25 |
--------------------------------------------------------------------------------
/play-scala-compile-di-example/app/MyApplicationLoader.scala:
--------------------------------------------------------------------------------
1 | import play.api._
2 | import play.api.routing.Router
3 |
4 | class MyApplicationLoader extends ApplicationLoader {
5 | private var components: MyComponents = _
6 |
7 | def load(context: ApplicationLoader.Context): Application = {
8 | components = new MyComponents(context)
9 | components.application
10 | }
11 | }
12 |
13 | class MyComponents(context: ApplicationLoader.Context)
14 | extends BuiltInComponentsFromContext(context)
15 | with play.filters.HttpFiltersComponents
16 | with _root_.controllers.AssetsComponents {
17 |
18 | lazy val homeController = new _root_.controllers.HomeController(controllerComponents)
19 |
20 | lazy val router: Router = new _root_.router.Routes(httpErrorHandler, homeController, assets)
21 | }
22 |
--------------------------------------------------------------------------------
/play-scala-grpc-example/README.md:
--------------------------------------------------------------------------------
1 | # Play Scala gRPC Example
2 |
3 | This example is described in the [Play Scala gRPC Example site](https://developer.lightbend.com/guides/play-scala-grpc-example/).
4 |
5 | This is an example application that shows how to use Pekko gRPC to both expose and use gRPC services inside an Play application.
6 |
7 | For detailed documentation refer to https://www.playframework.com/documentation/latest/Home and https://pekko.apache.org/docs/pekko-grpc/current/.
8 |
9 |
10 | ## Sample license
11 |
12 | To the extent possible under law, the author(s) have dedicated all copyright and related
13 | and neighboring rights to this template to the public domain worldwide.
14 | This template is distributed without any warranty. See .
15 |
--------------------------------------------------------------------------------
/play-scala-starter-example/app/controllers/HomeController.scala:
--------------------------------------------------------------------------------
1 | package controllers
2 |
3 | import javax.inject._
4 |
5 | import play.api.mvc._
6 |
7 | /**
8 | * This controller creates an `Action` to handle HTTP requests to the
9 | * application's home page.
10 | */
11 | @Singleton
12 | class HomeController @Inject()(cc: ControllerComponents) (implicit assetsFinder: AssetsFinder)
13 | extends AbstractController(cc) {
14 |
15 | /**
16 | * Create an Action to render an HTML page with a welcome message.
17 | * The configuration in the `routes` file means that this method
18 | * will be called when the application receives a `GET` request with
19 | * a path of `/`.
20 | */
21 | def index = Action {
22 | Ok(views.html.index("Your new application is ready."))
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/play-scala-secure-session-example/app/controllers/LogoutController.scala:
--------------------------------------------------------------------------------
1 | package controllers
2 |
3 | import javax.inject.{ Inject, Singleton }
4 |
5 | import play.api.mvc._
6 | import services.session.SessionService
7 |
8 | @Singleton
9 | class LogoutController @Inject() (
10 | sessionService: SessionService,
11 | cc: ControllerComponents
12 | ) extends AbstractController(cc) {
13 |
14 | def logout = Action { implicit request: Request[AnyContent] =>
15 | // When we delete the session id, removing the session id is enough to render the
16 | // user info cookie unusable.
17 | request.session.get(SESSION_ID).foreach { sessionId =>
18 | sessionService.delete(sessionId)
19 | }
20 |
21 | discardingSession {
22 | Redirect(routes.HomeController.index)
23 | }
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/play-scala-streaming-example/app/controllers/ScalaCometController.scala:
--------------------------------------------------------------------------------
1 | package controllers
2 |
3 | import org.apache.pekko.stream.Materializer
4 | import play.api.http.ContentTypes
5 | import play.api.libs.Comet
6 | import play.api.mvc._
7 | import views.html.helper.CSPNonce
8 |
9 | import javax.inject.{Inject, Singleton}
10 |
11 | @Singleton
12 | class ScalaCometController @Inject()(cc: ControllerComponents, materializer: Materializer) extends AbstractController(cc)
13 | with ScalaTicker {
14 |
15 | def index(): Action[AnyContent] = Action { implicit request =>
16 | Ok(views.html.scalacomet())
17 | }
18 |
19 | def streamClock(): Action[AnyContent] = Action { implicit request =>
20 | Ok.chunked(stringSource.via(Comet.string("parent.clockChanged", CSPNonce()))).as(ContentTypes.HTML)
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/play-scala-streaming-example/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | # Home page
6 |
7 | GET / controllers.HomeController.index()
8 |
9 | GET /scala/comet controllers.ScalaCometController.index()
10 | GET /scala/comet/liveClock controllers.ScalaCometController.streamClock()
11 |
12 | GET /scala/eventSource controllers.ScalaEventSourceController.index()
13 | GET /scala/eventSource/liveClock controllers.ScalaEventSourceController.streamClock()
14 |
15 | # Map static resources from the /public folder to the /assets URL path
16 | GET /assets/*file controllers.Assets.at(path="/public", file)
17 |
--------------------------------------------------------------------------------
/play-scala-macwire-di-example/test/ApplicationSpec.scala:
--------------------------------------------------------------------------------
1 | import org.scalatestplus.play.{BaseOneAppPerTest, PlaySpec}
2 | import play.api.test.Helpers._
3 | import play.api.test._
4 |
5 | /**
6 | *
7 | */
8 | class ApplicationSpec extends PlaySpec
9 | with BaseOneAppPerTest
10 | with GreeterApplicationFactory {
11 |
12 | "Routes" should {
13 | "send 404 on a bad request" in {
14 | route(app, FakeRequest(GET, "/boum")).map(status(_)) mustBe Some(NOT_FOUND)
15 | }
16 | }
17 |
18 | "HomeController" should {
19 | "render the index page" in {
20 | val home = route(app, FakeRequest(GET, "/")).get
21 |
22 | status(home) mustBe OK
23 | contentType(home) mustBe Some("text/html")
24 | contentAsString(home) must include("Your new application is ready.")
25 | }
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/play-scala-streaming-example/app/controllers/ScalaTicker.scala:
--------------------------------------------------------------------------------
1 | package controllers
2 |
3 | import java.time.ZonedDateTime
4 | import java.time.format.DateTimeFormatter
5 |
6 | import org.apache.pekko.stream.scaladsl.Source
7 | import play.api.libs.json._
8 |
9 | import scala.concurrent.duration._
10 |
11 | trait ScalaTicker {
12 |
13 | def stringSource: Source[String, _] = {
14 | val df: DateTimeFormatter = DateTimeFormatter.ofPattern("HH mm ss")
15 | val tickSource = Source.tick(0.millis, 100.millis, "TICK")
16 | val s = tickSource.map(_ => df.format(ZonedDateTime.now()))
17 | s
18 | }
19 |
20 | def jsonSource: Source[JsValue, _] = {
21 | val tickSource = Source.tick(0.millis, 100.millis, "TICK")
22 | val s = tickSource.map(_ => Json.toJson(ZonedDateTime.now))
23 | s
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/play-java-streaming-example/app/controllers/JavaEventSourceController.java:
--------------------------------------------------------------------------------
1 | package controllers;
2 |
3 | import org.apache.pekko.stream.javadsl.Source;
4 | import play.libs.EventSource;
5 | import play.mvc.Controller;
6 | import play.mvc.Http;
7 | import play.mvc.Result;
8 |
9 | import javax.inject.Singleton;
10 |
11 | @Singleton
12 | public class JavaEventSourceController extends Controller implements JavaTicker {
13 |
14 | public Result index(final Http.Request request) {
15 | return ok(views.html.javaeventsource.render(request));
16 | }
17 |
18 | public Result streamClock() {
19 | final Source eventSource = getStringSource().map(EventSource.Event::event);
20 | return ok().chunked(eventSource.via(EventSource.flow())).as(Http.MimeTypes.EVENT_STREAM);
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/play-scala-forms-example/build.sbt:
--------------------------------------------------------------------------------
1 | lazy val root = (project in file("."))
2 | .enablePlugins(PlayScala)
3 | //.enablePlugins(PlayNettyServer).disablePlugins(PlayPekkoHttpServer) // uncomment to use the Netty backend
4 | .settings(
5 | name := """play-scala-forms-example""",
6 | version := "1.0-SNAPSHOT",
7 | crossScalaVersions := Seq("2.13.16", "3.3.6"),
8 | scalaVersion := crossScalaVersions.value.head,
9 | libraryDependencies ++= Seq(
10 | guice,
11 | "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.2" % Test
12 | ),
13 | scalacOptions ++= Seq(
14 | "-feature",
15 | "-Werror"
16 | ),
17 | // Needed for ssl-config to create self signed certificated under Java 17
18 | Test / javaOptions ++= List("--add-exports=java.base/sun.security.x509=ALL-UNNAMED"),
19 | )
20 |
--------------------------------------------------------------------------------
/play-scala-rest-api-example/app/v1/post/PostRouter.scala:
--------------------------------------------------------------------------------
1 | package v1.post
2 |
3 | import javax.inject.Inject
4 |
5 | import play.api.routing.Router.Routes
6 | import play.api.routing.SimpleRouter
7 | import play.api.routing.sird._
8 |
9 | /**
10 | * Routes and URLs to the PostResource controller.
11 | */
12 | class PostRouter @Inject()(controller: PostController) extends SimpleRouter {
13 | val prefix = "/v1/posts"
14 |
15 | def link(id: PostId): String = {
16 | import io.lemonlabs.uri.typesafe.dsl._
17 | val url = prefix / id.toString
18 | url.toString()
19 | }
20 |
21 | override def routes: Routes = {
22 | case GET(p"/") =>
23 | controller.index
24 |
25 | case POST(p"/") =>
26 | controller.process
27 |
28 | case GET(p"/$id") =>
29 | controller.show(id)
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/play-java-forms-example/README.md:
--------------------------------------------------------------------------------
1 | # play-java-forms-example
2 |
3 | This example shows form processing and form helper handling in Play.
4 |
5 | ## How to run
6 |
7 | Start the Play app:
8 |
9 | ```bash
10 | sbt run
11 | ```
12 |
13 | And open
14 |
15 | ## Server backend
16 |
17 | By default, the project uses the Pekko HTTP Server backend. To switch to the Netty Server backend, enable the `PlayNettyServer` sbt plugin in the `build.sbt` file.
18 | In the `build.sbt` of this project, you'll find a commented line for this setting; simply uncomment it to make the switch.
19 | For more detailed information, refer to the Play Framework [documentation](https://www.playframework.com/documentation/3.0.x/Server).
20 |
21 | ## Documentation
22 |
23 | Please see .
24 |
--------------------------------------------------------------------------------
/.github/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3 | "baseBranches": ["main", "3.0.x", "2.9.x"],
4 | "schedule": ["monthly"],
5 | "extends": [
6 | "config:recommended"
7 | ],
8 | "enabledManagers": ["gradle", "gradle-wrapper"],
9 | "labels": [
10 | "type:updates"
11 | ],
12 | "rebaseWhen": "conflicted",
13 | "packageRules": [
14 | {
15 | "matchPackageNames": ["org.webjars:bootstrap"],
16 | "allowedVersions": "<3.5"
17 | }
18 | ],
19 | "commitMessageTopic": "`{{depName}}`",
20 | "commitMessageExtra": "to `{{#if isPinDigest}}{{{newDigestShort}}}{{else}}{{#if isMajor}}v{{{newMajor}}}{{else}}{{#if isSingleVersion}}v{{{newVersion}}}{{else}}{{#if newValue}}{{{newValue}}}{{else}}{{{newDigestShort}}}{{/if}}{{/if}}{{/if}}{{/if}}` (was `{{currentVersion}}`)"
21 | }
22 |
--------------------------------------------------------------------------------
/play-scala-tls-example/app/controllers/HomeController.scala:
--------------------------------------------------------------------------------
1 | package controllers
2 |
3 | import javax.inject.Inject
4 |
5 | import play.api._
6 | import play.api.mvc._
7 |
8 | class HomeController @Inject()(cc: ControllerComponents) extends AbstractController(cc) {
9 |
10 | def index: Action[AnyContent] = Action { implicit request =>
11 | Ok(views.html.index(subdomain)).withHeaders("Cache-Control" -> "no-store")
12 | }
13 |
14 | private def subdomain(implicit r: RequestHeader): String = {
15 | // pull out the host part of the request URI
16 | val s = r.host.split(":")(0).replace(".example.com", "")
17 |
18 | // This is technically user input, so need to make sure this isn't
19 | // anything fun like unicode characters or javascript.
20 | // It will still go through DNS, so that's something.
21 | s
22 | }
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/play-scala-fileupload-example/build.sbt:
--------------------------------------------------------------------------------
1 | lazy val root = (project in file("."))
2 | .enablePlugins(PlayScala)
3 | //.enablePlugins(PlayNettyServer).disablePlugins(PlayPekkoHttpServer) // uncomment to use the Netty backend
4 | .settings(
5 | name := """play-scala-fileupload-example""",
6 | version := "1.0-SNAPSHOT",
7 | crossScalaVersions := Seq("2.13.16", "3.3.6"),
8 | scalaVersion := crossScalaVersions.value.head,
9 | libraryDependencies ++= Seq(
10 | ws,
11 | guice,
12 | "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.2" % Test
13 | ),
14 | scalacOptions ++= Seq(
15 | "-feature",
16 | "-Werror"
17 | ),
18 | // Needed for ssl-config to create self signed certificated under Java 17
19 | Test / javaOptions ++= List("--add-exports=java.base/sun.security.x509=ALL-UNNAMED"),
20 | )
21 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/person/test/IntegrationSpec.scala:
--------------------------------------------------------------------------------
1 | import org.specs2.mutable._
2 | import org.specs2.runner._
3 | import org.junit.runner._
4 |
5 | import play.api.test._
6 | import play.api.test.Helpers._
7 |
8 | @RunWith(classOf[JUnitRunner])
9 | class IntegrationSpec extends Specification {
10 |
11 | "Application" should {
12 |
13 | "send 404 on a bad request" in new WithApplication {
14 | override def running() =
15 | status(route(app, FakeRequest(GET, "/boum")).get) must_== NOT_FOUND
16 | }
17 |
18 | "render the index page" in new WithApplication {
19 | override def running() = {
20 | val home = route(app, FakeRequest(GET, "/")).get
21 |
22 | status(home) must equalTo(OK)
23 | contentType(home) must beSome[String].which(_ == "text/html")
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/play-scala-tls-example/scripts/genca.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | export PW=`cat password`
4 |
5 | # Create a self signed key pair root CA certificate.
6 | keytool -genkeypair -v \
7 | -alias exampleca \
8 | -dname "CN=exampleCA, OU=Example Org, O=Example Company, L=San Francisco, ST=California, C=US" \
9 | -keystore exampleca.p12 \
10 | -storetype PKCS12 \
11 | -keypass:env PW \
12 | -storepass:env PW \
13 | -keyalg EC \
14 | -keysize 256 \
15 | -ext KeyUsage:critical="keyCertSign" \
16 | -ext BasicConstraints:critical="ca:true" \
17 | -validity 9999
18 |
19 | # Export the exampleCA public certificate so that it can be used in trust stores..
20 | keytool -export -v \
21 | -alias exampleca \
22 | -file exampleca.crt \
23 | -keypass:env PW \
24 | -storepass:env PW \
25 | -keystore exampleca.p12 \
26 | -storetype PKCS12 \
27 | -rfc
28 |
--------------------------------------------------------------------------------
/play-java-chatroom-example/app/filters/ContentSecurityPolicyFilter.java:
--------------------------------------------------------------------------------
1 | package filters;
2 |
3 | import controllers.routes;
4 | import play.core.Execution;
5 | import play.mvc.EssentialAction;
6 | import play.mvc.EssentialFilter;
7 | import play.mvc.Http;
8 | import play.mvc.Result;
9 |
10 | public class ContentSecurityPolicyFilter extends EssentialFilter {
11 | @Override
12 | public EssentialAction apply(EssentialAction next) {
13 |
14 | return EssentialAction.of((Http.RequestHeader requestHeader) -> {
15 | String webSocketUrl = routes.HomeController.chat().webSocketURL(requestHeader.asScala());
16 | return next.apply(requestHeader).map((Result result) ->
17 | result.withHeader("Content-Security-Policy", "connect-src 'self' " + webSocketUrl), Execution.trampoline());
18 | });
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/play-scala-rest-api-example/conf/secure.conf:
--------------------------------------------------------------------------------
1 | # Set up Play for HTTPS and locked down allowed hosts.
2 | # Nothing in here is required for REST, but it's a good default.
3 | play {
4 | http {
5 | cookies.strict = true
6 |
7 | session.secure = true
8 | session.httpOnly = true
9 |
10 | flash.secure = true
11 | flash.httpOnly = true
12 |
13 | forwarded.trustedProxies = ["::1", "127.0.0.1"]
14 | }
15 |
16 | i18n {
17 | langCookieSecure = true
18 | langCookieHttpOnly = true
19 | }
20 |
21 | filters {
22 | csrf {
23 | cookie.secure = true
24 | }
25 |
26 | hosts {
27 | allowed = ["localhost:9443", "localhost:9000"]
28 | }
29 |
30 | hsts {
31 | maxAge = 1 minute # don't interfere with other projects
32 | secureHost = "localhost"
33 | securePort = 9443
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/play-java-starter-example/app/services/AtomicCounter.java:
--------------------------------------------------------------------------------
1 | package services;
2 |
3 | import java.util.concurrent.atomic.AtomicInteger;
4 | import javax.inject.*;
5 |
6 | /**
7 | * This class is a concrete implementation of the {@link Counter} trait.
8 | * It is configured for Guice dependency injection in the {@link Module}
9 | * class.
10 | *
11 | * This class has a {@link Singleton} annotation because we need to make
12 | * sure we only use one counter per application. Without this
13 | * annotation we would get a new instance every time a {@link Counter} is
14 | * injected.
15 | */
16 | @Singleton
17 | public class AtomicCounter implements Counter {
18 |
19 | private final AtomicInteger atomicCounter = new AtomicInteger();
20 |
21 | @Override
22 | public int nextCount() {
23 | return atomicCounter.getAndIncrement();
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/play-java-jpa-example/README.md:
--------------------------------------------------------------------------------
1 | # play-java-jpa-example
2 |
3 | This project demonstrates how to create a simple database application with Play, using JPA.
4 |
5 | Please see the Play documentation for more details:
6 |
7 | * https://www.playframework.com/documentation/latest/JavaJPA
8 | * https://www.playframework.com/documentation/latest/ThreadPools
9 | * https://www.playframework.com/documentation/latest/JavaAsync
10 |
11 | ## Server backend
12 |
13 | By default, the project uses the Pekko HTTP Server backend. To switch to the Netty Server backend, enable the `PlayNettyServer` sbt plugin in the `build.sbt` file.
14 | In the `build.sbt` of this project, you'll find a commented line for this setting; simply uncomment it to make the switch.
15 | For more detailed information, refer to the Play Framework [documentation](https://www.playframework.com/documentation/3.0.x/Server).
16 |
--------------------------------------------------------------------------------
/play-scala-isolated-slick-example/conf/routes:
--------------------------------------------------------------------------------
1 | # Routes
2 | # This file defines all application routes (Higher priority routes first)
3 | # ~~~~
4 |
5 | # User Routes
6 |
7 | GET / controllers.UserController.index
8 | GET /users/all controllers.UserController.findAll
9 |
10 | GET /users/new controllers.UserController.create
11 | POST /users controllers.UserController.save
12 |
13 | GET /users/:id/edit controllers.UserController.edit(id: String)
14 | POST /users/:id controllers.UserController.update(id: String)
15 |
16 | GET /users/:id/delete controllers.UserController.delete(id: String)
17 |
18 | # Map static resources from the /public folder to the /assets URL path
19 | GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
20 |
--------------------------------------------------------------------------------
/play-scala-macwire-di-example/README.md:
--------------------------------------------------------------------------------
1 | # play-scala-macwire-di-example
2 |
3 | This is an example project for setting up Play with Macwire compile time dependency injection.
4 |
5 | For further details, please see:
6 |
7 | *
8 | *
9 | *
10 |
11 | ## Server backend
12 |
13 | By default, the project uses the Pekko HTTP Server backend. To switch to the Netty Server backend, enable the `PlayNettyServer` sbt plugin in the `build.sbt` file.
14 | In the `build.sbt` of this project, you'll find a commented line for this setting; simply uncomment it to make the switch.
15 | For more detailed information, refer to the Play Framework [documentation](https://www.playframework.com/documentation/3.0.x/Server).
16 |
--------------------------------------------------------------------------------
/play-scala-forms-example/conf/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | %highlight(%-5level) %logger{15} - %message%n%xException{10}
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/play-scala-slick-example/samples/computer-database/app/views/main.scala.html:
--------------------------------------------------------------------------------
1 | @(content: Html)
2 |
3 |
4 |
5 |
6 | Computers database
7 |
8 |
9 |
10 |
11 |
12 |
19 |
20 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/play-scala-starter-example/build.sbt:
--------------------------------------------------------------------------------
1 | lazy val root = (project in file("."))
2 | .enablePlugins(PlayScala)
3 | //.enablePlugins(PlayNettyServer).disablePlugins(PlayPekkoHttpServer) // uncomment to use the Netty backend
4 | .settings(
5 | name := """play-scala-starter-example""",
6 | version := "1.0-SNAPSHOT",
7 | crossScalaVersions := Seq("2.13.16", "3.3.6"),
8 | scalaVersion := crossScalaVersions.value.head,
9 | libraryDependencies ++= Seq(
10 | guice,
11 | "com.h2database" % "h2" % "2.3.232",
12 | "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.2" % Test,
13 | ),
14 | scalacOptions ++= Seq(
15 | "-feature",
16 | "-Werror"
17 | ),
18 | // Needed for ssl-config to create self signed certificated under Java 17
19 | Test / javaOptions ++= List("--add-exports=java.base/sun.security.x509=ALL-UNNAMED"),
20 | )
21 |
--------------------------------------------------------------------------------
/play-scala-chatroom-example/app/filters/ContentSecurityPolicyFilter.scala:
--------------------------------------------------------------------------------
1 | package filters
2 |
3 | import javax.inject.Inject
4 |
5 | import controllers.routes
6 | import play.api.mvc.{EssentialAction, EssentialFilter, RequestHeader}
7 |
8 | import scala.concurrent.ExecutionContext
9 |
10 | /**
11 | * Set up a more flexible content security policy that points to self and the given
12 | * websocket URL.
13 | */
14 | class ContentSecurityPolicyFilter @Inject()(implicit ec: ExecutionContext) extends EssentialFilter {
15 |
16 | override def apply(next: EssentialAction): EssentialAction = EssentialAction { (request: RequestHeader) => {
17 | val webSocketUrl = routes.HomeController.chat().webSocketURL()(request)
18 | next(request).map { result =>
19 | result.withHeaders("Content-Security-Policy" -> s"connect-src 'self' ${webSocketUrl}")
20 | }
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------