play.api.mvc

Controller

trait Controller extends Results with BodyParsers with Status with HeaderNames with ContentTypes

Defines utility methods to generate Action and Results types.

For example:

object Application extends Controller {

  def hello(name:String) = Action { request =>
    Ok("Hello " + name)
  }

}
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. Controller
  2. ContentTypes
  3. HeaderNames
  4. Status
  5. BodyParsers
  6. Results
  7. AnyRef
  8. Any
Visibility
  1. Public
  2. All

Type Members

  1. class Status extends SimpleResult[EmptyContent]

    Generates default SimpleResult from a content type, headers and content.

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. val ACCEPT : String

    Definition Classes
    HeaderNames
  7. val ACCEPTED : Int

    Definition Classes
    Status
  8. val ACCEPT_CHARSET : String

    Definition Classes
    HeaderNames
  9. val ACCEPT_ENCODING : String

    Definition Classes
    HeaderNames
  10. val ACCEPT_LANGUAGE : String

    Definition Classes
    HeaderNames
  11. val ACCEPT_RANGES : String

    Definition Classes
    HeaderNames
  12. val AGE : String

    Definition Classes
    HeaderNames
  13. val ALLOW : String

    Definition Classes
    HeaderNames
  14. val AUTHORIZATION : String

    Definition Classes
    HeaderNames
  15. val Accepted : Status

    Generates a ‘202 ACCEPTED’ result.

    Generates a ‘202 ACCEPTED’ result.

    Definition Classes
    Results
  16. def Async (promise: Promise[Result]): AsyncResult

    Definition Classes
    Results
  17. val BAD_GATEWAY : Int

    Definition Classes
    Status
  18. val BAD_REQUEST : Int

    Definition Classes
    Status
  19. val BINARY : String

    Content-Type of binary data.

    Content-Type of binary data.

    Definition Classes
    ContentTypes
  20. val BadRequest : Status

    Generates a ‘400 BAD_REQUEST’ result.

    Generates a ‘400 BAD_REQUEST’ result.

    Definition Classes
    Results
  21. val CACHE_CONTROL : String

    Definition Classes
    HeaderNames
  22. val CONFLICT : Int

    Definition Classes
    Status
  23. val CONNECTION : String

    Definition Classes
    HeaderNames
  24. val CONTENT_DISPOSITION : String

    Definition Classes
    HeaderNames
  25. val CONTENT_ENCODING : String

    Definition Classes
    HeaderNames
  26. val CONTENT_LANGUAGE : String

    Definition Classes
    HeaderNames
  27. val CONTENT_LENGTH : String

    Definition Classes
    HeaderNames
  28. val CONTENT_LOCATION : String

    Definition Classes
    HeaderNames
  29. val CONTENT_MD5 : String

    Definition Classes
    HeaderNames
  30. val CONTENT_RANGE : String

    Definition Classes
    HeaderNames
  31. val CONTENT_TRANSFER_ENCODING : String

    Definition Classes
    HeaderNames
  32. val CONTENT_TYPE : String

    Definition Classes
    HeaderNames
  33. val CONTINUE : Int

    Definition Classes
    Status
  34. val COOKIE : String

    Definition Classes
    HeaderNames
  35. val CREATED : Int

    Definition Classes
    Status
  36. def CSS (implicit codec: Codec): String

    Content-Type of css according the implicit codec value.

    Content-Type of css according the implicit codec value.

    Definition Classes
    ContentTypes
  37. val Conflict : Status

    Generates a ‘409 CONFLICT’ result.

    Generates a ‘409 CONFLICT’ result.

    Definition Classes
    Results
  38. val Created : Status

    Generates a ‘201 CREATED’ result.

    Generates a ‘201 CREATED’ result.

    Definition Classes
    Results
  39. val DATE : String

    Definition Classes
    HeaderNames
  40. val ETAG : String

    Definition Classes
    HeaderNames
  41. def EVENT_STREAM (implicit codec: Codec): String

    Content-Type of server sent events according the implicit codec value

    Content-Type of server sent events according the implicit codec value

    Definition Classes
    ContentTypes
  42. val EXPECT : String

    Definition Classes
    HeaderNames
  43. val EXPECTATION_FAILED : Int

    Definition Classes
    Status
  44. val EXPIRES : String

    Definition Classes
    HeaderNames
  45. val EntityTooLarge : Status

    Generates a ‘413 REQUEST_ENTITY_TOO_LARGE’ result.

    Generates a ‘413 REQUEST_ENTITY_TOO_LARGE’ result.

    Definition Classes
    Results
  46. val ExpectationFailed : Status

    Generates a ‘417 EXPECTATION_FAILED’ result.

    Generates a ‘417 EXPECTATION_FAILED’ result.

    Definition Classes
    Results
  47. val FORBIDDEN : Int

    Definition Classes
    Status
  48. def FORM (implicit codec: Codec): String

    Content-Type of form-urlencoded according the implicit codec value.

    Content-Type of form-urlencoded according the implicit codec value.

    Definition Classes
    ContentTypes
  49. val FOUND : Int

    Definition Classes
    Status
  50. val FROM : String

    Definition Classes
    HeaderNames
  51. val Forbidden : Status

    Generates a ‘403 FORBIDDEN’ result.

    Generates a ‘403 FORBIDDEN’ result.

    Definition Classes
    Results
  52. def Found (url: String): SimpleResult[EmptyContent]

    Generates a ‘302 FOUND’ simple result.

    Generates a ‘302 FOUND’ simple result.

    url

    the URL to redirect to

    Definition Classes
    Results
  53. val GATEWAY_TIMEOUT : Int

    Definition Classes
    Status
  54. val GONE : Int

    Definition Classes
    Status
  55. val Gone : Status

    Generates a ‘410 GONE’ result.

    Generates a ‘410 GONE’ result.

    Definition Classes
    Results
  56. val HOST : String

    Definition Classes
    HeaderNames
  57. def HTML (implicit codec: Codec): String

    Content-Type of html according the implicit codec value.

    Content-Type of html according the implicit codec value.

    Definition Classes
    ContentTypes
  58. val HTTP_VERSION_NOT_SUPPORTED : Int

    Definition Classes
    Status
  59. val IF_MATCH : String

    Definition Classes
    HeaderNames
  60. val IF_MODIFIED_SINCE : String

    Definition Classes
    HeaderNames
  61. val IF_NONE_MATCH : String

    Definition Classes
    HeaderNames
  62. val IF_RANGE : String

    Definition Classes
    HeaderNames
  63. val IF_UNMODIFIED_SINCE : String

    Definition Classes
    HeaderNames
  64. val INTERNAL_SERVER_ERROR : Int

    Definition Classes
    Status
  65. val InternalServerError : Status

    Generates a ‘500 INTERNAL_SERVER_ERROR’ result.

    Generates a ‘500 INTERNAL_SERVER_ERROR’ result.

    Definition Classes
    Results
  66. def JAVASCRIPT (implicit codec: Codec): String

    Content-Type of javascript according the implicit codec value.

    Content-Type of javascript according the implicit codec value.

    Definition Classes
    ContentTypes
  67. def JSON (implicit codec: Codec): String

    Content-Type of json according the implicit codec value.

    Content-Type of json according the implicit codec value.

    Definition Classes
    ContentTypes
  68. val LAST_MODIFIED : String

    Definition Classes
    HeaderNames
  69. val LENGTH_REQUIRED : Int

    Definition Classes
    Status
  70. val LOCATION : String

    Definition Classes
    HeaderNames
  71. val MAX_FORWARDS : String

    Definition Classes
    HeaderNames
  72. val METHOD_NOT_ALLOWED : Int

    Definition Classes
    Status
  73. val MOVED_PERMANENTLY : Int

    Definition Classes
    Status
  74. val MULTIPLE_CHOICES : Int

    Definition Classes
    Status
  75. val MethodNotAllowed : Status

    Generates a ‘405 METHOD_NOT_ALLOWED’ result.

    Generates a ‘405 METHOD_NOT_ALLOWED’ result.

    Definition Classes
    Results
  76. def MovedPermanently (url: String): SimpleResult[EmptyContent]

    Generates a ‘301 MOVED_PERMANENTLY’ simple result.

    Generates a ‘301 MOVED_PERMANENTLY’ simple result.

    url

    the URL to redirect to

    Definition Classes
    Results
  77. val NON_AUTHORITATIVE_INFORMATION : Int

    Definition Classes
    Status
  78. val NOT_ACCEPTABLE : Int

    Definition Classes
    Status
  79. val NOT_FOUND : Int

    Definition Classes
    Status
  80. val NOT_IMPLEMENTED : Int

    Definition Classes
    Status
  81. val NOT_MODIFIED : Int

    Definition Classes
    Status
  82. val NO_CONTENT : Int

    Definition Classes
    Status
  83. val NoContent : SimpleResult[EmptyContent]

    Generates a ‘204 NO_CONTENT’ result.

    Generates a ‘204 NO_CONTENT’ result.

    Definition Classes
    Results
  84. val NonAuthoritativeInformation : Status

    Generates a ‘203 NON_AUTHORITATIVE_INFORMATION’ result.

    Generates a ‘203 NON_AUTHORITATIVE_INFORMATION’ result.

    Definition Classes
    Results
  85. val NotAcceptable : Status

    Generates a ‘406 NOT_ACCEPTABLE’ result.

    Generates a ‘406 NOT_ACCEPTABLE’ result.

    Definition Classes
    Results
  86. val NotFound : Status

    Generates a ‘404 NOT_FOUND’ result.

    Generates a ‘404 NOT_FOUND’ result.

    Definition Classes
    Results
  87. val NotImplemented : Status

    Generates a ‘501 NOT_IMPLEMENTED’ result.

    Generates a ‘501 NOT_IMPLEMENTED’ result.

    Definition Classes
    Results
  88. val NotModified : SimpleResult[EmptyContent]

    Generates a ‘304 NOT_MODIFIED’ result.

    Generates a ‘304 NOT_MODIFIED’ result.

    Definition Classes
    Results
  89. val OK : Int

    Definition Classes
    Status
  90. val Ok : Status

    Generates a ‘200 OK’ result.

    Generates a ‘200 OK’ result.

    Definition Classes
    Results
  91. val PARTIAL_CONTENT : Int

    Definition Classes
    Status
  92. val PAYMENT_REQUIRED : Int

    Definition Classes
    Status
  93. val PRAGMA : String

    Definition Classes
    HeaderNames
  94. val PRECONDITION_FAILED : Int

    Definition Classes
    Status
  95. val PROXY_AUTHENTICATE : String

    Definition Classes
    HeaderNames
  96. val PROXY_AUTHENTICATION_REQUIRED : Int

    Definition Classes
    Status
  97. val PROXY_AUTHORIZATION : String

    Definition Classes
    HeaderNames
  98. val PartialContent : Status

    Generates a ‘206 PARTIAL_CONTENT’ result.

    Generates a ‘206 PARTIAL_CONTENT’ result.

    Definition Classes
    Results
  99. val PreconditionFailed : Status

    Generates a ‘412 PRECONDITION_FAILED’ result.

    Generates a ‘412 PRECONDITION_FAILED’ result.

    Definition Classes
    Results
  100. val RANGE : String

    Definition Classes
    HeaderNames
  101. val REFERER : String

    Definition Classes
    HeaderNames
  102. val REQUESTED_RANGE_NOT_SATISFIABLE : Int

    Definition Classes
    Status
  103. val REQUEST_ENTITY_TOO_LARGE : Int

    Definition Classes
    Status
  104. val REQUEST_TIMEOUT : Int

    Definition Classes
    Status
  105. val REQUEST_URI_TOO_LONG : Int

    Definition Classes
    Status
  106. val RESET_CONTENT : Int

    Definition Classes
    Status
  107. val RETRY_AFTER : String

    Definition Classes
    HeaderNames
  108. def Redirect (call: Call): SimpleResult[EmptyContent]

    Generates a redirect simple result.

    Generates a redirect simple result.

    call

    Call defining the URL to redirect to, which typically comes from the reverse router

    Definition Classes
    Results
  109. def Redirect (url: String, queryString: Map[String, Seq[String]] = Map.empty, status: Int = SEE_OTHER): SimpleResult[EmptyContent]

    Generates a redirect simple result.

    Generates a redirect simple result.

    url

    the URL to redirect to

    queryString

    queryString parameters to add to the queryString

    status

    HTTP status

    Definition Classes
    Results
  110. def Redirect (url: String, status: Int): SimpleResult[EmptyContent]

    Generates a redirect simple result.

    Generates a redirect simple result.

    url

    the URL to redirect to

    status

    HTTP status

    Definition Classes
    Results
  111. val RequestTimeout : Status

    Generates a ‘408 REQUEST_TIMEOUT’ result.

    Generates a ‘408 REQUEST_TIMEOUT’ result.

    Definition Classes
    Results
  112. val ResetContent : SimpleResult[EmptyContent]

    Generates a ‘205 RESET_CONTENT’ result.

    Generates a ‘205 RESET_CONTENT’ result.

    Definition Classes
    Results
  113. val SEE_OTHER : Int

    Definition Classes
    Status
  114. val SERVER : String

    Definition Classes
    HeaderNames
  115. val SERVICE_UNAVAILABLE : Int

    Definition Classes
    Status
  116. val SET_COOKIE : String

    Definition Classes
    HeaderNames
  117. val SET_COOKIE2 : String

    Definition Classes
    HeaderNames
  118. val SWITCHING_PROTOCOLS : Int

    Definition Classes
    Status
  119. def SeeOther (url: String): SimpleResult[EmptyContent]

    Generates a ‘303 SEE_OTHER’ simple result.

    Generates a ‘303 SEE_OTHER’ simple result.

    url

    the URL to redirect to

    Definition Classes
    Results
  120. val ServiceUnavailable : Status

    Generates a ‘503 SERVICE_UNAVAILABLE’ result.

    Generates a ‘503 SERVICE_UNAVAILABLE’ result.

    Definition Classes
    Results
  121. def Status (code: Int): Status

    Generates a simple result.

    Generates a simple result.

    code

    the status code

    Definition Classes
    Results
  122. val TE : String

    Definition Classes
    HeaderNames
  123. val TEMPORARY_REDIRECT : Int

    Definition Classes
    Status
  124. def TEXT (implicit codec: Codec): String

    Content-Type of text according the implicit codec value.

    Content-Type of text according the implicit codec value.

    Definition Classes
    ContentTypes
  125. val TODO : Action[AnyContent]

    Provides an empty Action implementation: the result is a standard ‘Not implemented yet’ result page.

    Provides an empty Action implementation: the result is a standard ‘Not implemented yet’ result page.

    For example:

    def index(name:String) = TODO
    
  126. val TOO_MANY_REQUEST : Int

    Definition Classes
    Status
  127. val TRAILER : String

    Definition Classes
    HeaderNames
  128. val TRANSFER_ENCODING : String

    Definition Classes
    HeaderNames
  129. def TemporaryRedirect (url: String): SimpleResult[EmptyContent]

    Generates a ‘307 TEMPORARY_REDIRECT’ simple result.

    Generates a ‘307 TEMPORARY_REDIRECT’ simple result.

    url

    the URL to redirect to

    Definition Classes
    Results
  130. val TooManyRequest : Status

    Generates a ‘429 TOO_MANY_REQUEST’ result.

    Generates a ‘429 TOO_MANY_REQUEST’ result.

    Definition Classes
    Results
  131. val UNAUTHORIZED : Int

    Definition Classes
    Status
  132. val UNSUPPORTED_MEDIA_TYPE : Int

    Definition Classes
    Status
  133. val UPGRADE : String

    Definition Classes
    HeaderNames
  134. val USER_AGENT : String

    Definition Classes
    HeaderNames
  135. val USE_PROXY : Int

    Definition Classes
    Status
  136. val Unauthorized : Status

    Generates a ‘401 UNAUTHORIZED’ result.

    Generates a ‘401 UNAUTHORIZED’ result.

    Definition Classes
    Results
  137. val UnsupportedMediaType : Status

    Generates a ‘415 UNSUPPORTED_MEDIA_TYPE’ result.

    Generates a ‘415 UNSUPPORTED_MEDIA_TYPE’ result.

    Definition Classes
    Results
  138. val UriTooLong : Status

    Generates a ‘414 REQUEST_URI_TOO_LONG’ result.

    Generates a ‘414 REQUEST_URI_TOO_LONG’ result.

    Definition Classes
    Results
  139. val VARY : String

    Definition Classes
    HeaderNames
  140. val VIA : String

    Definition Classes
    HeaderNames
  141. val WARNING : String

    Definition Classes
    HeaderNames
  142. val WWW_AUTHENTICATE : String

    Definition Classes
    HeaderNames
  143. def XML (implicit codec: Codec): String

    Content-Type of xml according the implicit codec value.

    Content-Type of xml according the implicit codec value.

    Definition Classes
    ContentTypes
  144. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  145. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  146. def eq (arg0: AnyRef): Boolean

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

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

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  149. implicit def flash (implicit request: RequestHeader): Flash

    Retrieve the flash scope implicitly from the request.

    Retrieve the flash scope implicitly from the request.

    For example:

    def index(name:String) = Action { implicit request =>
      val message = flash("message")
      Ok("Got " + message)
    }
    
    Attributes
    implicit
  150. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef → Any
  151. def hashCode (): Int

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

    Attributes
    final
    Definition Classes
    Any
  153. implicit def lang (implicit request: RequestHeader): Lang

    Attributes
    implicit
  154. def ne (arg0: AnyRef): Boolean

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

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

    Attributes
    final
    Definition Classes
    AnyRef
  157. object parse extends AnyRef

    Default body parsers.

  158. implicit def session (implicit request: RequestHeader): Session

    Retrieves the session implicitly from the request.

    Retrieves the session implicitly from the request.

    For example:

    def index(name:String) = Action { implicit request =>
      val username = session("username")
      Ok("Hello " + username)
    }
    
    Attributes
    implicit
  159. def synchronized [T0] (arg0: ⇒ T0): T0

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

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

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

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

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from ContentTypes

Inherited from HeaderNames

Inherited from Status

Inherited from BodyParsers

Inherited from Results

Inherited from AnyRef

Inherited from Any