Packages

  • package root
    Definition Classes
    root
  • package play

    Play framework.

    Play framework.

    Play

    http://www.playframework.com

    Definition Classes
    root
  • package api

    Contains the public API for Scala developers.

    Contains the public API for Scala developers.

    Read configuration
    val poolSize = configuration.getInt("engine.pool.size")
    Use the logger
    Logger.info("Hello!")
    Define a Plugin
    class MyPlugin(app: Application) extends Plugin
    Create adhoc applications (for testing)
    val application = Application(new File("."), this.getClass.getClassloader, None, Play.Mode.DEV)
    Definition Classes
    play
  • package cache

    Contains the Cache access API.

  • package cluster
  • package controllers
  • package data

    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
      )
    )
  • package db

    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")
  • package http

    Contains standard HTTP constants.

    Contains standard HTTP constants. For example:

    val text = ContentTypes.TEXT
    val ok = Status.OK
    val accept = HeaderNames.ACCEPT
  • package i18n

    Contains the internationalisation API.

    Contains the internationalisation API.

    For example, translating a message:

    val msgString = Messages("items.found", items.size)
  • package inject

    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.

    See also

    The Module class for information on how to provide bindings.

  • package internal
  • package libs

    Contains various APIs that are useful while developing web applications.

  • package mvc

    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!")
      }
    
    }
  • package routing
  • package templates
  • package test

    Contains test helpers.

  • Application
  • ApplicationLoader
  • BuiltInComponents
  • BuiltInComponentsFromContext
  • ConfigLoader
  • Configuration
  • ContextBasedBuiltInComponents
  • DefaultApplication
  • DefaultMarkerContext
  • Environment
  • Logger
  • LoggerConfigurator
  • LoggerLike
  • Logging
  • LowPriorityMarkerContextImplicits
  • MarkerContext
  • MarkerContexts
  • Mode
  • NoHttpFiltersComponents
  • OptionalDevContext
  • OptionalSourceMapper
  • OptionalSourceMapperProvider
  • Play
  • UnexpectedException
  • package cluster
    Definition Classes
    play
  • package core
    Definition Classes
    play
  • package filters
    Definition Classes
    play
  • package routing
    Definition Classes
    play
  • package server
    Definition Classes
    play
  • package twirl
    Definition Classes
    play
  • package utils
    Definition Classes
    play

package api

Contains the public API for Scala developers.

Read configuration
val poolSize = configuration.getInt("engine.pool.size")
Use the logger
Logger.info("Hello!")
Define a Plugin
class MyPlugin(app: Application) extends Plugin
Create adhoc applications (for testing)
val application = Application(new File("."), this.getClass.getClassloader, None, Play.Mode.DEV)
Source
package.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. api
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Package Members

  1. package cache

    Contains the Cache access API.

  2. package cluster
  3. package controllers
  4. package data

    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
      )
    )
  5. package db

    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")
  6. package http

    Contains standard HTTP constants.

    Contains standard HTTP constants. For example:

    val text = ContentTypes.TEXT
    val ok = Status.OK
    val accept = HeaderNames.ACCEPT
  7. package i18n

    Contains the internationalisation API.

    Contains the internationalisation API.

    For example, translating a message:

    val msgString = Messages("items.found", items.size)
  8. package inject

    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.

    See also

    The Module class for information on how to provide bindings.

  9. package internal
  10. package libs

    Contains various APIs that are useful while developing web applications.

  11. package mvc

    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!")
      }
    
    }
  12. package routing
  13. package templates
  14. package test

    Contains test helpers.

