Play Framework for Web Application Development
Play is one of the most popular frameworks powered by Java, which integrates components and APIs for modern web application development.
In this tutorial, you’ll see how to deploy Play at Jelastic PaaS without any code changes.
1. Java 8 is required for using the Play framework, so let’s create a suitable environment. For example, we’ll use the Oracle OpenJDK 8.0.22 version of the Tomcat application server.
2. Once the environment is ready, you can deploy your Play application. We are using the following Hello World package as a sample:
3. Our application works on the 9000 port, so it should be opened via the container firewall. Add a new inbound rule similar to the image below.
echo play.filters.disabled+=play.filters.hosts.AllowedHostsFilter >> /opt/tomcat/webapps/ROOT/play-samples-play-java-hello-world-tutorial/conf/application.conf
6. Execute the next two commands sequentially to move into the application’s directory and run it.
cd /opt/tomcat/webapps/ROOT/play-samples-play-java-hello-world-tutorial/ bash ./sbt-dist/bin/sbt run
7. Now, you can access your application in the browser using the Access URL of the endpoint you’ve created earlier.
In our case, the following page should be displayed:
That’s it! Your Play application is up and running, try Jelastic PaaS for yourself with a two-weeks trial at one of our partners.