owned this note
owned this note
Published
Linked with GitHub
---
title: Play framework2.6(Google翻訳)
robots: noindex, noarchive
---
# これは何
[Play framework 2.6 ドキュメント](https://www.playframework.com/documentation/2.6.x/Home)をGoogle翻訳かけたものです。
というわけで、訳の正確性は保証しません。
2.6.x開発リリースのドキュメントを表示しています。
# Play 2.6.x documentation
https://www.playframework.com/documentation/2.6.x/Home
Play is a high-productivity Java and Scala web application framework that integrates the components and APIs you need for modern web application development.
Playは、最新のWebアプリケーション開発に必要なコンポーネントとAPIを統合する、生産性の高いJavaおよびScala Webアプリケーションフレームワークです。
Play is based on a lightweight, stateless, web-friendly architecture and features predictable and minimal resource consumption (CPU, memory, threads) for highly-scalable applications thanks to its reactive model, based on Akka Streams.
Playは、軽量でステートレスでウェブ対応のアーキテクチャに基づいており、Akka Streamsに基づいたリアクティブモデルにより、スケーラビリティの高いアプリケーションのための予測可能で最小限のリソース消費(CPU、メモリ、スレッド)を備えています。
# What’s new in Play 2.6
Play 2.6の新機能
This page highlights the new features of Play 2.6. If you want to learn about the changes you need to make when you migrate to Play 2.6, check out the Play 2.6 Migration Guide.
このページでは、Play 2.6の新機能を紹介します。 Play 2.6に移行する際に必要な変更について知りたい場合は、「[Play 2.6 Migration Guide](
https://www.playframework.com/documentation/2.6.x/Migration26
)」を参照してください。
# Request attributes
リクエスト属性
Requests in Play 2.6 now contain attributes. Attributes allow you to store extra information inside request objects. For example, you can write a filter that sets an attribute in the request and then access the attribute value later from within your actions.
Play 2.6のリクエストには現在、属性が含まれています。属性を使用すると、要求オブジェクト内に余分な情報を格納することができます。たとえば、リクエスト内の属性を設定し、後でアクション内から属性値にアクセスするフィルタを作成できます。
Attributes are stored in a TypedMap that is attached to each request. TypedMaps are immutable maps that store type-safe keys and values. Attributes are indexed by a key and the key’s type indicates the type of the attribute.
属性は、各要求に添付されたTypedMapに格納されます。 TypedMapsは、型に安全なキーと値を格納する不変のマップです。属性はキーによって索引付けされ、キーのタイプは属性のタイプを示します。
Java:
```
// Create a TypedKey to store a User object
//ユーザオブジェクトを格納するためのTypedKeyを作成する
class Attrs {
public static final TypedKey<User> USER = TypedKey.<User>create("user");
}
// Get the User object from the request
//リクエストからUserオブジェクトを取得する
User user = req.attrs().get(Attrs.USER);
// Put a User object into the request
//リクエストにUserオブジェクトを入れる
Request newReq = req.withAttrs(req.attrs().put(Attrs.USER, newUser));
```
Scala:
```
// Create a TypedKey to store a User object
//ユーザオブジェクトを格納するためのTypedKeyを作成する
object Attrs {
val User: TypedKey[User] = TypedKey[User].apply("user")
}
// Get the User object from the request
//リクエストからUserオブジェクトを取得する
val user: User = req.attrs(Attrs.User)
// Put a User object into the request
//リクエストにUserオブジェクトを入れる
val newReq = req.withAttrs(req.attrs.updated(Attrs.User, newUser))
```
Attributes are stored in a TypedMap. You can read more about attributes in the TypedMap documentation: Javadoc, Scaladoc.
属性はTypedMapに格納されます。 TypedMapのドキュメントでは、Javadoc、Scaladocで属性の詳細を読むことができます。
Request tags have now been deprecated and you should migrate to use attributes instead. See the tags section in the migration docs for more information.
リクエストタグは廃止されました。代わりに属性を使用するように移行する必要があります。詳細については、移行ドキュメントのタグのセクションを参照してください。
Next: [Play 2.6 Migration Guide](
https://www.playframework.com/documentation/2.6.x/Migration26
)
# Installing Play
Playのインストール
https://www.playframework.com/documentation/2.6.x/Installing
This page shows how to download, install and run a Play application. There’s a built in tutorial that shows you around, so running this Play application will show you how Play itself works!
このページには、Playアプリケーションをダウンロード、インストール、実行する方法が示されています。 チュートリアルがありますので、このPlayアプリケーションを実行すると、Play自体の仕組みがわかります!
Play is a series of libraries available in Maven Repository, so you can use any Java build tool to build a Play project. However, much of the development experience Play is known for (routes, templates compilation and auto-reloading) is provided by SBT. In this guide we describe how to install Play with SBT. We also describe how to use Activator, an SBT wrapper that provides a graphical interface.
PlayはMaven Repositoryで利用できる一連のライブラリであるため、任意のJavaビルドツールを使用してPlayプロジェクトを構築できます。 しかし、Play(ルート、テンプレートのコンパイル、自動再読み込み)の開発経験の多くは、SBTによって提供されています。 このガイドでは、SBTでPlayをインストールする方法について説明します。 また、グラフィカルインターフェースを提供するSBTラッパーであるActivatorを使用する方法についても説明します。
# Prerequisites
前提条件
Play requires Java 1.8. To check that you have the latest JDK, please run:
PlayにはJava 1.8が必要です。 最新のJDKがあることを確認するには、次のコマンドを実行してください。
```
java -version
```
If you don’t have the JDK, you have to install it from Oracle’s JDK Site.
JDKがない場合は、[OracleのJDKサイト](http://www.oracle.com/technetwork/java/javase/downloads/index.html)からインストールする必要があります。
# Installing Play with SBT
SBTでPlayをインストールする
We provide a number of sample projects that have an ./sbt launcher in the local directory. These can be found on our download page. This launcher will automatically download dependencies without you having to install SBT ahead of time.
ローカルディレクトリに./sbtランチャーを持つ多数のサンプルプロジェクトを提供しています。 これらは[ダウンロードページ](https://playframework.com/download#examples)にあります。 このランチャーは、事前にSBTをインストールしなくても自動的に依存関係をダウンロードします。
https://playframework.com/download#examples
Refer to the SBT download page to install the SBT launcher on your system, which provides the sbt command. Otherwise you can use the SBT launcher located in your example project’s directory.
ご使用のシステムにSBT launcherをインストールするには、[SBTダウンロードページ](http://www.scala-sbt.org/download.html)を参照してください。これはsbtコマンドを提供します。 それ以外の場合は、サンプルプロジェクトのディレクトリにあるSBT launcherを使用できます。
http://www.scala-sbt.org/download.html
## Running Play with SBT
SBTで、Playを実行する
SBT provides all the necessary commands to run your application. You can use sbt run to run your app. For more details on running Play from the command line, refer to the new application documentation for more details.
SBTは、アプリケーションを実行するために必要なすべてのコマンドを提供します。 あなたはあなたのアプリを実行するためにsbtを実行することができます。 コマンドラインからのPlayの実行の詳細については、[新しいアプリケーションのドキュメント](https://www.playframework.com/documentation/2.6.x/NewApplication)を参照してください。
https://www.playframework.com/documentation/2.6.x/NewApplication
#Installing Play with Activator
Activatorを使ってPlayをインストールする
Activator is a wrapper for SBT that provides a nice graphical user interface and access to a library of third-party templates. Some new users prefer this interface to just using SBT. Note that since Activator is a wrapper for SBT, any commands referencing the sbt command can also be used with the activator command.
Activatorは、優れたグラフィカルユーザーインターフェイスとサードパーティのテンプレートライブラリへのアクセスを提供するSBTのラッパーです。 新しいユーザーの中には、SBTを使用するだけの場合にこのインターフェイスを使用するユーザーもいます。 ActivatorはSBTのラッパーであるため、sbtコマンドを参照するコマンドはactivatorコマンドでも使用できます。
For getting started, we’ll install Play through Lightbend Activator.
まず、[Lightbend Activator](https://www.lightbend.com/activator/docs)でPlayをインストールします。
https://www.lightbend.com/activator/docs
以下のコマンドでもよい
```
brew install typesafe-activator
```
Activator can be described as “sbt plus templates” – it combines sbt (a build tool) plus a means of downloading project templates (like Maven archetypes) and a web interface for managing those projects. Templates can be examples, or they can be “seed” templates that provide a starting point for your own projects.
Activatorは、sbt(ビルドツール)とプロジェクトテンプレート(Mavenのアーキタイプなど)をダウンロードする手段とそれらのプロジェクトを管理するためのWebインターフェイスを組み合わせた "sbt plus templates"として記述することができます。 テンプレートは例でも、自分のプロジェクトの出発点となる「seed」テンプレートでもかまいません。
Activator comes with a couple of seed templates for Play that we recommend for getting started, play-scala and play-java.
Activatorには、Playのための"seed"テンプレート(Play-scalaとplay-javaの2つ)が用意されています。
## Downloading Activator
Activatorのダウンロード
Activator is distributed as a single archive file that expands out to its own subdirectory.
Activatorは、単一のアーカイブファイルとして配布され、独自のサブディレクトリに展開されます。
You can download Activator from https://playframework.com/download and click on the “offline distribution” link:
Activatorはhttps://playframework.com/download からダウンロードし、「オフライン配布」リンクをクリックしてください:
このコマンドでも、activatorはインストールできます。
```
brew install typesafe-activator
```
The “offline distribution” comes with all of Activator’s possible dependencies included. It’s a much larger initial download, but installing the offline distribution means that starting up a new Play project is much faster, as all the dependencies are already resolved.
「オフライン配布」には、Activatorの可能性のあるすべての依存関係が含まれています。 初回のダウンロードははるかに大きいですが、オフラインのディストリビューションをインストールすると、すべての依存関係が既に解決されているため、新しいPlayプロジェクトの起動がずっと高速になります。
## Extracting Activator
Activatorの展開
Extract the archive on a location where you have write access. Running activator writes some files to directories within the distribution, so don’t install to /opt, /usr/local or anywhere else you’d need special permission to write to.
書き込みアクセス権がある場所でアーカイブを展開します。 実行中のアクティベータはいくつかのファイルをディストリビューション内のディレクトリに書き込みます。したがって、/ opt、/ usr / localなどに書き込む特別な権限が必要な場所にはインストールしないでください。
# Adding Activator to your Path
Activatorをパスに追加する
For convenience, you should add the Activator installation directory to your system PATH:
便宜上、ActivatorインストールディレクトリをシステムPATHに追加する必要があります。
以下の、コマンドでインストールしたひとは、activatorコマンドにPATHがすでに追加されています。
```
brew install typesafe-activator
```
## MacOS / Unix
Add to your login profile. Usually, this is $HOME/.profile:
あなたのログインプロフィールに追加してください。 通常、これは$ HOME / .profileです。
```
export PATH=/path/to/activator-x.x.x/bin:$PATH
```
Make sure that the activator script is executable. If it’s not:
アクティベータスクリプトが実行可能であることを確認してください。 そうでない場合は:
```
chmod u+x /path/to/activator-x.x.x/bin/activator
```
## Windows
In a command prompt, type:
コマンドプロンプトで次のように入力します。
```
setx PATH=%PATH%;"C:\path\to\activator-x.x.x\bin"
```
Note that setx is only available on Windows 8 or later – before that, and you will have to use the System Properties dialog.
[setx](https://technet.microsoft.com/en-us/library/cc755104.aspx)はWindows 8以降でのみ利用可能であり、その前には[System Properties](https://java.com/en/download/help/path.xml)ダイアログを使用する必要があることに注意してください。
# Create a Project
プロジェクトを作成する
Activator comes with a couple of different “seeds” that can be used to start off a Play project: play-java and play-scala. You can create a project based off a template either from Activator’s Web Interface, or directly from the command line.
Activatorには、Playプロジェクトを開始するために使用できるさまざまな「seeds」があります:play-javaとplay-scala。 テンプレートに基づいてプロジェクトを作成するには、ActivatorのWeb Interfaceかコマンドラインから直接行います。
Open a command prompt, and type activator ui to bring up the GUI interface. A browser window will open with the Web UI at http://localhost:8888.
コマンドプロンプト(Macはターミナル)を開き、activator uiと入力してGUIインターフェイスを表示します。 ブラウザーウィンドウがhttp://localhost:8888 のWeb UIと共に開きます。
Note: If you’re behind a proxy, make sure to define it with set HTTP_PROXY=http://<host>:<port> on Windows or export HTTP_PROXY=http://<host>:<port> on UNIX.
注意:プロキシを使用している場合は、Windowsではset HTTP_PROXY=http://<host>:<port>>で定義するか、UNIXではexport HTTP_PROXY=http://<host>:<port>をエクスポートしてください。
Follow the arrows to create a new project:
矢印に従って新しいプロジェクトを作成します。
![](https://i.imgur.com/jBXbJxQ.png)
You can read the Activator documentation for more information on how to use the Web Interface.
Web Interfaceの使用方法の詳細については、Activatorのマニュアルを参照してください。
#Accessing the Built-in Tutorial
組み込みチュートリアルへのアクセス
Activator’s Web Interface contains a built in tutorial section that will walk you through your new application:
ActivatorのWeb Interfaceには、新しいアプリケーションを紹介するチュートリアルのセクションが組み込まれています。
![](https://i.imgur.com/UEC1t2e.png)
# Running Play
Playを実行する
Play has an easy to use “development mode” that will let you make changes to code and see your results immediate on the page.
You can run Play in development mode from within Activator’s Web Interface by going to the Run tab and clicking the Run button:
Playには使いやすい "開発モード"があり、コードを変更してすぐに結果をページに表示できます。
[Run]タブに移動して[Run]ボタンをクリックすると、ActivatorのWeb Interfaceから開発モードでPlayを実行できます。
This will bring up the Play application at http://localhost:9000.
これでhttp://localhost:9000 で、Playアプリケーションが起動します。
# Congratulations!
おめでとう!
You are now ready to work with Play! The next page will show you how to create projects from the command line and some more detail about creating new applications.
Next: [Creating a new application](https://www.playframework.com/documentation/2.6.x/NewApplication)
これで、Playで作業する準備が整いました。 次のページでは、コマンドラインからプロジェクトを作成する方法と、新しいアプリケーションを作成する方法について詳しく説明します。
次へ:[新しいアプリケーションの作成](https://www.playframework.com/documentation/2.6.x/NewApplication)
https://www.playframework.com/documentation/2.6.x/NewApplication
# Create a new application
新しいアプリケーションを作成する
Create a new application using an existing example project
We provide a number of sample projects that provide good starting points for a new application. These applications already have an SBT launcher included so you don’t need to manually install SBT on your system.
既存のサンプルプロジェクトを使用して新しいアプリケーションを作成する
新しいアプリケーションの出発点となるサンプルプロジェクトを多数用意しています。 これらのアプリケーションにはすでにSBTランチャーが含まれているため、システムにSBTを手動でインストールする必要はありません。
To use an example project, download and extract the project you’re interested in. Edit the build.sbt to customize it for your project:
サンプルプロジェクトを使用するには、興味のあるプロジェクトをダウンロードして解凍します。プロジェクト用にカスタマイズするbuild.sbtを編集します。
```
name := "play-scala" // <- Your project's name. Used for generated binaries.
// <- あなたのプロジェクトの名前。 生成されたバイナリに使用されます。
version := "1.0-SNAPSHOT" // <- project version
// <- プロジェクトのバージョン
```
Then you can run SBT
その後、SBTを実行することができます
```
$ ./sbt
```
This will load your project and fetch dependencies. You can use the run command to run your application.
これにより、プロジェクトが読み込まれ、依存関係が取得されます。 runコマンドを使用してアプリケーションを実行できます。
Next, you can learn about [using the console](https://www.playframework.com/documentation/2.5.x/PlayConsole) provided by SBT.
次に、[SBTが提供するコンソール](https://www.playframework.com/documentation/2.5.x/PlayConsole)の使い方について学ぶことができます。
https://www.playframework.com/documentation/2.5.x/PlayConsole
# Create a new application with Activator
Activatorで新しいアプリケーションを作成する
The activator command can be used to create a new Play application. Activator allows you to select a template that your new application should be based off. For vanilla Play projects, the names of these templates are play-scala for Scala based Play applications, and play-java for Java based Play applications.
activatorコマンドを使用して、新しいPlayアプリケーションを作成できます。 Activatorを使用すると、新しいアプリケーションを基にしなければならないテンプレートを選択できます。 vanilla Playプロジェクトの場合、これらのテンプレートの名前は、ScalaベースのPlayアプリケーションの場合はplay-scala、JavaベースのPlayアプリケーションの場合はplay-javaです。
Note that choosing a template for either Scala or Java at this point does not imply that you can’t change language later. For example, you can create a new application using the default Java application template and start adding Scala code whenever you like.
この時点でScalaまたはJavaのいずれかのテンプレートを選択しても、あとで言語を変更することはできません。たとえば、デフォルトのJavaアプリケーションテンプレートを使用して新しいアプリケーションを作成し、好きなときにいつでもScalaコードを追加することができます。
To create a new vanilla Play Scala application, run:
新しいvanilla Play Scalaアプリケーションを作成するには、次のコマンドを実行します。
```
$ activator new my-first-app play-scala
```
To create a new vanilla Play Java application, run:
新しいvanilla Play Javaアプリケーションを作成するには、次のコマンドを実行します。
```
$ activator new my-first-app play-java
```
In either case, you can replace my-first-app with whatever name you want your application to use. Activator will use this as the directory name to create the application in. You can change this name later if you choose.
どちらの場合でも、my-first-appをアプリケーションに使用する名前に置き換えることができます。 Activatorはこれをディレクトリ名として使用してアプリケーションを作成します。後でこの名前を変更することもできます。
![](https://i.imgur.com/z4RBkTh.png)
If you wish to use other Activator templates, you can do this by running activator new. This will prompt you for an application name, and then give you a chance to browse and select an appropriate template.
他のActivatorテンプレートを使用する場合は、activator newを実行してください。 これにより、アプリケーション名の入力を求められ、適切なテンプレートをブラウズして選択する機会が与えられます。
Once the application has been created you can use the activator command again to enter the Play console.
アプリケーションが作成されたら、再度activatorコマンドを使用してPlayコンソールに入ることができます。
```
$ cd my-first-app
$ activator
```
# Create a new application using SBT
SBTを使用して新しいアプリケーションを作成する
It is also possible to create a new Play application using sbt directly.
sbtを直接使用して新しいPlayアプリケーションを作成することもできます。
First install sbt if needed.
まず、必要に応じてsbtをインストールします。
Create a new directory for your new application and configure your sbt build script with two additions.
新しいアプリケーション用の新しいディレクトリを作成し、sbtビルドスクリプトを2つの追加で設定します。
In project/plugins.sbt, add:
project/plugins.sbtに次の行を追加します:
```
// The Typesafe repository
resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/maven-releases/"
// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.x")
```
Be sure to replace 2.6.x here by the exact version you want to use. If you want to use a snapshot version, you will have to specify this additional resolver:
ここで2.6.xを使用する正確なバージョンで置き換えてください。 スナップショット・バージョンを使用する場合は、この追加のリゾルバを指定する必要があります。
```
// Typesafe snapshots
resolvers += "Typesafe Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
```
To ensure the proper sbt version is used, make sure you have the following in project/build.properties:
適切なsbtバージョンが使用されていることを確認するには、project/build.propertiesに次のものがあることを確認してください。
```
sbt.version=0.13.13
```
In build.sbt for Java projects:
Javaプロジェクト用のbuild.sbt:
```
name := "my-first-app"
version := "1.0"
lazy val root = (project in file(".")).enablePlugins(PlayJava)
```
…or Scala projects:
...または、Scalaプロジェクト用のbuild.sbt:
```
name := "my-first-app"
version := "1.0.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
```
You can then launch the sbt console in this directory:
次に、このディレクトリでsbtコンソールを起動できます。
```
$ cd my-first-app
$ sbt
```
sbt will load your project and fetch the dependencies.
sbtはあなたのプロジェクトを読み込み、依存関係を取得します。
By default, the PlayJava and PlayScala plugins do not depend on any specific dependency injection solution. If you want to use Play’s Guice module, add guice to your library dependencies:
デフォルトでは、PlayJavaプラグインとPlayScalaプラグインは特定の依存性注入ソリューションに依存しません。 PlayのGuiceモジュールを使用する場合は、guiceをライブラリの依存関係に追加します。
```
libraryDependencies += guice
```
Be aware that you should either be manually defining an ApplicationLoader or have a dependency on another module (such as guice) that provides one.
ApplicationLoaderを手動で定義するか、またはそれを提供する別のモジュール(guiceなど)に依存する必要があることに注意してください。
Next: [Using the Play console](https://www.playframework.com/documentation/2.6.x/PlayConsole)
https://www.playframework.com/documentation/2.6.x/PlayConsole
# Using the SBT console
SBTコンソールの使用
Launching the console
コンソールの起動
The SBT console is a development console based on sbt that allows you to manage a Play application’s complete development cycle.
SBTコンソールは、Playアプリケーションの完全な開発サイクルを管理できるsbtをベースにした開発コンソールです。
To launch the Play console, change to the directory of your project, and run SBT (or activator in place of the sbt command):
Playコンソールを起動するには、プロジェクトのディレクトリに移動し、SBT(またはsbtコマンドの代わりにactivator)を実行します。
```
$ cd my-first-app
$ sbt
```
![](https://i.imgur.com/4coDmhI.png)
# Getting help
ヘルプの入手
Use the help command to get basic help about the available commands. You can also use this with a specific command to get information about that command:
使用可能なコマンドについての基本的なヘルプを得るには、helpコマンドを使用してください。 特定のコマンドでこれを使用して、そのコマンドに関する情報を取得することもできます。
```
[my-first-app] $ help run
```
# Running the server in development mode
開発モードでのサーバーの実行
To run the current application in development mode, use the run command:
現在のアプリケーションを開発モードで実行するには、runコマンドを使用します。
```
[my-first-app] $ run
```
![](https://i.imgur.com/YvAAKLm.png)
In this mode, the server will be launched with the auto-reload feature enabled, meaning that for each request Play will check your project and recompile required sources. If needed the application will restart automatically.
このモードでは、サーバーは自動リロード機能を有効にして起動します。つまり、リクエストごとにPlayがプロジェクトをチェックし、必要なソースを再コンパイルします。 必要に応じて、アプリケーションは自動的に再起動します。
If there are any compilation errors you will see the result of the compilation directly in your browser:
コンパイルエラーがある場合は、コンパイル結果がブラウザに直接表示されます。
![](https://i.imgur.com/VwsXbfV.png)
To stop the server, type Crtl+D key, and you will be returned to the Play console prompt.
サーバーを停止するには、Ctrl + Dキーを押すと、Playコンソールのプロンプトに戻ります。
# Compiling
コンパイル
In Play you can also compile your application without running the server. Just use the compile command:
Playでは、サーバーを実行せずにアプリケーションをコンパイルすることもできます。 ちょうどコンパイルコマンドを使用してください:
```
[my-first-app] $ compile
```
![](https://i.imgur.com/Yv3gG9r.png)
# Running the tests
テストの実行
Like the commands above, you can run your tests without running the server. Just use the test command:
上記のコマンドと同様に、サーバーを実行せずにテストを実行できます。 testコマンドを使用してください:
```
[my-first-app] $ test
```
# Launch the interactive console
対話型コンソールを起動する
Type console to enter the interactive Scala console, which allows you to test your code interactively:
コンソールを入力してインタラクティブなScalaコンソールに入り、対話的にコードをテストすることができます:
```
[my-first-app] $ console
```
To start application inside scala console (e.g. to access database):
scalaコンソール内でアプリケーションを起動する(データベースにアクセスするなど):
```
import play.api._
val env = Environment(new java.io.File("."), this.getClass.getClassLoader, Mode.Dev)
val context = ApplicationLoader.createContext(env)
val loader = ApplicationLoader(context)
val app = loader.load(context)
Play.start(app)
```
![](https://i.imgur.com/nrrt98u.png)
# Debuggingn
デバッグ
You can ask Play to start a JPDA debug port when starting the console. You can then connect using Java debugger. Use the sbt -jvm-debug <port> command to do that:
コンソールの起動時にJPDAデバッグポートを開始するようにPlayに依頼することができます。 Javaデバッガを使用して接続できます。 これを行うには、sbt -jvm-debug <port>コマンドを使用します。
```
$ activator -jvm-debug 9999
```
When a JPDA port is available, the JVM will log this line during boot:
JPDAポートが使用可能な場合、JVMはブート時にこの行を記録します。
```
Listening for transport dt_socket at address: 9999
```
# Using sbt features
sbt機能を使用する
You can use sbt features such as triggered execution.
トリガされた実行などのsbt機能を使用できます。
For example, using ~ compile:
たとえば、〜compileを使用します。
```
[my-first-app] $ ~ compile
```
The compilation will be triggered each time you change a source file.
コンパイルは、ソースファイルを変更するたびにトリガーされます。
If you are using ~ run:
もし、あなたが、「~ run」を使っている場合:
```
[my-first-app] $ ~ run
```
The triggered compilation will be enabled while a development server is running.
トリガされたコンパイルは、開発サーバーの実行中に有効になります。
You can also do the same for ~ test, to continuously test your project each time you modify a source file:
また、ソースファイルを変更するたびにプロジェクトを継続的にテストするために、〜testに対しても同じことを行うことができます:
```
[my-first-app] $ ~ test
```
# Using the play commands directly
直接playコマンドを使う
You can also run commands directly without entering the Play console. For example, enter sbt run:
また、Playコンソールに入らずに直接コマンドを実行することもできます。 たとえば、sbt runと入力します。
```
$ sbt run
[info] Loading project definition from /Users/jroper/tmp/my-first-app/project
[info] Set current project to my-first-app (in build file:/Users/jroper/tmp/my-first-app/)
--- (Running the application from SBT, auto-reloading is enabled) ---
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started, use Enter to stop and go back to the console...)
```
The application starts directly. When you quit the server using Enter, you will come back to your OS prompt. Of course, the triggered execution is available here as well:
アプリケーションが直接起動します。 Enterを使用してサーバーを終了すると、OSプロンプトに戻ります。 もちろん、ここでトリガされた実行も利用できます。
```
$ sbt ~run
```
Next: [Setting-up your preferred IDE](https://www.playframework.com/documentation/2.6.x/IDE)
# Setting up your preferred IDE
あなたの好みのIDEを設定する
Working with Play is easy. You don’t even need a sophisticated IDE, because Play compiles and refreshes the modifications you make to your source files automatically, so you can easily work using a simple text editor.
Playでの作業は簡単です。 Playはソースファイルの変更を自動的にコンパイルして更新するので、高度なIDEは必要ありません。簡単なテキストエディタを使用して簡単に作業できます。
However, using a modern Java or Scala IDE provides cool productivity features like auto-completion, on-the-fly compilation, assisted refactoring and debugging.
しかし、最新のJavaまたはScala IDEを使用すると、自動補完、オンザフライコンパイル、支援されたリファクタリング、デバッグなどの生産性の高い機能が提供されます。
# Eclipse
Setup sbteclipse
Integration with Eclipse requires [sbteclipse](https://github.com/typesafehub/sbteclipse). Make sure to always use the [most recent available version](https://github.com/typesafehub/sbteclipse/releases).
セットアップsbteclipse
Eclipseとの統合には[sbteclipse](https://github.com/typesafehub/sbteclipse)が必要です。 必ず[最新のバージョン](https://github.com/typesafehub/sbteclipse/releases)を使用してください。
```
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.1.0")
```
You must compile your project before running the eclipse command. You can force compilation to happen when the eclipse command is run by adding the following setting:
eclipseコマンドを実行する前に、プロジェクトをコンパイルする必要があります。 eclipseコマンドを実行すると、次の設定を追加してコンパイルを強制することができます。
````
// Compile the project before generating Eclipse files, so that generated .scala or .class files for views and routes are present
// Eclipseファイルを生成する前にプロジェクトをコンパイルします。生成されたビューやルートの.scalaファイルや.classファイルが存在するようにします
EclipseKeys.preTasks := Seq(compile in Compile, compile in Test)
```
If you have Scala sources in your project, you will need to install [Scala IDE](http://scala-ide.org/).
プロジェクトにScalaソースがある場合は、[Scala IDE](http://scala-ide.org/)をインストールする必要があります。
If you do not want to install Scala IDE and have only Java sources in your project, then you can set the following:
Scala IDEをインストールせずに、プロジェクトにJavaソースしかない場合は、次のように設定できます。
```
EclipseKeys.projectFlavor := EclipseProjectFlavor.Java // Java project. Don't expect Scala IDE
EclipseKeys.createSrc := EclipseCreateSrc.ValueSet(EclipseCreateSrc.ManagedClasses, EclipseCreateSrc.ManagedResources) // Use .class files instead of generated .scala files for views and routes
```
# Generate configuration
設定を生成する
Play provides a command to simplify Eclipse configuration. To transform a Play application into a working Eclipse project, use the eclipse command:
PlayではEclipse設定を簡略化するコマンドが提供されています。 Playアプリケーションを実際のEclipseプロジェクトに変換するには、eclipseコマンドを使用します。
```
[my-first-app] $ eclipse
```
If you want to grab the available source jars (this will take longer and it’s possible a few sources might be missing):
利用可能なソースjarファイルを取得したい場合(これには時間がかかりますが、いくつかのソースが失われている可能性があります):
```
[my-first-app] $ eclipse with-source=true
```
Note if you are using sub-projects with aggregate, you would need to set skipParents appropriately in build.sbt:
サブプロジェクトを集計で使用している場合は、build.sbtでskipParentsを適切に設定する必要があります。
```
EclipseKeys.skipParents in ThisBuild := false
```
or from the play console, type:
または、playコンソールから次のように入力します。
```
[my-first-app] $ eclipse skip-parents=false
````
You then need to import the application into your Workspace with the File/Import/General/Existing project… menu (compile your project first).
次に、File/Import/General/Existingプロジェクト...メニュー(プロジェクトを最初にコンパイル)でアプリケーションをワークスペースにインポートする必要があります。
![](https://i.imgur.com/XEP5adZ.png)
To debug, start your application with sbt -jvm-debug 9999 run and in Eclipse right-click on the project and select Debug As, Debug Configurations. In the Debug Configurations dialog, right-click on Remote Java Application and select New. Change Port to 9999 and click Apply. From now on you can click on Debug to connect to the running application. Stopping the debugging session will not stop the server.
デバッグするには、sbt -jvm-debug 9999を実行してアプリケーションを起動し、Eclipseでプロジェクトを右クリックし、[デバッグ]、[デバッグ構成]を選択します。 「デバッグ構成」ダイアログで、「リモートJavaアプリケーション」を右クリックし、「新規」を選択します。 Portを9999に変更し、Applyをクリックします。これからはデバッグをクリックして実行中のアプリケーションに接続できます。デバッグセッションを停止しても、サーバーは停止しません。
Tip: You can run your application using ~run to enable direct compilation on file change. This way scala template files are auto discovered when you create a new template in view and auto compiled when the file changes. If you use normal run then you have to hit Refresh on your browser each time.
ヒント:〜runを使用してアプリケーションを実行すると、ファイル変更時のダイレクトコンパイルが有効になります。こうすることで、新しいテンプレートを作成してファイルが変更されたときに自動的にコンパイルされると、scalaテンプレートファイルが自動的に検出されます。あなたが通常の実行を使用している場合は、毎回あなたのブラウザでリフレッシュする必要があります。
If you make any important changes to your application, such as changing the classpath, use eclipse again to regenerate the configuration files.
クラスパスを変更するなど、アプリケーションに重大な変更を加えた場合は、eclipseを再度使用して構成ファイルを再生成してください。
Tip: Do not commit Eclipse configuration files when you work in a team!
ヒント:チームで作業するときにEclipse設定ファイルをコミットしないでください!
The generated configuration files contain absolute references to your framework installation. These are specific to your own installation. When you work in a team, each developer must keep his Eclipse configuration files private.
生成された構成ファイルには、フレームワークインストールへの絶対参照が含まれています。これらは、ご自身のインストールに固有のものです。チームで作業する場合、各開発者はEclipse構成ファイルを非公開にする必要があります。
# IntelliJ
[Intellij IDEA](https://www.jetbrains.com/idea/) lets you quickly create a Play application without using a command prompt. You don’t need to configure anything outside of the IDE, the [SBT build tool ](SBT build tool ) takes care of downloading appropriate libraries, resolving dependencies and building the project.
[Intellij IDEA](https://www.jetbrains.com/idea/)を使用すると、コマンドプロンプトを使用せずにPlayアプリケーションをすばやく作成できます。 IDEの外には何も設定する必要はありません.[SBT build tool](https://www.jetbrains.com/help/idea/2016.3/creating-and-running-your-scala-application.html)は適切なライブラリをダウンロードし、依存関係を解決し、プロジェクトを構築します。
Before you start creating a Play application in IntelliJ IDEA, make sure that the latest Scala Plugin is installed and enabled in IntelliJ IDEA. Even if you don’t develop in Scala, it will help with the template engine and also resolving dependencies.
IntelliJ IDEAでPlayアプリケーションを作成する前に、IntelliJ IDEAに最新のScala Pluginがインストールされていることを確認してください。 Scalaで開発しなくても、テンプレートエンジンや依存関係の解決に役立ちます。
To create a Play application:
Playアプリケーションを作成するには:
Open New Project wizard, select Activator under Scala section and click Next.
Select one of the templates suitable. For the basic empty application you can select [Play Scala Seed](https://www.lightbend.com/activator/template/play-scala). The full list of templates can be found on [Lightbend Activator templates page](https://www.lightbend.com/activator/templates).
Enter your project’s information and click Finish.
You can also import an existing Play project.
新しいプロジェクトウィザードを開き、ScalaセクションのActivatorを選択して、次へをクリックします。
適切なテンプレートの1つを選択します。基本的な空のアプリケーションでは、「[Play Scala Seed](https://www.lightbend.com/activator/template/play-scala)」を選択できます。テンプレートの全リストは[Lightbend Activatorのテンプレートページ](https://www.lightbend.com/activator/templates)にあります。
プロジェクトの情報を入力し、[Finish]をクリックします。
既存のPlayプロジェクトをインポートすることもできます。
To import a Play project:
Playプロジェクトをインポートするには:
Open Project wizard, select Import Project.
In the window that opens, select a project you want to import and click OK.
プロジェクト・ウィザードを開き、「プロジェクトのインポート」を選択します。
表示されたウィンドウで、インポートするプロジェクトを選択し、[OK]をクリックします。
On the next page of the wizard, select Import project from external model option, choose SBT project and click Next.
On the next page of the wizard, select additional import options and click Finish.
ウィザードの次のページで、外部モデルからプロジェクトをインポートオプションを選択し、SBTプロジェクトを選択して、次へをクリックします。
ウィザードの次のページで、追加のインポートオプションを選択し、[Finish]をクリックします。
Check the project’s structure, make sure all necessary dependencies are downloaded. You can use code assistance, navigation and on-the-fly code analysis features.
プロジェクトの構造を確認し、必要な依存関係がすべてダウンロードされていることを確認します。コードアシスタンス、ナビゲーション、およびon-the-flyのコード解析機能を使用できます。
You can run the created application and view the result in the default browser http://localhost:9000 .
作成したアプリケーションを実行して、デフォルトのブラウザhttp://localhost:9000 で結果を表示することができます。
To run a Play application:
Playアプリケーションを実行するには:
1 Create a new Run Configuration – From the main menu, select Run -> Edit Configurations
1 新しい実行コンフィギュレーションの作成
- メインメニューから、「run」 - >「Edit Configurations」を選択します。
2 Click on the + to add a new configuration
2 +をクリックして新しい設定を追加する
3 From the list of configurations, choose “SBT Task”
3 configurationsのリストから、[SBT Task]を選択し、
4 In the “tasks” input box, simply put “run”
4 "tasks"入力ボックスに、単に "run"
5 Apply changes and select OK.
5 変更を適用し、[OK]を選択します。
6 Now you can choose “Run” from the main Run menu and run your application
6 これで、メインの[Run]メニューから[Run]を選択し、アプリケーションを実行できます
You can easily start a debugger session for a Play application using default Run/Debug Configuration settings.
デフォルトの実行/デバッグ構成設定を使用して、Playアプリケーションのデバッガセッションを簡単に開始できます。
For more detailed information, see the Play Framework 2.x tutorial at the following URL:
詳細については、次のURLのPlay Framework 2.xチュートリアルを参照してください。
https://www.jetbrains.com/idea/help/getting-started-with-play-2-x.html
# Navigate from an error page to the source code
エラーページからソースコードに移動する
Using the play.editor configuration option, you can set up Play to add hyperlinks to an error page. This will link to runtime exceptions thrown when Play is running development mode.
play.editor設定オプションを使用して、Playを設定して、エラーページにハイパーリンクを追加することができます。 これは、Playが開発モードを実行しているときにスローされるランタイム例外にリンクします。
You can easily navigate from error pages to IntelliJ directly into the source code, by using IntelliJ’s “remote file” REST API with the built in IntelliJ web server on port 63342.
IntelliJの「リモートファイル」REST APIを使用して、ポート63342のIntelliJ Webサーバーに組み込むことで、エラーページからIntelliJまで簡単にソースコードにナビゲートできます。
Enable the following line in application.conf to provide hyperlinks:
ハイパーリンクを提供するには、application.confの次の行を有効にします。
```
play.editor="http://localhost:63342/api/file/?file=%s&line=%s"
```
You can also set play.editor from build.sbt:
また、build.sbtからplay.editorを設定することもできます:
```
fork := true // required for "sbt run" to pick up javaOptions
// "sbt run"がjavaOptionsを取得するために必要
javaOptions += "-Dplay.editor=http://localhost:63342/api/file/?file=%s&line=%s"
```
or set the PLAY_EDITOR environment variable:
または、環境変数PLAY_EDITORを設定します。
```
PLAY_EDITOR="http://localhost:63342/api/file/?file=%s&line=%s"
```
# Anatomy of a Play application
Playアプリケーションの構造
The Play application layout
The layout of a Play application is standardized to keep things as simple as possible. After a first successful compile, a Play application looks like this:
Playアプリケーションの構成
Playアプリケーションのレイアウトは、できるだけシンプルにするために標準化されています。 最初のコンパイルが成功すると、Playアプリケーションは次のようになります。
```
app → Application sources
└ assets → Compiled asset sources
└ stylesheets → Typically LESS CSS sources
└ javascripts → Typically CoffeeScript sources
└ controllers → Application controllers
└ models → Application business layer
└ views → Templates
build.sbt → Application build script
conf → Configurations files and other non-compiled resources (on classpath)
└ application.conf → Main configuration file
└ routes → Routes definition
dist → Arbitrary files to be included in your projects distribution
public → Public assets
└ stylesheets → CSS files
└ javascripts → Javascript files
└ images → Image files
project → sbt configuration files
└ build.properties → Marker for sbt project
└ plugins.sbt → sbt plugins including the declaration for Play itself
lib → Unmanaged libraries dependencies
logs → Logs folder
└ application.log → Default log file
target → Generated stuff
└ resolution-cache → Info about dependencies
└ scala-2.11
└ api → Generated API docs
└ classes → Compiled class files
└ routes → Sources generated from routes
└ twirl → Sources generated from templates
└ universal → Application packaging
└ web → Compiled web assets
test → source folder for unit or functional tests
```
```
app → アプリケーションソース
└ assets → コンパイルされたソース
└ stylesheets → 通常はLESS CSSのソース
└ javascripts → 通常はCoffeeScriptのソース
└ controllers → アプリケーションコントローラー
└ models → アプリケーションビジネス層
└ views → テンプレート
build.sbt → アプリケーションビルドスクリプト
conf → 設定ファイル、および (クラスパス上の) その他のコンパイルされないリソース
└ application.conf → メイン設定ファイル
└ routes → ルート定義
dist → プロジェクト成果物に含める任意のファイル
public → 公開アセット
└ stylesheets → CSSファイル
└ javascripts → Javascriptファイル
└ images → 画像ファイル
project → sbt 設定ファイル群
└ build.properties → sbt プロジェクトの目印
└ plugins.sbt → Play 自身の定義を含む sbt プラグイン
lib → 管理されていない依存ライブラリ
logs → ログフォルダ
└ application.log → デフォルトログファイル
target → 生成物
└ resolution-cache → 依存性に関する情報
└ scala-2.11
└ api → 生成された API ドキュメント
└ classes → コンパイルされたクラスファイル
└ routes → routesから生成されたソース
└ twirl → テンプレートから生成されたソース
└ universal → アプリケーションパッケージ
└ web → コンパイルされた web アセット
test → 単体、および機能テスト用のソースフォルダ
```
# The app/ directory
app/ディレクトリ
The app directory contains all executable artifacts: Java and Scala source code, templates and compiled assets’ sources.
appディレクトリには、JavaおよびScalaソースコード、テンプレート、コンパイル済みアセットのソースなど、すべての実行可能な成果物が含まれています。
There are three packages in the app directory, one for each component of the MVC architectural pattern:
appディレクトリには、MVCアーキテクチャパターンの各コンポーネント用に3つのパッケージがあります。
app/controllers
app/models
app/views
You can of course add your own packages, for example an app/utils package.
もちろん、app/utilsパッケージなど独自のパッケージを追加することもできます。
Note that in Play, the controllers, models and views package name conventions are now just that and can be changed if needed (such as prefixing everything with com.yourcompany).
Playでは、コントローラー、モデル、およびビューのパッケージ名の規則は今やまさにそれであり、必要に応じて変更することができます(com.yourcompanyですべてをプレフィックスにするなど)。
There is also an optional directory called app/assets for compiled assets such as [LESS sources](http://lesscss.org/) and [CoffeeScript sources](http://coffeescript.org/).
また、[LESSソース](http://lesscss.org/)や[CoffeeScriptソース](http://coffeescript.org/)などのコンパイル済みアセット用のapp/assetsというオプションのディレクトリもあります。
# The public/ directory
public/ディレクトリ
Resources stored in the public directory are static assets that are served directly by the Web server.
publicディレクトリに格納されるリソースは、Webサーバーによって直接処理される静的アセットです。
This directory is split into three sub-directories for images, CSS stylesheets and JavaScript files. You should organize your static assets like this to keep all Play applications consistent.
このディレクトリは、画像、CSSスタイルシート、JavaScriptファイルの3つのサブディレクトリに分割されています。 このように静的アセットを整理して、すべてのPlayアプリケーションの一貫性を保つ必要があります。
In a newly-created application, the /public directory is mapped to the /assets URL path, but you can easily change that, or even use several directories for your static assets.
新しく作成されたアプリケーションでは、/publicディレクトリは/assets URLパスにマップされますが、簡単に変更することができます。
# The conf/ directory
conf /ディレクトリ
The conf directory contains the application’s configuration files. There are two main configuration files:
confディレクトリには、アプリケーションの構成ファイルが含まれています。 主な設定ファイルは2つあります。
application.conf, the main configuration file for the application, which contains configuration parameters
routes, the routes definition file.
If you need to add configuration options that are specific to your application, it’s a good idea to add more options to the application.conf file.
application.confの主な構成ファイルで、構成パラメーターが含まれています。
ルート、ルート定義ファイル。
アプリケーションに固有の構成オプションを追加する必要がある場合は、application.confファイルにオプションを追加することをお勧めします。
If a library needs a specific configuration file, try to file it under the conf directory.
ライブラリに特定の設定ファイルが必要な場合は、confディレクトリの下にファイルを作成してみてください。
# The lib/ directory
lib/ディレクトリ
The lib directory is optional and contains unmanaged library dependencies, ie. all JAR files you want to manually manage outside the build system. Just drop any JAR files here and they will be added to your application classpath.
libディレクトリはオプションで、アンマネージライブラリの依存関係を含んでいます。 ビルドシステムの外で手動で管理するすべてのJARファイル 任意のJARファイルをここにドロップすると、アプリケーションのクラスパスに追加されます。
# The build.sbt file
build.sbtファイル
Your project’s main build declarations are generally found in build.sbt at the root of the project. .scala files in the project/ directory can also be used to declare your project’s build.
プロジェクトのメインビルド宣言は、通常、プロジェクトのルートにあるbuild.sbtにあります。 project/ディレクトリ内の.scalaファイルを使用してプロジェクトのビルドを宣言することもできます。
# The project/ directory
project/ディレクトリ
The project directory contains the sbt build definitions:
プロジェクトディレクトリには、sbtビルド定義が含まれています。
plugins.sbt defines sbt plugins used by this project
build.properties contains the sbt version to use to build your app.
plugins.sbtは、このプロジェクトで使用されるsbtプラグインを定義します
build.propertiesには、アプリのビルドに使用するsbtバージョンが含まれています。
# The target/ directory
# target/ディレクトリ
The target directory contains everything generated by the build system. It can be useful to know what is generated here.
targetディレクトリには、ビルドシステムによって生成されたすべてが含まれます。 ここで生成されるものを知ることは有益です。
classes/ contains all compiled classes (from both Java and Scala sources).
classes/ にはコンパイルされたすべてのクラス(JavaソースとScalaソースの両方)を含みます。
classes_managed/ contains only the classes that are managed by the framework (such as the classes generated by the router or the template system). It can be useful to add this class folder as an external class folder in your IDE project.
classes_managed/ には、フレームワークによって管理されるクラス(ルータやテンプレートシステムによって生成されたクラスなど)のみを含みます。 このクラスフォルダーをIDEプロジェクトの外部クラスフォルダーとして追加すると便利です。
resource_managed/ contains generated resources, typically compiled assets such as LESS CSS and CoffeeScript compilation results.
resource_managed/ には生成されたリソース、通常はLESS CSSやCoffeeScriptのコンパイル結果などのコンパイルされたアセットを含みます。
src_managed/ contains generated sources, such as the Scala sources generated by the template system.
src_managed/ には、テンプレートシステムによって生成されたScalaソースなどの生成されたソースを含みます。
web/ contains assets processed by [sbt-web](https://github.com/sbt/sbt-web#sbt-web) such as those from the app/assets and public folders.
web/ には、app/assetsやpublicフォルダなどの[sbt-web](https://github.com/sbt/sbt-web#sbt-web)で処理されたアセットが含まれています。
# Typical .gitignore file
典型的な.gitignoreファイル
Generated folders should be ignored by your version control system. Here is the typical .gitignore file for a Play application:
生成されたフォルダは、バージョン管理システムによって無視されます。 Playアプリケーションの典型的な.gitignoreファイルは次のとおりです。
```
logs
project/project
project/target
target
tmp
dist
.cache
```
# Default SBT layout
デフォルトのSBTの構成
You also have the option of using the default layout used by SBT and Maven. Please note that this layout is experimental and may have issues. In order to use this layout, you must disable the layout plugin and set up explicit monitoring for twirl templates:
SBTとMavenで使用されるデフォルトの構成を使用することもできます。 このレイアウトは実験的なもので、問題がある可能性があります。 この構成を使用するには、layout pluginを無効にし、twirlテンプレートの明示的な監視を設定する必要があります。
```
disablePlugins(PlayLayoutPlugin)
PlayKeys.playMonitoredFiles ++= (sourceDirectories in (Compile, TwirlKeys.compileTemplates)).value
```
This will stop Play from overriding the default SBT layout, which looks like this:
これにより、PlayはデフォルトのSBTレイアウトをオーバーライドしなくなります。これは次のようになります。
```
build.sbt → Application build script
src → Application sources
└ main → Compiled asset sources
└ java → Java sources
└ controllers → Java controllers
└ models → Java business layer
└ scala → Scala sources
└ controllers → Scala controllers
└ models → Scala business layer
└ resources → Configurations files and other non-compiled resources (on classpath)
└ application.conf → Main configuration file
└ routes → Routes definition
└ twirl
└ views → Templates
└ assets → Compiled asset sources
└ css → Typically LESS CSS sources
└ js → Typically CoffeeScript sources
└ public → Public assets
└ css → CSS files
└ js → Javascript files
└ images → Image files
└ test → Unit or functional tests
└ java → Java source folder for unit or functional tests
└ scala → Scala source folder for unit or functional tests
└ resources → Resource folder for unit or functional tests
└ universal → Arbitrary files to be included in your projects distribution
project → sbt configuration files
└ build.properties → Marker for sbt project
└ plugins.sbt → sbt plugins including the declaration for Play itself
lib → Unmanaged libraries dependencies
logs → Logs folder
└ application.log → Default log file
target → Generated stuff
└ scala-2.11.8
└ cache
└ classes → Compiled class files
└ classes_managed → Managed class files (templates, ...)
└ resource_managed → Managed resources (less, ...)
└ src_managed → Generated sources (templates, ...)
```
```
build.sbt → アプリケーションビルドスクリプト
src → アプリケーションソース
└ main → コンパイルされたアセットソース
└ java → Javaのソース
└ controllers → Javaのコントローラー
└ models → Javaのビジネス層
└ scala → Scalaのソース
└ controllers → Scalaのコントローラー
└ models → Scalaのビジネス層
└ resources → 設定ファイル、および (クラスパス上の) その他のコンパイルされないリソース
└ application.conf → メイン設定ファイル
└ routes → ルート定義
└ twirl
└ views → テンプレート
└ assets → コンパイルされたアセットソース
└ css → 通常は LESS CSS ソース
└ js → 通常は CoffeeScript ソース
└ public → 公開アセット
└ css → CSS ファイル
└ js → Javascript ファイル
└ images → 画像ファイル
└ test → 単体または機能テスト
└ java → 単体、および機能テスト用の Java ソースフォルダ
└ scala → 単体、および機能テスト用の Scala ソースフォルダ
└ resources → 単体、および機能テスト用のリソースフォルダ
└ universal → プロジェクト成果物に含める任意のファイル
project → sbt 設定ファイル群
└ build.properties → sbt プロジェクトの目印
└ plugins.sbt → Play 自身の定義を含む sbt プラグイン
lib → 管理されていない依存ライブラリ
logs → ログフォルダ
└ application.log → デフォルトログフォルファ
target → 生成物
└ scala-2.11.8
└ cache
└ classes → コンパイルされたクラスファイル
└ classes_managed → 管理されたクラスファイル (テンプレート, ...)
└ resource_managed → 管理されたリソース (less, ...)
└ src_managed → 生成されたソース (テンプレート, ...)
```
# Play Tutorials
Playチュートリアル
https://www.playframework.com/documentation/2.6.x/Tutorials
Play’s documentation shows the available features and how to use them, but the documentation will not show how to create an application from start to finish. This is where tutorials and examples come in.
Playのドキュメントには、使用可能な機能とその使用方法が記載されていますが、ドキュメントにはアプリケーションの作成方法が最初から最後まで示されていません。 これは、チュートリアルとサンプルが入っている場所です。
Tutorials and examples are useful for showing a single application at work, especially when it comes to integrating with other systems such as databases or Javascript frameworks.
チュートリアルとサンプルは、特にデータベースやJavascriptフレームワークなどの他のシステムとの統合に関して、単一のアプリケーションを職場で見せるのに便利です。
# Play Maintained Seeds and Example Templates
Playは、Seedsと、例のテンプレートをメンテナンスした
This section covers the core tutorials and examples from Play. These are maintained by the core Play team, and so will be based on the latest Play release.
All of the following projects can be downloaded as example projects from the [download page](https://playframework.com/download).
このセクションでは、Playのコアチュートリアルと例について説明します。 これらは、コアのPlayチームによって管理されているため、最新のPlayリリースに基づいています。
以下のプロジェクトはすべて、[ダウンロードページ](https://playframework.com/download)からサンプルプロジェクトとしてダウンロードできます。
# Play Seeds
There are two Play Seeds that are designed expressly for getting started with new Play applications. They contain a hello world controller and view template, filters, and nothing else.
新しいPlayアプリケーションを使い始めるために明示的に設計された2つのPlay Seedがあります。 それらには、hello worldコントローラとビューテンプレート、フィルタなどが含まれています。
If you have sbt 0.13.13 or higher installed, you can create your own Play project using sbt new
using a minimal giter8 template (roughly like a maven archetype). This is a good choice if you already know Play and want to create a new project immediately.
0.13.13以上のsbtがインストールされている場合は、sbt newを使用して独自のPlayプロジェクトを作成できます
最小のgiter8テンプレート(大まかにはMavenのアーキタイプのようなもの)を使用します。 これは、既にPlayを知っていてすぐに新しいプロジェクトを作成したい場合に適しています。
Type g8Scaffold form from sbt to create the scaffold controller, template and tests needed to process a form.
sbtからg8Scaffoldフォームを入力して、フォームを処理するのに必要な足場コントローラ、テンプレート、およびテストを作成します。
Java
```
sbt new playframework/play-java-seed.g8
```
Scala
```
sbt new playframework/play-scala-seed.g8
```
# Play Starter Projects
For people using Play for the first time, there is a starter project which introduces Play with some sample controllers and components.
Playを初めて使用する人には、いくつかのサンプルコントローラとコンポーネントでPlayを紹介するスタータープロジェクトがあります。
[play-java](https://github.com/playframework/play-java)
[play-scala](https://github.com/playframework/play-scala)
or you can download it as an example project from the [download page](https://playframework.com/download).
または、[ダウンロードページ](https://playframework.com/download)からサンプルプロジェクトとしてダウンロードすることもできます
#Database/ORM Access
Play is unopinionated about database access, and integrates with many object relational layers (ORMs). There is out of the box support for Anorm, EBean, Slick, and JPA, but many customers use NoSQL or REST layers and there are many examples of Play using other ORMs not mentioned here.
Playはデータベースへのアクセスについてはまったく知られておらず、多くのオブジェクト・リレーショナル・レイヤー(ORM)と統合されています。 Anorm、EBean、Slick、JPAのサポートはありませんが、多くのお客様がNoSQLまたはRESTレイヤーを使用しています。ここで言及していない他のORMを使用したPlayの例がたくさんあります。
# Slick
Slick is a Functional Relational Mapping (FRM) library for Scala that makes it easy to work with relational databases. It allows you to work with stored data almost as if you were using Scala collections while at the same time giving you full control over when a database access happens and which data is transferred. You can also use SQL directly. Execution of database actions is done asynchronously, making Slick a perfect fit for your reactive applications based on Play and Akka.
[Slick](http://slick.lightbend.com/docs/)は、Scala用のFunctional Relational Mapping(FRM)ライブラリであり、リレーショナルデータベースでの作業を容易にします。 Scalaコレクションを使用しているかのように、格納されたデータを扱うことができます。同時に、データベースへのアクセスがいつ行われ、どのデータが転送されるかを完全に制御できます。また、SQLを直接使用することもできます。データベースアクションの実行は非同期で行われるため、SlickはPlayおよびAkkaに基づいたリアクティブアプリケーションに最適です。
[play-isolated-slick](https://github.com/playframework/play-isolated-slick): This template uses a multi-module that hides Slick 3.x behind an API layer, and does not use Play-Slick integration. It also contains sbt-flyways and use Slick’s code generator to create the Slick binding from SQL tables.
[play-isolated-slick](https://github.com/playframework/play-isolated-slick):このテンプレートは、APIレイヤの後ろにSlick 3.xを隠し、Play-Slick統合を使用しないマルチモジュールを使用します。また、sbt-flywaysも含まれており、Slickのコードジェネレータを使用してSQLテーブルからSlickバインディングを作成します。
[play-scala-intro](https://github.com/playframework/play-scala-intro): This template uses [PlaySlick](https://www.playframework.com/documentation/2.5.x/PlaySlick) as part of a single Play project.
[play-scala-intro](https://github.com/playframework/play-scala-intro):このテンプレートは、1つのPlayプロジェクトの一部として[PlaySlick](https://www.playframework.com/documentation/2.5.x/PlaySlick)を使用します。
[Computer Database with Play-Slick](https://github.com/playframework/play-slick/tree/master/samples/computer-database): This template uses PlaySlick. You will need to clone the play-slick project from Github and type project computer-database-sample in SBT to get to the sample project.
[Play-Slickによるコンピュータデータベース](https://github.com/playframework/play-slick/tree/master/samples/computer-database):このテンプレートは[PlaySlick](https://www.playframework.com/documentation/2.5.x/PlaySlick)を使用します。 Githubのplay-slickプロジェクトをクローンし、SBTにproject computer-database-sampleと入力して、サンプルプロジェクトにアクセスする必要があります。
# ScalikeJDBC
http://scalikejdbc.org/
Just write SQL and get things done!
ただSQLを書いて、物事を成し遂げてください!!
ScalikeJDBC is a tidy SQL-based DB access library for Scala developers.
ScalikeJDBCはScala開発者のためのきれいなSQLベースのDBアクセスライブラリです。
This library naturally wraps JDBC APIs and provides you easy-to-use and very flexible APIs.
このライブラリは自然にJDBC APIをラップし、使いやすく柔軟なAPIを提供します。
What’s more, QueryDSL makes your code type-safe and reusable.
さらに、QueryDSLを使用すると、コードの型が安全で再利用可能になります。
ScalikeJDBC is a practical and production-ready one. Use this library for your real projects.
ScalikeJDBCは実用的でプロダクション対応のものです。 実際のプロジェクトにはこのライブラリを使用してください。
## Working on the JDBC layer
JDBCレイヤーの操作
Whether you like it or not, JDBC is a stable standard interface. Since most of RDBMS supports JDBC interface, we can access RDBMS in the same way. We never release without passing all the unit tests with the following RDBMS.
あなたが気に入っているかどうかにかかわらず、JDBCは安定した標準インターフェースです。 ほとんどのRDBMSはJDBCインタフェースをサポートしているので、同じ方法でRDBMSにアクセスできます。 私たちは、以下のRDBMSですべての単体テストを通過することなく決してリリースしません。
PostgreSQL
MySQL
H2 Database Engine
HSQLDB
We believe that ScalikeJDBC basically works with any other RDBMS (Oracle, SQL Server and so on).
ScalikeJDBCは基本的に他のRDBMS(Oracle、SQL Serverなど)と連携して動作します。
## Amazon Redshift, Facebook Presto also supports JDBC
Amazon Redshift、Facebook PrestoもJDBCをサポート
If you can access some datastore via JDBC interface, that means you can access them via ScalikeJDBC too.
JDBCインターフェイス経由でいくつかのデータストアにアクセスできる場合は、ScalikeJDBC経由でアクセスすることもできます。
Recently, Amazon Redshift and Facebook Presto support JDBC interface. You can access them via ScalikeJDBC!
最近、Amazon RedshiftとFacebook PrestoがJDBCインタフェースをサポートしています。 ScalikeJDBC経由でアクセスできます!
## Few dependencies
依存関係はほとんどありません
The core of ScalikeJDBC has so few dependencies that you won’t be bothered by dependency hell.
ScalikeJDBCのコアには依存関係がほとんどないため、依存関係に惑わされることはありません。
## JDBC Drivers you need
必要なJDBCドライバ
Commons DBCP
Joda Time 2.x
SLF4J API
Of course, you can use c3p0 (or others) instead of commons-dbcp though ConnectionPool implementation for that isn’t provided by default.
もちろん、ConnectionPoolの実装はデフォルトでは提供されていませんが、c3p0(またはその他)をcommons-dbcpの代わりに使用できます。
## Non-blocking?
ノンブロッキング?
Unfortunately, no. Indeed, JDBC drivers block on socket IO. So using them to talk with RDBMS in async event driven architecture may not be appropriate. However, actually most of real world applications don’t need event-driven architecture yet. JDBC is still important infrastructure for apps on the JVM.
残念だけど違う。 実際、JDBCドライバはソケットIOをブロックします。 したがって、非同期イベント駆動アーキテクチャでRDBMSと話すためにそれらを使用することは適切ではないかもしれません。 しかし実際には、現実世界のアプリケーションのほとんどはイベント駆動型アーキテクチャを必要としません。 JDBCは、JVM上のアプリケーションの重要なインフラストラクチャです。
If you really prefer non-blocking database access, take a look at [ScalikeJDBC-Async](https://github.com/scalikejdbc/scalikejdbc-async). It provides non-blocking APIs to talk with PostgreSQL and MySQL in the JDBC way.
あなたが本当に非ブロッキングデータベースアクセスを好むなら、[ScalikeJDBC-Async](https://github.com/scalikejdbc/scalikejdbc-async)を見てください。 PostgreSQLとMySQLとJDBCの方法で話すための非ブロッキングAPIを提供します。
https://github.com/scalikejdbc/scalikejdbc-async
ScalikeJDBC-Async is still in the alpha stage. If you don’t have the motivation to investigate or fix issues yourself, we recommend waiting until the stable version is released someday.
ScalikeJDBC-Asyncはまだアルファ段階にあります。 問題を調査または解決する動機がない場合は、いつでも安定版がリリースされるまで待つことをおすすめします。
# JPA
This is a example template showing Play with Java Persistence API (JPA), using Hibernate Entity Manager. It is included in the Play project itself.
これは、Hibernate EntityManagerを使用して、Play with Java Persistence API(JPA)を表示するサンプルテンプレートです。 これは、Playプロジェクト自体に含まれています。
[play-java-intro](https://github.com/playframework/play-java-intro)
# Anorm
This is an example template showing Play with [Anorm](https://github.com/playframework/anorm) using Play’s [Anorm Integration](https://www.playframework.com/documentation/ja/2.4.x/ScalaAnorm). It also uses [Play-Bootstrap](https://adrianhurt.github.io/play-bootstrap/) for easy template scaffolding.
これは、Playの[Anorm Integration](https://www.playframework.com/documentation/ja/2.4.x/ScalaAnorm)を使ってPlay with [Anorm](https://github.com/playframework/anorm)を表示するサンプルテンプレートです。 また、簡単なテンプレートのscaffoldingに[Play-Bootstrap](https://adrianhurt.github.io/play-bootstrap/)を使用します。
[playframework/play-anorm](https://github.com/playframework/play-anorm)
# EBean
This is an example template that uses [EBean](https://ebean-orm.github.io/) using Play’s [Ebean integration](https://www.playframework.com/documentation/2.5.x/JavaEbean). It also uses [Play-Bootstrap](https://adrianhurt.github.io/play-bootstrap/) for easy template scaffolding.
これは、Playの[Ebean integration](https://www.playframework.com/documentation/2.5.x/JavaEbean)を使用して[EBean](https://ebean-orm.github.io/)を使用するテンプレートの例です。 また、簡単なテンプレートの足場に[Play-Bootstrap](https://adrianhurt.github.io/play-bootstrap/)を使用します。
[playframework/play-ebean-example](https://github.com/playframework/play-ebean-example)
# Comet / Server Sent Events (SSE)
This is an example template that shows streaming responses through Comet or Server Sent Events, using Akka Streams:
これは、Akka Streamsを使用して、CometまたはServer Sent Eventsを通じてストリーミング応答を表示するテンプレートの例です。
[playframework/play-streaming-scala](https://github.com/playframework/play-streaming-scala)
[playframework/play-streaming-java](https://github.com/playframework/play-streaming-java)
# WebSocket
This is an example template that shows bidirectional streaming through the WebSocket API, using Akka Streams:
これは、Akka Streamsを使用して、WebSocket APIを介した双方向ストリーミングを示すテンプレートの例です。
[playframework/play-websocket-scala](https://github.com/playframework/play-websocket-scala)
[playframework/play-websocket-java](https://github.com/playframework/play-websocket-java)
#Cryptography
暗号
This is an example template showing how to encrypt and sign data securely with [Kalium](https://github.com/abstractj/kalium):
これは、Kaliumで安全にデータを暗号化して署名する方法を示すテンプレートの例です。
[playframework/play-kalium](https://github.com/playframework/play-kalium)
# Compile Time Dependency Injection
コンパイル時間の依存性注入
[Compile time dependency injection](https://www.playframework.com/documentation/2.6.x/ScalaCompileTimeDependencyInjection) can be done in Play in a number of different DI frameworks.
[コンパイル時間の依存性注入](https://www.playframework.com/documentation/2.6.x/ScalaCompileTimeDependencyInjection)は、さまざまなDIフレームワークでPlayで実行できます。
There are two examples shown here, but there are other compile time DI frameworks such as Scaldi, which has [Play integration](http://scaldi.org/learn/#play-integration) built in, and [Dagger 2](https://google.github.io/dagger/), which is written in Java.
ここには2つの例がありますが、[Play integration](http://scaldi.org/learn/#play-integration)が組み込まれたScaldiやJavaで書かれた[Dagger 2](https://google.github.io/dagger/)などのコンパイル時のDIフレームワークもあります。
# Manual Compile Time Dependency Injection
手動のコンパイル時間依存性注入
This is an example template showing how to use manual compile time dependency injection and manual routing with the [SIRD router](https://www.playframework.com/documentation/2.5.x/ScalaSirdRouter), useful for minimal REST APIs and people used to Spray style routing:
これは、最小のREST APIとSprayスタイルのルーティングに使用された人には便利な、[SIRD router](https://www.playframework.com/documentation/2.5.x/ScalaSirdRouter)でのマニュアルコンパイル時の依存性注入と手動ルーティングの使い方を示すサンプルテンプレートです。
[playframework/play-scala-compile-di-with-tests](https://github.com/playframework/play-scala-compile-di-with-tests)
# Macwire Dependency Injection
Macwire依存性注入
This is an example template showing compile time dependency injection using [Macwire](https://github.com/adamw/macwire).
これは、[Macwire](https://github.com/adamw/macwire)を使用したコンパイル時の依存関係注入を示すサンプルテンプレートです。
[playframework/play-macwire-di](https://github.com/playframework/play-macwire-di)
# Third Party Tutorials and Templates
サードパーティのチュートリアルとテンプレート
The Play community also has a number of tutorials and templates that cover aspects of Play than the documentation can, or has a different angle. Templates listed here are not maintained by the Play team, and so may be out of date.
Playコミュニティには、Playの面をカバーする数多くのチュートリアルやテンプレートもあります。ここに記載されているテンプレートは、Playチームによって管理されていないため、古くなっている可能性があります。
This is an incomplete list of several helpful blog posts, and because some of the blog posts have been written a while ago, this section is organized by Play version.
これはいくつかの有益なブログ記事の不完全なリストであり、ブログ記事のいくつかはしばらく前に書かれているので、このセクションはPlay版によって整理されています。
# 2.5.x
## Dependency Injection
依存性注入
[Dependency Injection in Play Framework using Scala](http://www.schibsted.pl/2016/04/dependency-injection-play-framework-scala/) by Krzysztof Pado.
## Akka Streams
[Akka Streams integration in Play Framework 2.5](https://loicdescotte.github.io/posts/play25-akka-streams/) by Loïc Descotte.
[Playing with Akka Streams and Twitter](https://loicdescotte.github.io/posts/play-akka-streams-twitter/) by Loïc Descotte.
## Database
[Play Database Application using Slick, Bootstrap](https://www.lightbend.com/activator/template/activator-play-slick-app): This is an activator project for showcasing best practices and providing a seed for starting with Play & Slick, By [Knoldus](http://www.knoldus.com/home.knol).
[Play Database Application using Slick, Bootstrap](https://www.lightbend.com/activator/template/activator-play-slick-app): これは、[Knoldus](http://www.knoldus.com/home.knol)によって、ベストプラクティスを紹介し、Play&Slickで始まるseedを提供するactivatorプロジェクトです。
## REST APIs
[Making a REST API in Play](https://github.com/playframework/play-rest-api), a multi-part guide using the Scala API, by the Lightbend Play Team.
Lightbend PlayチームによるScala APIを使用した、マルチパートのガイドである[PlayでのREST APIの作成](https://github.com/playframework/play-rest-api)
[Play API REST Template](https://github.com/adrianhurt/play-api-rest-seed) by Adrianhurt: shows how to implement a complete Json RESTful API with some characteristics such as Authentication Token, pagination, filtering, sorting and searching and optional enveloping.
[Play API REST Template](https://github.com/adrianhurt/play-api-rest-seed) by Adrianhurt:認証トークン、ページネーション、フィルタリング、ソート、検索、オプションエンベロープなどの特性を備えた完全なJson RESTful APIを実装する方法を示します。
## Sub-projects
[Play Multidomain Seed](https://github.com/adrianhurt/play-multidomain-seed) by Adrianhurt:tries to be a skeleton for a simple multidomain project (www.myweb.com and admin.myweb.com).
Play Multidomain Seed by Adrianhurt:は、simple multidomainプロジェクト(www.myweb.comとadmin.myweb.com)のスケルトンになろうとします。
It shows you how to use subprojects for that and how to share common code.
サブプロジェクトを使用する方法と共通コードを共有する方法を示します。
It is also ready to use with Webjars, CoffeeScript, LESS, RequireJS, assets Gzip and assets fingerprinting.
Please, check the readme file for more details.
また、Webjars、CoffeeScript、LESS、RequireJS、アセットGzip、アセットのフィンガープリンティングでも使用できます。
詳細については、readmeファイルを確認してください。
[Play Multidomain Auth](https://github.com/adrianhurt/play-multidomain-auth) by Adrianhurt: this is a second part of play-multidomain-seed project.
[Play Multidomain Auth](https://github.com/adrianhurt/play-multidomain-auth) by Adrianhurt:
これは、play-multidomain-seedプロジェクトの第2の部分です。
This project tries to be an example of how to implement an Authentication and Authorization layer using the Silhouette authentication library.
このプロジェクトは、Silhouette認証ライブラリを使用して認証および認可レイヤーを実装する方法の例です。
It also uses [Play-Bootstrap](https://adrianhurt.github.io/play-bootstrap/) for easy template scaffolding.
また、簡単なテンプレートのscaffoldingに[Play-Bootstrap](https://adrianhurt.github.io/play-bootstrap/)を使用します。
# Play for Scala Developers
Scala 開発者のための Play
https://www.playframework.com/documentation/2.6.x/ScalaHome
# Main concepts for Scala
Scalaの主なコンセプト
This section introduces you to the most common aspects of writing a Play application in Scala. You’ll learn about handling HTTP requests, sending HTTP responses, working with different types of data, using databases and much more.
このセクションでは、ScalaでPlayアプリケーションを作成する際の最も一般的な側面について説明します。 HTTPリクエストの処理、HTTPレスポンスの送信、さまざまなタイプのデータの操作、データベースの使用などについて学習します。
Note: The Play APIs for Scala and Java are separated into different packages. All the Scala APIs are under the play.api package; all the Java APIs are under play. For example, the Scala MVC API is under play.api.mvc and the Java MVC API is under play.mvc.
注意:ScalaとJava用のPlay APIは、異なるパッケージに分かれています。 すべてのScala APIはplay.apiパッケージの下にあります。 すべてのJava APIが利用されています。 たとえば、Scala MVC APIはplay.api.mvcの下にあり、Java MVC APIはplay.mvcの下にあります。
https://www.playframework.com/documentation/2.6.x/ScalaHome
主要なコンセプト
# Configuration API
APIの設定
[The Configuration API](https://www.playframework.com/documentation/2.6.x/ScalaConfig)
https://hackmd.io/BwYw7ALAbApghgMwLQAYpgIxIgVjlJOAZjh0JgCYQVKEFKKg?both
# HTTP programming
HTTPプログラミング
[Actions, Controllers and Results](https://www.playframework.com/documentation/2.6.x/ScalaActions)
[HTTP Routing](https://www.playframework.com/documentation/2.6.x/ScalaRouting)
[Manipulating results](https://www.playframework.com/documentation/2.6.x/ScalaResults)
[Session and Flash scopes](https://www.playframework.com/documentation/2.6.x/ScalaSessionFlash)
[Body parsers](https://www.playframework.com/documentation/2.6.x/ScalaBodyParsers)
[Actions composition](https://www.playframework.com/documentation/2.6.x/ScalaActionsComposition)
[Content negotiation](https://www.playframework.com/documentation/2.6.x/ScalaContentNegotiation)
[Handling errors](https://www.playframework.com/documentation/2.6.x/ScalaErrorHandling)
# Asynchronous HTTP programming
非同期 HTTP プログラミング
[Asynchronous results](https://www.playframework.com/documentation/2.6.x/ScalaAsync)
[Streaming HTTP responses](https://www.playframework.com/documentation/2.6.x/ScalaStream)
[Comet](https://www.playframework.com/documentation/2.6.x/ScalaComet)
[WebSockets](https://www.playframework.com/documentation/2.6.x/ScalaWebSockets)
# The Twirl template engine
Twirlテンプレートエンジン
[Scala templates syntax](https://www.playframework.com/documentation/2.6.x/ScalaTemplates)
https://hackmd.io/JwYwTAbAJgpgZgFgLQgXAhkhMCsUnBQDsYSUwMADAEZy7VQjBA==
[Common use cases](https://www.playframework.com/documentation/2.6.x/ScalaTemplateUseCases)
https://hackmd.io/MbAmA4FYGYEYE4C0B2AhsATIgLJADOIgEbT6IBm5qRApgGx1TlGhA===
[Custom format](https://www.playframework.com/documentation/2.6.x/ScalaCustomTemplateFormat)
https://hackmd.io/GwIwjAzAnALCwFoCmSBmIE2EgTAgHACZh4DshMAhvqgKzBRrBA==?both
# Form submission and validation
フォーム送信とバリデーション
[Handling form submission](https://www.playframework.com/documentation/2.6.x/ScalaForms)
[Protecting against CSRF](https://www.playframework.com/documentation/2.6.x/ScalaCsrf)
[Custom Validations](https://www.playframework.com/documentation/2.6.x/ScalaCustomValidations)
[Custom Field Constructors](https://www.playframework.com/documentation/2.6.x/ScalaCustomFieldConstructors)
# Working with Json
Jsonを使う
[JSON basics](https://www.playframework.com/documentation/2.6.x/ScalaJson)
[JSON with HTTP](https://www.playframework.com/documentation/2.6.x/ScalaJsonHttp)
[JSON Reads/Writes/Format Combinators](https://www.playframework.com/documentation/2.6.x/ScalaJsonCombinators)
[JSON automated mapping](https://www.playframework.com/documentation/2.6.x/ScalaJsonAutomated)
[JSON Transformers](https://www.playframework.com/documentation/2.6.x/ScalaJsonTransformers)
# Working with XML
XMLを使う
[Handling and serving XML requests](https://www.playframework.com/documentation/2.6.x/ScalaXmlRequests)
# Handling file upload
ファイルアップロード処理
[Direct upload and multipart/form-data](https://www.playframework.com/documentation/2.6.x/ScalaFileUpload)
# Accessing an SQL database
SQLデーターベースアクセス
1 [Configuring and using JDBC](https://www.playframework.com/documentation/2.6.x/ScalaDatabase)
https://hackmd.io/GwMwHArARgDJC0JY3gFhAQxPKICMA7PAJwYxQCmFxYMATMMUA===
2 [Using Slick to access your database](https://www.playframework.com/documentation/2.6.x/PlaySlick)
2.1 [Using Play Slick](https://www.playframework.com/documentation/2.6.x/PlaySlick)
2.2 [Play Slick migration guide](https://www.playframework.com/documentation/2.6.x/PlaySlickMigrationGuide)
2.3 [Play Slick advanced topics](https://www.playframework.com/documentation/2.6.x/PlaySlickAdvancedTopics)
2.4 [Play Slick FAQ](https://www.playframework.com/documentation/2.6.x/PlaySlickFAQ)
3 [Using Anorm to access your database](https://www.playframework.com/documentation/2.6.x/ScalaAnorm)
# Using the Cache
キャッシュを使う
[Using the Cache](https://www.playframework.com/documentation/2.6.x/ScalaCache)
# Calling WebServices
Webサービスの呼び出し
[The Play WS API](https://www.playframework.com/documentation/2.6.x/ScalaWS)
[Connecting to OpenID services](https://www.playframework.com/documentation/2.6.x/ScalaOpenID)
[Accessing resources protected by OAuth](https://www.playframework.com/documentation/2.6.x/ScalaOAuth)
# Integrating with Akka
Akkaとの統合
[Integrating with Akka](https://www.playframework.com/documentation/2.6.x/ScalaAkka)
# Internationalization with Messages
Messagesで、国際化
[Internationalization with Messages](https://www.playframework.com/documentation/2.6.x/ScalaI18N)
# Dependency injection
依存生の注入
[Runtime dependency injection](https://www.playframework.com/documentation/2.6.x/ScalaDependencyInjection)
[Compile time dependency injection](https://www.playframework.com/documentation/2.6.x/ScalaCompileTimeDependencyInjection)
# Application Settings
アプリケーションの設定
[Application Settings](https://www.playframework.com/documentation/2.6.x/ScalaApplication)
[HTTP request handlers](https://www.playframework.com/documentation/2.6.x/ScalaHttpRequestHandlers)
[Essential Actions](https://www.playframework.com/documentation/2.6.x/ScalaEssentialAction)
[HTTP filters](https://www.playframework.com/documentation/2.6.x/ScalaHttpFilters)
# Testing your application
あなたのアプリケーションのテスト
[Testing your Application](https://www.playframework.com/documentation/2.6.x/ScalaTestingYourApplication)
[Testing with ScalaTest](https://www.playframework.com/documentation/2.6.x/ScalaTestingWithScalaTest)
[Writing functional tests with ScalaTest](https://www.playframework.com/documentation/2.6.x/ScalaFunctionalTestingWithScalaTest)
[Testing with specs2](https://www.playframework.com/documentation/2.6.x/ScalaTestingWithSpecs2)
[Writing functional tests with specs2](https://www.playframework.com/documentation/2.6.x/ScalaTestingWithSpecs2)
[Testing with Guice](https://www.playframework.com/documentation/2.6.x/ScalaTestingWithGuice)
[Testing with databases](https://www.playframework.com/documentation/2.6.x/ScalaTestingWithDatabases)
[Testing web service clients](https://www.playframework.com/documentation/2.6.x/ScalaTestingWebServiceClients)
# Logging
ロギング
[Logging](https://www.playframework.com/documentation/2.6.x/ScalaLogging)