Type Members

  1. trait Application extends AnyRef

    A Play application.

    A Play application.

    Application creation is handled by the framework engine.

    If you need to create an ad-hoc application, for example in case of unit testing, you can easily achieve this using:

    val application = new DefaultApplication(new File("."), this.getClass.getClassloader, None, Play.Mode.Dev)

    This will create an application using the current classloader.

    Annotations
    @implicitNotFound()
  2. trait ApplicationLoader extends AnyRef

    Loads an application.

    Loads an application. This is responsible for instantiating an application given a context.

    Application loaders are expected to instantiate all parts of an application, wiring everything together. They may be manually implemented, if compile time wiring is preferred, or core/third party implementations may be used, for example that provide a runtime dependency injection framework.

    During dev mode, an ApplicationLoader will be instantiated once, and called once, each time the application is reloaded. In prod mode, the ApplicationLoader will be instantiated and called once when the application is started.

    Out of the box Play provides a Guice module that defines a Java and Scala default implementation based on Guice, as well as various helpers like GuiceApplicationBuilder. This can be used simply by adding the "PlayImport.guice" dependency in build.sbt.

    A custom application loader can be configured using the play.application.loader configuration property. Implementations must define a no-arg constructor.

  3. trait BuiltInComponents extends I18nComponents with PekkoComponents with PekkoTypedComponents

    Helper to provide the Play built in components.

  4. abstract class BuiltInComponentsFromContext extends ContextBasedBuiltInComponents

    This helper class provides all the built-in component dependencies by trading them for a single dependency - the application loader context.

  5. trait ConfigLoader[A] extends AnyRef

    A config loader

  6. case class Configuration(underlying: Config) extends Product with Serializable

    A full configuration set.

    A full configuration set.

    The underlying implementation is provided by https://github.com/lightbend/config.

    underlying

    the underlying Config implementation

  7. trait ContextBasedBuiltInComponents extends BuiltInComponents

    This helper trait provides all the built-in component dependencies by trading them for a single dependency - the application loader context.

  8. class DefaultApplication extends Application
    Annotations
    @Singleton()
  9. class DefaultMarkerContext extends MarkerContext

    A default marker context.

    A default marker context. This is used by MarkerContext.apply, but can also be used to provide explicit typing for markers. For example, to define a SecurityContext marker, you can define a case object extending DefaultMarkerContext:

    case object SecurityMarkerContext extends DefaultMarkerContext(MarkerFactory.getMarker("SECURITY"))
  10. case class Environment(rootPath: File, classLoader: ClassLoader, mode: Mode) extends Product with Serializable

    The environment for the application.

    The environment for the application.

    Captures concerns relating to the classloader and the filesystem for the application.

    rootPath

    The root path that the application is deployed at.

    classLoader

    The classloader that all application classes and resources can be loaded from.

    mode

    The mode of the application.

  11. class Logger extends LoggerLike

    A Play logger.

  12. trait LoggerConfigurator extends AnyRef

    Runs through underlying logger configuration.

  13. trait LoggerLike extends AnyRef

    Typical logger interface.

  14. trait Logging extends AnyRef

    A trait that can mixed into a class or trait to add a logger named based on the class name.

  15. trait LowPriorityMarkerContextImplicits extends AnyRef
  16. trait MarkerContext extends AnyRef

    A MarkerContext trait, to provide easy access to org.slf4j.Marker in Logger API.

    A MarkerContext trait, to provide easy access to org.slf4j.Marker in Logger API. This is usually accessed with a marker through an implicit conversion from a Marker.

    implicit val markerContext: MarkerContext = org.slf4j.MarkerFactory.getMarker("EXAMPLEMARKER")
    log.error("This message will be logged with the EXAMPLEMARKER marker")
  17. sealed abstract class Mode extends AnyRef

    Application mode, either Dev, Test, or Prod.

    Application mode, either Dev, Test, or Prod.

    See also

    play.Mode

  18. trait NoHttpFiltersComponents extends AnyRef

    A component to mix in when no default filters should be mixed in to BuiltInComponents.

    A component to mix in when no default filters should be mixed in to BuiltInComponents.

    See also

    BuiltInComponents.httpFilters

  19. final class OptionalDevContext extends AnyRef

    Represents an Option[DevContext] so that it can be used for dependency injection.

    Represents an Option[DevContext] so that it can be used for dependency injection. We can't easily use a plain Option[DevContext] since Java erases the type parameter of that type.

  20. final class OptionalSourceMapper extends AnyRef

    Represents an Option[SourceMapper] so that it can be used for dependency injection.

    Represents an Option[SourceMapper] so that it can be used for dependency injection. We can't easily use a plain Option[SourceMapper] since Java erases the type parameter of that type.

  21. final class OptionalSourceMapperProvider extends Provider[OptionalSourceMapper]
    Annotations
    @Singleton()
  22. case class UnexpectedException(message: Option[String] = None, unexpected: Option[Throwable] = None) extends PlayException with Product with Serializable

    Generic exception for unexpected error cases.

Value Members

  1. object Application
  2. object ApplicationLoader
  3. object ConfigLoader
  4. object Configuration extends Serializable

    This object provides a set of operations to create Configuration values.

    This object provides a set of operations to create Configuration values.

    For example, to load a Configuration in a running application:

    val config = Configuration.load()
    val foo = config.getString("foo").getOrElse("boo")

    The underlying implementation is provided by https://github.com/lightbend/config.

  5. object Environment extends Serializable
  6. object Logger

    High-level API for logging operations.

    High-level API for logging operations.

    For example, logging with the default application logger:

    Logger.info("Hello!")

    Logging with a custom logger:

    Logger("my.logger").info("Hello!")
  7. object LoggerConfigurator
  8. object MarkerContext extends LowPriorityMarkerContextImplicits
  9. object MarkerContexts
  10. object Mode
  11. object Play

    High-level API to access Play global features.

Inherited from AnyRef

Inherited from Any

Ungrouped