play.api

Application

class Application extends AnyRef

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 = Application(new File("."), this.getClass.getClassloader, None, Play.Mode.Dev)

This will create an application using the current classloader.

Annotations
@implicitNotFound( ... )
Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. Application
  2. AnyRef
  3. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Application (path: File, classloader: ClassLoader, sources: Option[SourceMapper], mode: Mode)

    path

    the absolute path hosting this application, mainly used by the getFile(path) helper method

    classloader

    the application's classloader

    sources

    the SourceMapper used to retrieve source code displayed in error pages

    mode

    Dev or Prod, passed as information for the user code

Value Members

  1. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  2. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  3. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  4. def == (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  5. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  6. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  7. val classloader : ClassLoader

    the application's classloader

  8. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  9. def configuration : Configuration

    The configuration used by this application.

    The configuration used by this application.

    See also

    play.api.Configuration

  10. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  11. def equals (arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  12. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  13. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef → Any
  14. def getExistingFile (relativePath: String): Option[File]

    Retrieves a file relative to the application root path.

    Retrieves a file relative to the application root path. This method returns an Option[File], using None if the file was not found.

    For example, to retrieve a configuration file:

    val myConf = application.getExistingFile("conf/myConf.yml")
    
    relativePath

    the relative path of the file to fetch

    returns

    an existing file

  15. def getFile (relativePath: String): File

    Retrieves a file relative to the application root path.

    Retrieves a file relative to the application root path.

    For example, to retrieve a configuration file:

    val myConf = application.getFile("conf/myConf.yml")
    
    relativePath

    relative path of the file to fetch

    returns

    a file instance; it is not guaranteed that the file exists

  16. def getTypesAnnotatedWith [T <: Annotation] (packageName: String, annotation: Class[T]): Set[String]

    Scans the application classloader to retrieve all types annotated with a specific annotation.

    Scans the application classloader to retrieve all types annotated with a specific annotation.

    This method is useful for some plugins, for example the EBean plugin will automatically detect all types annotated with @javax.persistance.Entity, using:

    val entities = application.getTypesAnnotatedWith("models", classOf[javax.persistance.Entity])
    

    Note that it is better to specify a very specific package to avoid expensive searches.

    T

    the annotation type

    packageName

    the root package to scan

    annotation

    the annotation class

    returns

    a set of types names specifying the condition

  17. val global : GlobalSettings

    The global settings object used by this application.

    The global settings object used by this application.

    See also

    play.api.GlobalSettings

  18. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  19. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  20. val mode : Mode

    Dev or Prod, passed as information for the user code

  21. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  22. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  23. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  24. val path : File

    the absolute path hosting this application, mainly used by the getFile(path) helper method

  25. def plugin [T] (pluginClass: Class[T]): Option[T]

    Retrieves a plugin of type T.

    Retrieves a plugin of type T.

    For example, retrieving the DBPlugin instance:

    val dbPlugin = application.plugin(classOf[DBPlugin])
    
    T

    the plugin type

    pluginClass

    the plugin’s class

    returns

    the plugin instance, wrapped in an option, used by this application

  26. def plugin [T] (implicit m: Manifest[T]): Option[T]

    Retrieves a plugin of type T.

    Retrieves a plugin of type T.

    For example, to retrieve the DBPlugin instance:

    val dbPlugin = application.plugin[DBPlugin].map(_.api).getOrElse(sys.error("problem with the plugin"))
    
    T

    the plugin type

    returns

    The plugin instance used by this application.

  27. val plugins : Seq[Plugin]

    The plugins list used by this application.

    The plugins list used by this application.

    Plugin classes must extend play.api.Plugin and are automatically discovered by searching for all play.plugins files in the classpath.

    A play.plugins file contains a list of plugin classes to be loaded, and sorted by priority:

    100:play.api.i18n.MessagesPlugin
    200:play.api.db.DBPlugin
    250:play.api.cache.BasicCachePlugin
    300:play.db.ebean.EbeanPlugin
    400:play.db.jpa.JPAPlugin
    500:play.api.db.evolutions.EvolutionsPlugin
    1000:play.api.libs.akka.AkkaPlugin
    10000:play.api.GlobalPlugin
    
    See also

    play.api.Plugin

  28. def resource (name: String): Option[URL]

    Scans the application classloader to retrieve a resource.

    Scans the application classloader to retrieve a resource.

    For example, to retrieve a configuration file:

    val maybeConf = application.resource("conf/logger.xml")
    
    name

    the absolute name of the resource (from the classpath root)

    returns

    the resource URL, if found

  29. def resourceAsStream (name: String): Option[InputStream]

    Scans the application classloader to retrieve a resource’s contents as a stream.

    Scans the application classloader to retrieve a resource’s contents as a stream.

    For example, to retrieve a configuration file:

    val maybeConf = application.resourceAsStream("conf/logger.xml")
    
    name

    the absolute name of the resource (from the classpath root)

    returns

    a stream, if found

  30. val routes : Option[Routes]

    The router used by this application (if defined).

  31. val sources : Option[SourceMapper]

    the SourceMapper used to retrieve source code displayed in error pages

  32. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  33. def toString (): String

    Definition Classes
    AnyRef → Any
  34. def wait (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  35. def wait (arg0: Long, arg1: Int): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  36. def wait (arg0: Long): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from AnyRef

Inherited from Any