### Verify Play Framework Installation Source: https://www.playframework.com/documentation/1.5.x/guide1 This command is used to confirm that the Play Framework has been successfully installed and is accessible from the system's command line. Executing it should display the basic usage help for the `play` utility, indicating correct setup. ```Shell play ``` -------------------------------- ### Create and Run Play Java Application Source: https://www.playframework.com/documentation/2.4.x/Installing This snippet demonstrates how to create a new Play Framework Java application from a template and then run it using the Activator command-line tool. It initializes a project, navigates into its directory, and starts the development server, accessible via http://localhost:9000. ```Shell activator new my-first-app play-java cd my-first-app activator run ``` -------------------------------- ### Execute and Get Help for Play Commands Source: https://www.playframework.com/documentation/1.2.x/install Demonstrates how to invoke the main `play` command from the shell to interact with the Play Framework. It also shows how to get detailed help for specific commands, such as `run`, providing usage information and options. ```Shell play ``` ```Shell play help run ``` -------------------------------- ### Verify Play Framework Installation Source: https://www.playframework.com/documentation/2.0.x/Installing This command is used to verify that the Play Framework has been successfully installed and its executable is accessible via the system PATH. Executing `play help` should display the basic help information, confirming the setup. ```bash $ play help ``` -------------------------------- ### Verify Play Framework Installation Source: https://www.playframework.com/documentation/switch/1.4.x/guide1 This command is used to verify that the Play Framework has been correctly installed and its executable is accessible via the system's PATH. Executing `play` without arguments should display the basic usage help, confirming successful setup. ```Shell play ``` -------------------------------- ### Get Help for Play Framework Commands Source: https://www.playframework.com/documentation/switch/1.4.x/install Shows how to use the 'play help' command to obtain detailed assistance and documentation for specific Play Framework commands, such as 'run'. ```Shell # play help run ``` -------------------------------- ### Verify Play Framework Installation Source: https://www.playframework.com/documentation/1.3.x/guide1 After installing the Play framework and ensuring its directory is added to your system's PATH, execute this command in a new terminal. A successful installation will display the basic usage help for the Play utility, confirming that the framework is accessible from the command line. ```Unix Shell play ``` -------------------------------- ### Run Play Application using SBT Source: https://www.playframework.com/documentation/2.5.x/Installing This command initiates a Play Framework application using the Scala Build Tool (SBT). It compiles and runs the application, typically starting a local development server. This is the primary way to run Play applications from the command line. ```Shell sbt run ``` -------------------------------- ### Run Play Framework Application with SBT Source: https://www.playframework.com/documentation/switch/2.5.x/Installing Executes the Play Framework application using the SBT (Scala Build Tool) launcher. This command starts the development server, making the application accessible, and is the primary way to run Play applications from the command line. ```Shell sbt run ``` -------------------------------- ### Play Framework Command Line Utility Reference Source: https://www.playframework.com/documentation/switch/1.3.x/guide1 This section outlines the primary commands for interacting with the Play framework via its command-line utility. These commands are essential for verifying installation and managing application-specific caches. ```APIDOC play - Description: Displays the basic usage help for the Play framework utility. - Usage: Used to verify Play installation and access general commands. play clean - Description: Discards the application's bytecode cache, located in the `tmp/` directory. - Usage: Useful for clearing cached compiled files, especially in large applications or to resolve compilation issues between restarts. ``` -------------------------------- ### Get Help for Specific Play Commands Source: https://www.playframework.com/documentation/switch/1.3.x/install Displays detailed help information for a particular Play command, such as 'run'. This is useful for understanding the command's available options, arguments, and general usage. ```Shell # play help run ``` -------------------------------- ### Build Play Framework from Source Source: https://www.playframework.com/documentation/switch/1.4.x/install Instructions to clone the Play Framework repository from GitHub and build it using Ant. This process requires a Git client and Ant to be installed on the system. ```Shell # git clone git://github.com/playframework/play.git # cd play/framework # ant ``` -------------------------------- ### Start SBT Console for an Existing Play Project Source: https://www.playframework.com/documentation/3.0.4/BuildingFromSource Navigates into an existing Play project directory and starts the SBT console. This allows developers to interact with their project, running tasks like `run`, `compile`, or `test` using the locally configured Play Framework build. ```bash cd sbt ``` -------------------------------- ### Execute Play Framework Command Source: https://www.playframework.com/documentation/switch/1.2.x/install Demonstrates the basic invocation of the 'play' command from the shell. This is used to confirm that the Play Framework is correctly installed and accessible in the system's PATH. ```Shell $ play ``` -------------------------------- ### Verify Play Framework Installation Source: https://www.playframework.com/documentation/switch/1.5.x/guide1 This command is used to verify that the Play Framework has been correctly installed and added to the system's PATH. Executing `play` without arguments should display the basic usage help, confirming accessibility of the Play utility from the command line. ```Shell play ``` -------------------------------- ### Execute Play Framework Command Source: https://www.playframework.com/documentation/switch/1.4.x/install Demonstrates how to invoke the main 'play' command from the shell to start the Play Framework environment and display its default message. ```Shell $ play ``` -------------------------------- ### Create New Play Framework Application Source: https://www.playframework.com/documentation/switch/1.1.1/firstapp This shell command initializes a new Play Framework project with the specified name. It sets up the default directory structure and prompts for the application's full name, streamlining the setup process for new applications. ```Shell play new helloworld ``` -------------------------------- ### Using WsTestClient for Functional Testing in Scala Source: https://www.playframework.com/documentation/switch/3.0.0/WSMigration26 Example of using `play.api.test.WsTestClient.withClient` to perform functional tests in Scala. This utility automatically starts and shuts down a standalone `WSClient` instance, simplifying testing setup and teardown. ```Scala play.api.test.WsTestClient.withClient { ws => ws.url("http://localhost:9000/foo").get() } ``` -------------------------------- ### Build and Serve Play Framework Documentation Locally Source: https://www.playframework.com/documentation/3.0.4/BuildingFromSource Navigates into the Play Framework's documentation directory and starts an SBT process to build and serve the documentation. The documentation becomes accessible via a local web server, typically at `http://localhost:9000/@documentation`. ```bash cd playframework/documentation sbt run ``` -------------------------------- ### Java JUnit Superclasses Automatic Setup Source: https://www.playframework.com/documentation/2.8.x/Migration23 This example highlights the change in Play Framework's Java JUnit test superclasses (`WithApplication`, `WithServer`, `WithBrowser`). They now automatically initialize the application via an `@Before` annotated method, eliminating the need for manual `start()` calls in `setUp()`. ```Java @Before public void setUp() { start(); } ``` -------------------------------- ### Install Play Framework on macOS using Homebrew Source: https://www.playframework.com/documentation/1.5.x/install Provides an alternative installation method for Play Framework on macOS. After installing Homebrew, this command fetches and installs the Play Framework package, simplifying the setup process. ```Shell brew install play ``` -------------------------------- ### Get Help for Play Framework Commands Source: https://www.playframework.com/documentation/switch/1.2.x/install Shows how to use the 'play help' command to retrieve detailed assistance and usage information for specific Play Framework commands, such as 'run'. This is useful for understanding command parameters and options. ```Shell # play help run ``` -------------------------------- ### Build and Serve Play Framework Documentation Locally Source: https://www.playframework.com/documentation/3.0.2/BuildingFromSource Navigates to the documentation directory and starts an SBT server to build and serve the Play Framework documentation as HTML. The documentation can then be browsed in a web browser. ```bash cd playframework/documentation sbt run ``` -------------------------------- ### Initialize Git VCS for Play Framework Project Source: https://www.playframework.com/documentation/switch/1.3.x/guide1 This command initializes a new Git repository in the root directory of the Play Framework application. This is the first step to start tracking changes to your project's source code using Git. ```bash $ git init ``` -------------------------------- ### Play Framework Controller Compilation Error Example Source: https://www.playframework.com/documentation/switch/1.0.3.2/guide1 This Java snippet demonstrates how a syntax error (missing semicolon) in a Play Framework controller's action method leads to a compilation error, which Play detects and reports during live reloading. ```Java public static void index() { render() } ``` -------------------------------- ### Create and Run a Play Framework Application Source: https://www.playframework.com/documentation/switch/2.4.x/Installing Commands to create a new Play application from a template (e.g., 'play-java') and run it locally using the Activator command-line tool. This sequence initializes a project, navigates into its directory, and starts the application server. ```Shell activator new my-first-app play-java cd my-first-app activator run ``` -------------------------------- ### Initial Play Framework Java Controller Example Source: https://www.playframework.com/documentation/switch/1.0.3.2/guide1 This Java code defines the `Application` controller in a Play Framework application. It extends `play.mvc.Controller` and includes a `public static void index()` action method, which uses `render()` to display a template. ```Java package controllers; import play.mvc.*; public class Application extends Controller { public static void index() { render(); } } ``` -------------------------------- ### Build and Serve Play Framework Documentation Locally Source: https://www.playframework.com/documentation/switch/3.0.7/BuildingFromSource Navigates into the Play Framework's documentation directory and starts an SBT process to build and serve the documentation locally. The documentation becomes accessible via a web browser at the specified localhost address. ```Bash cd playframework/documentation sbt run ``` -------------------------------- ### Define Play Framework Application Routes Source: https://www.playframework.com/documentation/switch/1.1.1/firstapp This snippet shows how to define a basic route in Play Framework's `conf/routes` file. It maps a GET request to the root path (`/`) to the `index` method within the `Application` controller, which is a shortcut for `controllers.Application.index`. ```Play Framework GET / Application.index ``` -------------------------------- ### Configure Play Framework for H2 In-Memory Database Source: https://www.playframework.com/documentation/switch/1.3.x/guide1 This snippet shows how to configure the Play Framework application to use an in-memory H2 database for development purposes. By uncommenting this line in `yabe/conf/application.conf`, the application will start with a fresh dataset on each restart, which is ideal for early development and testing. ```properties db=mem ``` -------------------------------- ### Get Help for a Specific Play Command Source: https://www.playframework.com/documentation/1.3.x/install Demonstrates how to use the 'play help' command to retrieve detailed assistance and usage information for a specific Play command, such as 'run'. This is an essential command for understanding the various options and parameters available for each Play utility. ```Shell # play help run ``` -------------------------------- ### Run Play Application in Test Mode Source: https://www.playframework.com/documentation/switch/1.1.1/firstapp This shell command starts the Play Framework application in 'test' mode. This mode loads a special test runner module, allowing developers to execute test suites directly from a web browser via a dedicated URL. ```Shell play test ``` -------------------------------- ### Start Play Documentation Server with sbt Source: https://www.playframework.com/documentation/switch/3.0.7/Translations Demonstrates how to start the local documentation server using `sbt run`. The output shows the server initialization process, including the port it listens on (9000 by default), and confirms that the documentation is accessible via a web browser. ```Shell $ sbt run [info] Set current project to root (in build file:/Users/jroper/tmp/foo-translation/) [info] play - Application started (Dev) [info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000 Documentation server started, you can now view the docs by going to http://0:0:0:0:0:0:0:0:9000 ``` -------------------------------- ### Launch sbt Console for Manual Play Project Source: https://www.playframework.com/documentation/2.3.x/NewApplication Provides the commands to navigate into the project directory and start the sbt console, which will load the project and fetch dependencies, completing the manual setup process for a Play application. ```bash $ cd my-first-app $ sbt ``` -------------------------------- ### Define Application Routes in Play Framework Source: https://www.playframework.com/documentation/switch/1.0.3.2/guide1 This snippet shows how the `conf/routes` file maps incoming HTTP requests to specific controller action methods in a Play Framework application. It defines that a GET request to the root path (/) should invoke the `Application.index` method. ```Play Framework Routes GET\t\t/\t\t\tApplication.index ``` -------------------------------- ### Define Root Path Route in Play Framework Source: https://www.playframework.com/documentation/1.5.x/guide1 This snippet shows how to define a route in Play Framework's `conf/routes` file. It maps a GET request for the root URL (`/`) to the `index` method within the `Application` controller, which implicitly refers to `controllers.Application.index`. ```Play Framework Routes GET / Application.index ``` -------------------------------- ### Get Help for Specific Play Framework Commands Source: https://www.playframework.com/documentation/1.1.1/install This command provides detailed help and usage information for any specific Play Framework command. By replacing `any-command-name-here` with a command like `run`, users can understand its parameters, options, and functionality. ```Shell play help run ``` -------------------------------- ### Create New Play Projects with sbt new Source: https://www.playframework.com/documentation/2.5.x/Tutorials These commands use `sbt new` with `giter8` templates to quickly scaffold new Play applications. They provide a minimal 'hello world' setup for either Java or Scala, designed for getting started with new Play applications. ```Java sbt new playframework/play-java-seed.g8 ``` ```Scala sbt new playframework/play-scala-seed.g8 ``` -------------------------------- ### Build and Serve Play Framework Documentation Locally Source: https://www.playframework.com/documentation/switch/3.0.5/BuildingFromSource Steps to navigate to the documentation directory within the Play Framework source and run sbt to build and serve the documentation locally. This allows developers to preview changes to the documentation. ```Shell cd playframework/documentation sbt run ``` -------------------------------- ### Get Help for a Specific Play Command Source: https://www.playframework.com/documentation/1.4.x/install This command provides detailed usage information and available options for a particular Play Framework command. By appending the command name (e.g., 'run') to 'play help', users can quickly understand the parameters, functionality, and examples for that specific operation. ```Shell play help run ``` -------------------------------- ### Build and Serve Play Framework Documentation Locally Source: https://www.playframework.com/documentation/switch/3.0.6/BuildingFromSource Navigates to the documentation directory within the Play Framework source and starts an sbt process to build and serve the documentation locally. This allows browsing the documentation in HTML format via a web browser. ```bash cd playframework/documentation sbt run ``` -------------------------------- ### Execute Play Command Line Interface Source: https://www.playframework.com/documentation/switch/1.3.x/install Executes the main 'play' command to verify the framework's installation and display its default help message. This command is the entry point for interacting with the Play Framework CLI. ```Shell $ play ``` -------------------------------- ### Install Play Framework on macOS using Homebrew Source: https://www.playframework.com/documentation/switch/1.3.x/install For macOS users, Play Framework can be easily installed using Homebrew, a popular package manager. This command adds the Play Framework to your system, simplifying the setup process. ```Shell brew install play ``` -------------------------------- ### Run Play Documentation Server Source: https://www.playframework.com/documentation/3.0.x/Documentation Execute this command from within the `documentation` directory to start a local Play server that serves the generated documentation, allowing for visual inspection and rendering validation. ```sbt sbt run ``` -------------------------------- ### Build and Serve Play Documentation Locally Source: https://www.playframework.com/documentation/3.0.0/BuildingFromSource These commands navigate into the Play Framework's documentation directory and then run an sbt task to build and serve the documentation locally. Once running, the documentation is typically accessible via a web browser at `http://localhost:9000/@documentation`. ```bash cd playframework/documentation sbt run ``` -------------------------------- ### Play Framework Java Controller Compilation Error Example Source: https://www.playframework.com/documentation/1.5.x/guide1 This code demonstrates a deliberate compilation error in a Play Framework controller by omitting a semicolon. It's used to show Play's ability to detect and report compilation issues during hot-reloading, providing immediate feedback to the developer. ```Java public static void index() { render() } ``` -------------------------------- ### Commit Initial Version to Bazaar VCS for Play Framework Source: https://www.playframework.com/documentation/switch/1.3.x/guide1 After initializing the Bazaar repository and setting up ignore rules, these commands add all current files to the repository and perform the first commit. The commit message 'YABE initial version' marks the starting point of the project's version history. ```bash $ bzr add $ bzr commit -m "YABE initial version" ``` -------------------------------- ### Build and Serve Play Framework Documentation Locally Source: https://www.playframework.com/documentation/switch/3.0.3/BuildingFromSource These commands navigate into the `playframework/documentation` directory and then execute `sbt run`. This process compiles the Markdown documentation files into HTML and starts a local web server, allowing developers to browse the documentation at `http://localhost:9000/@documentation`. ```bash cd playframework/documentation sbt run ``` -------------------------------- ### Play Framework Main Layout Template Source: https://www.playframework.com/documentation/switch/1.0.3.2/guide1 This Play Framework template defines the `main.html` layout, which serves as the base for other views. It includes standard HTML boilerplate, links to CSS and favicon, and uses the `#{get 'title' /}` and `#{doLayout /}` tags for dynamic content and inherited template insertion. ```Play Framework Template #{get 'title' /} #{doLayout /} ``` -------------------------------- ### Play Framework: HTML Form for Name Input Source: https://www.playframework.com/documentation/switch/1.1.1/firstapp Defines an HTML form within a Play Framework template (`index.html`) to capture a user's name. It utilizes Play's `@{…}` notation for automatic URL generation to the `Application.sayHello` action and submits data using the GET method. ```HTML+Play Templates #{extends 'main.html' /} #{set title:'Home' /}
``` -------------------------------- ### Define a Play Framework Route Source: https://www.playframework.com/documentation/switch/1.3.x/guide1 This snippet illustrates how to define a basic route in the Play Framework's `conf/routes` file. It maps an HTTP GET request for the root path ('/') to the `index` method within the `Application` controller, serving as the application's entry point for that specific URL. ```Play Framework Routes GET / Application.index ``` -------------------------------- ### Start Play Documentation Server with sbt Source: https://www.playframework.com/documentation/3.0.1/Translations Demonstrates how to start the documentation server using the `sbt run` command. The output shows the server initialization process and the local URL where the documentation can be accessed in a web browser. ```Shell $ sbt run [info] Set current project to root (in build file:/Users/jroper/tmp/foo-translation/) [info] play - Application started (Dev) [info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000 Documentation server started, you can now view the docs by going to http://0:0:0:0:0:0:0:0:9000 ``` -------------------------------- ### Build and Serve Play Framework Documentation Source: https://www.playframework.com/documentation/3.0.3/BuildingFromSource Navigates to the Play Framework documentation directory and starts a local server. This allows browsing the HTML version of the documentation, typically accessible at `http://localhost:9000/@documentation`. ```Shell $ cd playframework/documentation $ sbt run ``` -------------------------------- ### Main Play Framework Layout Template Source: https://www.playframework.com/documentation/switch/1.3.x/guide1 This HTML snippet represents the `main.html` layout template, which serves as the base for other templates in a Play Framework application. It defines the common HTML structure, includes stylesheets and scripts, and uses `#{get /}` tags for dynamic content insertion and `#{doLayout /}` as a placeholder for child template content. ```Play Framework Template #{get 'title' /} #{get 'moreStyles' /} #{get 'moreScripts' /} #{doLayout /} ``` -------------------------------- ### Build and Serve Play Documentation Locally Source: https://www.playframework.com/documentation/3.0.5/BuildingFromSource Navigates into the Play Framework documentation directory and then starts an sbt process to build and serve the documentation locally. The documentation will be accessible via a web browser at http://localhost:9000/@documentation. ```bash cd playframework/documentation sbt run ``` -------------------------------- ### Accessing and Setting Request Attributes in Scala Source: https://www.playframework.com/documentation/3.0.x/Migration26 This example demonstrates the recommended approach for using request attributes in Scala. It defines a `TypedKey` for type-safe attribute access and shows how to get, optionally get, and add attributes to a request. ```Scala object Attrs { val UserName: TypedKey[String] = TypedKey("userName") } // Getting an attribute from a Request or RequestHeader val userName: String = req.attrs(Attrs.UserName) val optUserName: [String] = req.attrs.get(Attrs.UserName) // Setting an attribute on a Request or RequestHeader val newReq = req.addAttr(Attrs.UserName, newName) ``` -------------------------------- ### Start SBT Console for Play Framework Development Source: https://www.playframework.com/documentation/switch/3.0.5/BuildingFromSource How to start the sbt interactive console within the cloned Play Framework project directory. This console is used for executing build, test, and publish commands. ```Shell sbt ``` -------------------------------- ### Play Framework Textmate Bundle Installation Source: https://www.playframework.com/documentation/switch/1.4.x/ide Instructions for installing the Textmate bundle provided with Play Framework. This bundle enhances the Textmate editor with syntax coloring, auto-completion, and improved navigation for Play application development. ```APIDOC Textmate Bundle Installation: Description: Enables syntax coloring, auto-completion, and navigation between controllers and views. Installation: Install the Textmate bundle provided at `$PLAY_HOME/support/textmate.zip`. ``` -------------------------------- ### Build and serve Play Framework documentation locally Source: https://www.playframework.com/documentation/3.0.6/BuildingFromSource Navigates into the documentation directory of the Play Framework source and starts the sbt application to build and serve the documentation. The documentation becomes accessible via a local web server. ```bash cd playframework/documentation sbt run ``` -------------------------------- ### Build and Serve Play Documentation Locally Source: https://www.playframework.com/documentation/switch/3.0.2/BuildingFromSource Navigates to the Play Framework documentation directory and starts a local server to build and serve the documentation in HTML format. This enables developers to browse and verify documentation changes locally. ```shell cd playframework/documentation sbt run ``` -------------------------------- ### Configure H2 In-Memory Database for Play Framework Source: https://www.playframework.com/documentation/2.1.x/JavaTodoList Configures the default database connection in Play Framework's `application.conf` to use an H2 in-memory database. This setup is suitable for development and testing, providing a quick way to get a database running without external setup. ```Configuration db.default.driver=org.h2.Driver db.default.url="jdbc:h2:mem:play" ``` -------------------------------- ### Create a New Play Framework Application Project Source: https://www.playframework.com/documentation/2.1.x/JavaTodoList This command initializes a new Play Framework project with a specified name (e.g., 'todolist'). It prompts the user to select a project template, typically a simple Java application, and automatically sets up the standard directory structure for the new project. ```bash $ play new todolist ``` -------------------------------- ### Verify Java and Javac Versions Source: https://www.playframework.com/documentation/2.4.x/Installing These commands are used to check the installed versions of the Java Runtime Environment (JRE) and the Java Compiler (javac). This is crucial for ensuring compatibility with Play Framework, which requires JDK 1.8 or later. ```Shell java -version javac -version ``` -------------------------------- ### Adding Java Module Exports to Production Start Script Source: https://www.playframework.com/documentation/2.9.x/Migration29 Provides an example of how to include the `--add-exports` flag directly in the script that starts a packaged Play application, particularly useful for self-signed certificates in production-like testing environments. ```shell -J--add-exports=java.base/sun.security.x509=ALL-UNNAMED #-Dhttp.port=disabled -Dhttps.port=9443 ``` -------------------------------- ### Build and Serve Play Framework Documentation Locally Source: https://www.playframework.com/documentation/3.0.8/BuildingFromSource Navigates into the Play Framework's documentation directory and then runs the sbt 'run' command to build and serve the documentation locally. The documentation becomes accessible via a local web server, typically at http://localhost:9000/@documentation. ```Shell $ cd playframework/documentation $ sbt run ``` -------------------------------- ### Run Play Documentation Server Source: https://www.playframework.com/documentation/2.9.x/Documentation This command starts a small Play server specifically designed to serve the documentation. Running this allows developers to preview how the documentation renders and ensure its correct display in a browser. ```sbt sbt run ``` -------------------------------- ### Start SBT Console for Existing Play Project Source: https://www.playframework.com/documentation/switch/3.0.5/BuildingFromSource How to start the sbt interactive console within an existing Play project directory. This is the standard way to interact with a Play application for development tasks like running, compiling, and testing. ```Shell cd sbt ``` -------------------------------- ### Build and Serve Play Framework Documentation Locally Source: https://www.playframework.com/documentation/2.7.x/BuildingFromSource Navigates to the documentation directory and starts the sbt server to build and serve the Play Framework documentation as HTML, accessible via a local web server. ```bash cd playframework/documentation sbt run ``` -------------------------------- ### Accessing and Setting Request Attributes in Java Source: https://www.playframework.com/documentation/3.0.x/Migration26 This example illustrates the recommended way to use request attributes in Java. It defines a `TypedKey` for type-safe attribute access and shows how to get, optionally get, and set attributes on a request, as well as using `RequestBuilder.attr()`. ```Java class Attrs { public static final TypedKey USER_NAME = TypedKey.create("userName"); } // Getting an attribute from a Request or RequestHeader String userName = req.attrs().get(Attrs.USER_NAME); String userName = req.attrs().getOptional(Attrs.USER_NAME); // Setting an attribute on a Request or RequestHeader Request newReq = req.withTags(req.tags().put(Attrs.USER_NAME, newName)); // Setting an attribute with a RequestBuilder Request builtReq = requestBuilder.attr(Attrs.USER_NAME, newName).build(); ``` -------------------------------- ### Build Play Framework from Source Source: https://www.playframework.com/documentation/switch/1.3.x/install Clones the Play Framework repository from GitHub, navigates into the framework directory, and compiles the project using Ant. This process requires Git and Ant to be installed on the system. ```Shell # git clone git://github.com/playframework/play.git # cd play/framework # ant ``` -------------------------------- ### Add Activator to Unix System PATH Source: https://www.playframework.com/documentation/2.4.x/Installing This command adds the Activator installation directory to the system's PATH environment variable on Unix-like systems. This allows the 'activator' command to be executed from any location in the terminal without specifying its full path. ```Unix Shell export PATH=/path/to/activator:$PATH ``` -------------------------------- ### Create a New Play Framework Scala Application Source: https://www.playframework.com/documentation/2.2.x/ScalaTodoList This command initializes a new Play Framework project with a specified name, prompting the user to select a project template. For this tutorial, the 'Create a simple Scala application' template is chosen, setting up the standard directory structure for a new Play application. ```bash $ play new todolist ``` -------------------------------- ### Serve Play Framework Documentation Locally Source: https://www.playframework.com/documentation/latest/Documentation This sbt command starts a small Play server specifically designed to serve the documentation. It allows developers to preview and ensure that the documentation renders correctly in a local environment. ```sbt sbt run ``` -------------------------------- ### Override Java JUnit provideFakeApplication for custom setup Source: https://www.playframework.com/documentation/2.3.x/Migration23 Demonstrates how to provide a custom fake application in Java JUnit tests by overriding the `provideFakeApplication` method. This approach replaces the need for an explicit `start()` call in `@Before` methods, allowing for more flexible test setups. ```Java @Override protected FakeApplication provideFakeApplication() { return Helpers.fakeApplication(Helpers.inMemoryDatabase()); } ``` -------------------------------- ### Build Play Framework from Source Source: https://www.playframework.com/documentation/switch/1.2.x/install Instructions to clone the Play Framework repository from GitHub and build it using Ant. This process requires a Git client and Ant to be installed on the system to compile the framework from its latest sources. ```Shell # git clone git://github.com/playframework/play.git # cd play/framework # ant ``` -------------------------------- ### Java WSResponse Get Body As Source Example Source: https://www.playframework.com/documentation/switch/3.0.0/Migration27 Demonstrates how to convert a `WSResponse` body into a `Source` using the `getBodyAsSource` method, typically after streaming the response. ```Java wsClient.url("https://www.playframework.com") .stream() // this returns a CompletionStage .thenApply(StandaloneWSResponse::getBodyAsSource); ``` -------------------------------- ### Start Basic Play Netty Server with Scala Routing DSL Source: https://www.playframework.com/documentation/switch/2.7.x/ScalaEmbeddingPlayNetty This example demonstrates how to start a simple Play Netty server using `NettyServer.fromRouterWithComponents()` and define routes with the String Interpolating Routing DSL (SIRD). It sets up a basic GET endpoint for '/hello/:to'. ```Scala import play.api.mvc._ import play.api.routing.sird._ import play.core.server._ val server = NettyServer.fromRouterWithComponents() { components => import components.{ defaultActionBuilder => Action } { case GET(p"/hello/$to") => Action { Results.Ok(s"Hello $to") } } } ``` -------------------------------- ### Creating a New Play Framework Application via Command Line Source: https://www.playframework.com/documentation/switch/1.0.3.2/guide1 This command initializes a new Play framework project with a specified name. It sets up the standard directory structure and essential configuration files, prompting for the application's full name during execution. The command ensures a consistent project layout across all Play applications. ```Shell ~$ play new yabe ``` -------------------------------- ### Verify H2 In-Memory Database Connection Log Source: https://www.playframework.com/documentation/switch/1.3.x/guide1 After configuring the H2 in-memory database and refreshing the Play Framework application, this log entry confirms that the application has successfully connected to the H2 database. This indicates the database setup is correct and operational. ```text INFO ~ Connected to jdbc:h2:mem:play ``` -------------------------------- ### Build Play Framework from Source Source: https://www.playframework.com/documentation/1.2.x/install Instructions to clone the Play Framework repository from GitHub and build it using Git and Ant. This process compiles the framework from its latest sources, requiring a Git client and Ant to be installed on the system. ```Shell git clone git://github.com/playframework/play.git cd play/framework ant ``` -------------------------------- ### Start Play Netty Server with Basic Routing DSL Source: https://www.playframework.com/documentation/switch/3.0.2/ScalaEmbeddingPlayNetty This example shows how to initialize and start a Play Netty server using `NettyServer.fromRouterWithComponents()`. It utilizes Play's String Interpolating Routing DSL to define a simple GET route that responds with a greeting. ```Scala import play.api.mvc._ import play.api.routing.sird._ import play.core.server._ val server = NettyServer.fromRouterWithComponents() { components => import components.{ defaultActionBuilder => Action } { case GET(p"/hello/$to") => Action { Results.Ok(s"Hello $to") } } } ``` -------------------------------- ### Verify Play Framework Installation with Help Command Source: https://www.playframework.com/documentation/2.1.x/Installing This command checks if the Play Framework is correctly installed and accessible from the command line. Executing `play help` should display the basic help information, confirming successful setup. ```bash play help ```