controllers

Default

object Default extends Controller

Default actions ready to use as is from your routes file.

Example:

GET   /google          controllers.Default.redirect(to = "http://www.google.com")
GET   /favicon.ico     controllers.Default.notFound
GET   /admin           controllers.Default.todo
GET   /xxx             controllers.Default.error
Source
Default.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Default
  2. Controller
  3. Rendering
  4. RequestExtractors
  5. AcceptExtractors
  6. ContentTypes
  7. HeaderNames
  8. Status
  9. BodyParsers
  10. Results
  11. AnyRef
  12. Any
  1. Hide All
  2. Show all
Learn more about member selection
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. final def !=(arg0: AnyRef): Boolean

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

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

    Definition Classes
    AnyRef → Any
  4. object &

    Convenient extractor allowing to apply two extractors.

  5. final def ==(arg0: AnyRef): Boolean

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

    Definition Classes
    Any
  7. val ACCEPT: String

    Definition Classes
    HeaderNames
  8. val ACCEPTED: Int

    Definition Classes
    Status
  9. val ACCEPT_CHARSET: String

    Definition Classes
    HeaderNames
  10. val ACCEPT_ENCODING: String

    Definition Classes
    HeaderNames
  11. val ACCEPT_LANGUAGE: String

    Definition Classes
    HeaderNames
  12. val ACCEPT_RANGES: String

    Definition Classes
    HeaderNames
  13. val ACCESS_CONTROL_ALLOW_CREDENTIALS: String

    Definition Classes
    HeaderNames
  14. val ACCESS_CONTROL_ALLOW_HEADERS: String

    Definition Classes
    HeaderNames
  15. val ACCESS_CONTROL_ALLOW_METHODS: String

    Definition Classes
    HeaderNames
  16. val ACCESS_CONTROL_ALLOW_ORIGIN: String

    Definition Classes
    HeaderNames
  17. val ACCESS_CONTROL_EXPOSE_HEADERS: String

    Definition Classes
    HeaderNames
  18. val ACCESS_CONTROL_MAX_AGE: String

    Definition Classes
    HeaderNames
  19. val ACCESS_CONTROL_REQUEST_HEADERS: String

    Definition Classes
    HeaderNames
  20. val ACCESS_CONTROL_REQUEST_METHOD: String

    Definition Classes
    HeaderNames
  21. val AGE: String

    Definition Classes
    HeaderNames
  22. val ALLOW: String

    Definition Classes
    HeaderNames
  23. val AUTHORIZATION: String

    Definition Classes
    HeaderNames
  24. val Accepted: Status

    Generates a ‘202 ACCEPTED’ result.

    Generates a ‘202 ACCEPTED’ result.

    Definition Classes
    Results
  25. object Accepts

    Common extractors to check if a request accepts JSON, Html, etc.

  26. def Async(promise: Future[Result]): AsyncResult

    Definition Classes
    Results
  27. val BAD_GATEWAY: Int

    Definition Classes
    Status
  28. val BAD_REQUEST: Int

    Definition Classes
    Status
  29. val BINARY: String

    Content-Type of binary data.

    Content-Type of binary data.

    Definition Classes
    ContentTypes
  30. val BadGateway: Status

    Generates a ‘502 BAD_GATEWAY’ result.

    Generates a ‘502 BAD_GATEWAY’ result.

    Definition Classes
    Results
  31. val BadRequest: Status

    Generates a ‘400 BAD_REQUEST’ result.

    Generates a ‘400 BAD_REQUEST’ result.

    Definition Classes
    Results
  32. val CACHE_CONTROL: String

    Definition Classes
    HeaderNames
  33. val CONFLICT: Int

    Definition Classes
    Status
  34. val CONNECTION: String

    Definition Classes
    HeaderNames
  35. val CONTENT_DISPOSITION: String

    Definition Classes
    HeaderNames
  36. val CONTENT_ENCODING: String

    Definition Classes
    HeaderNames
  37. val CONTENT_LANGUAGE: String

    Definition Classes
    HeaderNames
  38. val CONTENT_LENGTH: String

    Definition Classes
    HeaderNames
  39. val CONTENT_LOCATION: String

    Definition Classes
    HeaderNames
  40. val CONTENT_MD5: String

    Definition Classes
    HeaderNames
  41. val CONTENT_RANGE: String

    Definition Classes
    HeaderNames
  42. val CONTENT_TRANSFER_ENCODING: String

    Definition Classes
    HeaderNames
  43. val CONTENT_TYPE: String

    Definition Classes
    HeaderNames
  44. val CONTINUE: Int

    Definition Classes
    Status
  45. val COOKIE: String

    Definition Classes
    HeaderNames
  46. val CREATED: Int

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

    Content-Type of css.

    Content-Type of css.

    Definition Classes
    ContentTypes
  48. val Conflict: Status

    Generates a ‘409 CONFLICT’ result.

    Generates a ‘409 CONFLICT’ result.

    Definition Classes
    Results
  49. val Created: Status

    Generates a ‘201 CREATED’ result.

    Generates a ‘201 CREATED’ result.

    Definition Classes
    Results
  50. val DATE: String

    Definition Classes
    HeaderNames
  51. val ETAG: String

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

    Content-Type of server sent events.

    Content-Type of server sent events.

    Definition Classes
    ContentTypes
  53. val EXPECT: String

    Definition Classes
    HeaderNames
  54. val EXPECTATION_FAILED: Int

    Definition Classes
    Status
  55. val EXPIRES: String

    Definition Classes
    HeaderNames
  56. val EntityTooLarge: Status

    Generates a ‘413 REQUEST_ENTITY_TOO_LARGE’ result.

    Generates a ‘413 REQUEST_ENTITY_TOO_LARGE’ result.

    Definition Classes
    Results
  57. val ExpectationFailed: Status

    Generates a ‘417 EXPECTATION_FAILED’ result.

    Generates a ‘417 EXPECTATION_FAILED’ result.

    Definition Classes
    Results
  58. val FAILED_DEPENDENCY: Int

    Definition Classes
    Status
  59. val FORBIDDEN: Int

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

    Content-Type of form-urlencoded.

    Content-Type of form-urlencoded.

    Definition Classes
    ContentTypes
  61. val FOUND: Int

    Definition Classes
    Status
  62. val FROM: String

    Definition Classes
    HeaderNames
  63. val FailedDependency: Status

    Generates a ‘424 FAILED_DEPENDENCY’ result.

    Generates a ‘424 FAILED_DEPENDENCY’ result.

    Definition Classes
    Results
  64. val Forbidden: Status

    Generates a ‘403 FORBIDDEN’ result.

    Generates a ‘403 FORBIDDEN’ result.

    Definition Classes
    Results
  65. 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
  66. val GATEWAY_TIMEOUT: Int

    Definition Classes
    Status
  67. val GONE: Int

    Definition Classes
    Status
  68. val GatewayTimeout: Status

    Generates a ‘504 GATEWAY_TIMEOUT’ result.

    Generates a ‘504 GATEWAY_TIMEOUT’ result.

    Definition Classes
    Results
  69. val Gone: Status

    Generates a ‘410 GONE’ result.

    Generates a ‘410 GONE’ result.

    Definition Classes
    Results
  70. val HOST: String

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

    Content-Type of html.

    Content-Type of html.

    Definition Classes
    ContentTypes
  72. val HTTP_VERSION_NOT_SUPPORTED: Int

    Definition Classes
    Status
  73. val HttpVersionNotSupported: Status

    Generates a ‘505 HTTP_VERSION_NOT_SUPPORTED’ result.

    Generates a ‘505 HTTP_VERSION_NOT_SUPPORTED’ result.

    Definition Classes
    Results
  74. val IF_MATCH: String

    Definition Classes
    HeaderNames
  75. val IF_MODIFIED_SINCE: String

    Definition Classes
    HeaderNames
  76. val IF_NONE_MATCH: String

    Definition Classes
    HeaderNames
  77. val IF_RANGE: String

    Definition Classes
    HeaderNames
  78. val IF_UNMODIFIED_SINCE: String

    Definition Classes
    HeaderNames
  79. val INSUFFICIENT_STORAGE: Int

    Definition Classes
    Status
  80. val INTERNAL_SERVER_ERROR: Int

    Definition Classes
    Status
  81. val InsufficientStorage: Status

    Generates a ‘507 INSUFFICIENT_STORAGE’ result.

    Generates a ‘507 INSUFFICIENT_STORAGE’ result.

    Definition Classes
    Results
  82. val InternalServerError: Status

    Generates a ‘500 INTERNAL_SERVER_ERROR’ result.

    Generates a ‘500 INTERNAL_SERVER_ERROR’ result.

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

    Content-Type of javascript.

    Content-Type of javascript.

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

    Content-Type of json.

    Content-Type of json.

    Definition Classes
    ContentTypes
  85. val LAST_MODIFIED: String

    Definition Classes
    HeaderNames
  86. val LENGTH_REQUIRED: Int

    Definition Classes
    Status
  87. val LOCATION: String

    Definition Classes
    HeaderNames
  88. val LOCKED: Int

    Definition Classes
    Status
  89. val Locked: Status

    Generates a ‘423 LOCKED’ result.

    Generates a ‘423 LOCKED’ result.

    Definition Classes
    Results
  90. val MAX_FORWARDS: String

    Definition Classes
    HeaderNames
  91. val METHOD_NOT_ALLOWED: Int

    Definition Classes
    Status
  92. val MOVED_PERMANENTLY: Int

    Definition Classes
    Status
  93. val MULTIPLE_CHOICES: Int

    Definition Classes
    Status
  94. val MULTI_STATUS: Int

    Definition Classes
    Status
  95. val MethodNotAllowed: Status

    Generates a ‘405 METHOD_NOT_ALLOWED’ result.

    Generates a ‘405 METHOD_NOT_ALLOWED’ result.

    Definition Classes
    Results
  96. 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
  97. val MultiStatus: Status

    Generates a ‘207 MULTI_STATUS’ result.

    Generates a ‘207 MULTI_STATUS’ result.

    Definition Classes
    Results
  98. val NON_AUTHORITATIVE_INFORMATION: Int

    Definition Classes
    Status
  99. val NOT_ACCEPTABLE: Int

    Definition Classes
    Status
  100. val NOT_FOUND: Int

    Definition Classes
    Status
  101. val NOT_IMPLEMENTED: Int

    Definition Classes
    Status
  102. val NOT_MODIFIED: Int

    Definition Classes
    Status
  103. val NO_CONTENT: Int

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

    Generates a ‘204 NO_CONTENT’ result.

    Generates a ‘204 NO_CONTENT’ result.

    Definition Classes
    Results
  105. val NonAuthoritativeInformation: Status

    Generates a ‘203 NON_AUTHORITATIVE_INFORMATION’ result.

    Generates a ‘203 NON_AUTHORITATIVE_INFORMATION’ result.

    Definition Classes
    Results
  106. val NotAcceptable: Status

    Generates a ‘406 NOT_ACCEPTABLE’ result.

    Generates a ‘406 NOT_ACCEPTABLE’ result.

    Definition Classes
    Results
  107. val NotFound: Status

    Generates a ‘404 NOT_FOUND’ result.

    Generates a ‘404 NOT_FOUND’ result.

    Definition Classes
    Results
  108. val NotImplemented: Status

    Generates a ‘501 NOT_IMPLEMENTED’ result.

    Generates a ‘501 NOT_IMPLEMENTED’ result.

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

    Generates a ‘304 NOT_MODIFIED’ result.

    Generates a ‘304 NOT_MODIFIED’ result.

    Definition Classes
    Results
  110. val OK: Int

    Definition Classes
    Status
  111. val ORIGIN: String

    Definition Classes
    HeaderNames
  112. val Ok: Status

    Generates a ‘200 OK’ result.

    Generates a ‘200 OK’ result.

    Definition Classes
    Results
  113. val PARTIAL_CONTENT: Int

    Definition Classes
    Status
  114. val PAYMENT_REQUIRED: Int

    Definition Classes
    Status
  115. val PRAGMA: String

    Definition Classes
    HeaderNames
  116. val PRECONDITION_FAILED: Int

    Definition Classes
    Status
  117. val PROXY_AUTHENTICATE: String

    Definition Classes
    HeaderNames
  118. val PROXY_AUTHENTICATION_REQUIRED: Int

    Definition Classes
    Status
  119. val PROXY_AUTHORIZATION: String

    Definition Classes
    HeaderNames
  120. val PartialContent: Status

    Generates a ‘206 PARTIAL_CONTENT’ result.

    Generates a ‘206 PARTIAL_CONTENT’ result.

    Definition Classes
    Results
  121. val PreconditionFailed: Status

    Generates a ‘412 PRECONDITION_FAILED’ result.

    Generates a ‘412 PRECONDITION_FAILED’ result.

    Definition Classes
    Results
  122. val RANGE: String

    Definition Classes
    HeaderNames
  123. val REFERER: String

    Definition Classes
    HeaderNames
  124. val REQUESTED_RANGE_NOT_SATISFIABLE: Int

    Definition Classes
    Status
  125. val REQUEST_ENTITY_TOO_LARGE: Int

    Definition Classes
    Status
  126. val REQUEST_TIMEOUT: Int

    Definition Classes
    Status
  127. val REQUEST_URI_TOO_LONG: Int

    Definition Classes
    Status
  128. val RESET_CONTENT: Int

    Definition Classes
    Status
  129. val RETRY_AFTER: String

    Definition Classes
    HeaderNames
  130. 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
  131. 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
  132. 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
  133. val RequestTimeout: Status

    Generates a ‘408 REQUEST_TIMEOUT’ result.

    Generates a ‘408 REQUEST_TIMEOUT’ result.

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

    Generates a ‘205 RESET_CONTENT’ result.

    Generates a ‘205 RESET_CONTENT’ result.

    Definition Classes
    Results
  135. val SEE_OTHER: Int

    Definition Classes
    Status
  136. val SERVER: String

    Definition Classes
    HeaderNames
  137. val SERVICE_UNAVAILABLE: Int

    Definition Classes
    Status
  138. val SET_COOKIE: String

    Definition Classes
    HeaderNames
  139. val SET_COOKIE2: String

    Definition Classes
    HeaderNames
  140. val SWITCHING_PROTOCOLS: Int

    Definition Classes
    Status
  141. 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
  142. val ServiceUnavailable: Status

    Generates a ‘503 SERVICE_UNAVAILABLE’ result.

    Generates a ‘503 SERVICE_UNAVAILABLE’ result.

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

    Generates a simple result.

    Generates a simple result.

    code

    the status code

    Definition Classes
    Results
  144. val TE: String

    Definition Classes
    HeaderNames
  145. val TEMPORARY_REDIRECT: Int

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

    Content-Type of text.

    Content-Type of text.

    Definition Classes
    ContentTypes
  147. 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
    Definition Classes
    Controller
  148. val TOO_MANY_REQUEST: Int

    Definition Classes
    Status
  149. val TRAILER: String

    Definition Classes
    HeaderNames
  150. val TRANSFER_ENCODING: String

    Definition Classes
    HeaderNames
  151. 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
  152. val TooManyRequest: Status

    Generates a ‘429 TOO_MANY_REQUEST’ result.

    Generates a ‘429 TOO_MANY_REQUEST’ result.

    Definition Classes
    Results
  153. val UNAUTHORIZED: Int

    Definition Classes
    Status
  154. val UNPROCESSABLE_ENTITY: Int

    Definition Classes
    Status
  155. val UNSUPPORTED_MEDIA_TYPE: Int

    Definition Classes
    Status
  156. val UPGRADE: String

    Definition Classes
    HeaderNames
  157. val USER_AGENT: String

    Definition Classes
    HeaderNames
  158. val USE_PROXY: Int

    Definition Classes
    Status
  159. val Unauthorized: Status

    Generates a ‘401 UNAUTHORIZED’ result.

    Generates a ‘401 UNAUTHORIZED’ result.

    Definition Classes
    Results
  160. val UnprocessableEntity: Status

    Generates a ‘422 UNPROCESSABLE_ENTITY’ result.

    Generates a ‘422 UNPROCESSABLE_ENTITY’ result.

    Definition Classes
    Results
  161. val UnsupportedMediaType: Status

    Generates a ‘415 UNSUPPORTED_MEDIA_TYPE’ result.

    Generates a ‘415 UNSUPPORTED_MEDIA_TYPE’ result.

    Definition Classes
    Results
  162. val UriTooLong: Status

    Generates a ‘414 REQUEST_URI_TOO_LONG’ result.

    Generates a ‘414 REQUEST_URI_TOO_LONG’ result.

    Definition Classes
    Results
  163. val VARY: String

    Definition Classes
    HeaderNames
  164. val VIA: String

    Definition Classes
    HeaderNames
  165. val WARNING: String

    Definition Classes
    HeaderNames
  166. val WWW_AUTHENTICATE: String

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

    Content-Type of xml.

    Content-Type of xml.

    Definition Classes
    ContentTypes
  168. val X_FORWARDED_FOR: String

    Definition Classes
    HeaderNames
  169. val X_FORWARDED_HOST: String

    Definition Classes
    HeaderNames
  170. val X_FORWARDED_PORT: String

    Definition Classes
    HeaderNames
  171. val X_FORWARDED_PROTO: String

    Definition Classes
    HeaderNames
  172. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  173. def clone(): AnyRef

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

    Definition Classes
    AnyRef
  175. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  176. def error: Action[AnyContent]

    Returns a 500 InternalServerError response.

    Returns a 500 InternalServerError response.

    Example:

    GET   /xxx             controllers.Default.error
  177. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  178. 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)
    }
    Definition Classes
    Controller
  179. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  180. def hashCode(): Int

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

    Definition Classes
    Any
  182. implicit def lang(implicit request: RequestHeader): Lang

    Definition Classes
    Controller
  183. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  184. def notFound: Action[AnyContent]

    Returns a 404 NotFound response.

    Returns a 404 NotFound response.

    Example:

    GET   /favicon.ico     controllers.Default.notFound
  185. final def notify(): Unit

    Definition Classes
    AnyRef
  186. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  187. object parse

    Default body parsers.

  188. def redirect(to: String): Action[AnyContent]

    Returns a 302 Redirect response.

    Returns a 302 Redirect response.

    Example:

    GET   /google          controllers.Default.redirect(to = "http://www.google.com")
  189. def render(f: PartialFunction[MediaRange, Result])(implicit request: RequestHeader): Result

    Tries to render the most acceptable result according to the request’s Accept header value.

    Tries to render the most acceptable result according to the request’s Accept header value.

    render {
    case Accepts.Html() => Ok(views.html.show(value))
    case Accepts.Json() => Ok(Json.toJson(value))
    }
    f

    A partial function returning a Result for a given request media range

    returns

    A result provided by f, if it is defined for the current request media ranges, otherwise NotAcceptable

    Definition Classes
    Rendering
  190. 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)
    }
    Definition Classes
    Controller
  191. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  192. def toString(): String

    Definition Classes
    AnyRef → Any
  193. def todo: Action[AnyContent]

    Returns a 501 NotImplemented response.

    Returns a 501 NotImplemented response.

    Example:

    GET   /admin           controllers.Default.todo
  194. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws()
  197. def withCharset(mimeType: String)(implicit codec: Codec): String

    returns

    the codec charset appended to mimeType

    Definition Classes
    ContentTypes

Inherited from Controller

Inherited from Rendering

Inherited from RequestExtractors

Inherited from AcceptExtractors

Inherited from ContentTypes

Inherited from HeaderNames

Inherited from play.api.http.Status

Inherited from BodyParsers

Inherited from Results

Inherited from AnyRef

Inherited from Any

Ungrouped