Play framework.
Contains the public API for Scala developers.
Contains the public API for Scala developers.
val poolSize = configuration.getInt("engine.pool.size")
Logger.info("Hello!")
class MyPlugin(app: Application) extends Plugin
val application = Application(new File("."), this.getClass.getClassloader, None, Play.Mode.DEV)
Contains the Cache access API.
Contains the Cache access API.
Contains data manipulation helpers (typically HTTP form handling)
Contains data manipulation helpers (typically HTTP form handling)
import play.api.data._ import play.api.data.Forms._ val taskForm = Form( tuple( "name" -> text(minLength = 3), "dueDate" -> date("yyyy-MM-dd"), "done" -> boolean ) )
Contains the JDBC database access API.
Contains the JDBC database access API.
Example, retrieving a connection from the 'customers' datasource:
val conn = db.getConnection("customers")
Contains standard HTTP constants.
Contains standard HTTP constants. For example:
val text = ContentTypes.TEXT val ok = Status.OK val accept = HeaderNames.ACCEPT
Contains the internationalisation API.
Contains the internationalisation API.
For example, translating a message:
val msgString = Messages("items.found", items.size)
Play's runtime dependency injection abstraction.
Play's runtime dependency injection abstraction.
Play's runtime dependency injection support is built on JSR-330, which provides a specification for declaring how dependencies get wired to components. JSR-330 however does not address how components are provided to or located by a DI container. Play's API seeks to address this in a DI container agnostic way.
The reason for providing this abstraction is so that Play, the modules it provides, and third party modules can all express their bindings in a way that is not specific to any one DI container.
Components are bound in the DI container. Each binding is identified by a BindingKey, which is typically an interface that the component implements, and may be optionally qualified by a JSR-330 qualifier annotation. A binding key is bound to a BindingTarget, which describes how the implementation of the interface that the binding key represents is constructed or provided. Bindings may also be scoped using JSR-330 scope annotations.
Bindings are provided by instances of Module.
Out of the box, Play provides an implementation of this abstraction using Guice.
Contains various APIs that are useful while developing web applications.
Contains various APIs that are useful while developing web applications.
Contains the Controller/Action/Result API to handle HTTP requests.
Contains the Controller/Action/Result API to handle HTTP requests.
For example, a typical controller:
class HomeController @Inject() (val controllerComponents: ControllerComponents) extends BaseController { def index = Action { Ok("It works!") } }
Contains test helpers.
Contains test helpers.