controllers

Assets

object Assets extends Controller

Controller that serves static resources.

Resources are searched in the classpath.

It handles Last-Modified and ETag header automatically. If a gzipped version of a resource is found (Same resource name with the .gz suffix), it is served instead.

You can set a custom Cache directive for a particular resource if needed. For example in your application.conf file:

"assets.cache./public/images/logo.png" = "max-age=3600"

You can use this controller in any application, just by declaring the appropriate route. For example:

GET     /assets/*file               controllers.Assets.at(path="/public", file)
Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. Assets
  2. Controller
  3. RequestExtractors
  4. AcceptExtractors
  5. ContentTypes
  6. HeaderNames
  7. Status
  8. BodyParsers
  9. Results
  10. AnyRef
  11. 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. object & extends AnyRef

    Convenient extractor allowing to apply two extractors.

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

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

    Attributes
    final
    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 AGE : String

    Definition Classes
    HeaderNames
  14. val ALLOW : String

    Definition Classes
    HeaderNames
  15. val AUTHORIZATION : String

    Definition Classes
    HeaderNames
  16. val Accepted : Status

    Generates a ‘202 ACCEPTED’ result.

    Generates a ‘202 ACCEPTED’ result.

    Definition Classes
    Results
  17. object Accepts extends AnyRef

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

  18. def Async (promise: Promise[Result]): AsyncResult

    Definition Classes
    Results
  19. val BAD_GATEWAY : Int

    Definition Classes
    Status
  20. val BAD_REQUEST : Int

    Definition Classes
    Status
  21. val BINARY : String

    Content-Type of binary data.

    Content-Type of binary data.

    Definition Classes
    ContentTypes
  22. val BadRequest : Status

    Generates a ‘400 BAD_REQUEST’ result.

    Generates a ‘400 BAD_REQUEST’ result.

    Definition Classes
    Results
  23. val CACHE_CONTROL : String

    Definition Classes
    HeaderNames
  24. val CONFLICT : Int

    Definition Classes
    Status
  25. val CONNECTION : String

    Definition Classes
    HeaderNames
  26. val CONTENT_DISPOSITION : String

    Definition Classes
    HeaderNames
  27. val CONTENT_ENCODING : String

    Definition Classes
    HeaderNames
  28. val CONTENT_LANGUAGE : String

    Definition Classes
    HeaderNames
  29. val CONTENT_LENGTH : String

    Definition Classes
    HeaderNames
  30. val CONTENT_LOCATION : String

    Definition Classes
    HeaderNames
  31. val CONTENT_MD5 : String

    Definition Classes
    HeaderNames
  32. val CONTENT_RANGE : String

    Definition Classes
    HeaderNames
  33. val CONTENT_TRANSFER_ENCODING : String

    Definition Classes
    HeaderNames
  34. val CONTENT_TYPE : String

    Definition Classes
    HeaderNames
  35. val CONTINUE : Int

    Definition Classes
    Status
  36. val COOKIE : String

    Definition Classes
    HeaderNames
  37. val CREATED : Int

    Definition Classes
    Status
  38. 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
  39. val Conflict : Status

    Generates a ‘409 CONFLICT’ result.

    Generates a ‘409 CONFLICT’ result.

    Definition Classes
    Results
  40. val Created : Status

    Generates a ‘201 CREATED’ result.

    Generates a ‘201 CREATED’ result.

    Definition Classes
    Results
  41. val DATE : String

    Definition Classes
    HeaderNames
  42. val ETAG : String

    Definition Classes
    HeaderNames
  43. 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
  44. val EXPECT : String

    Definition Classes
    HeaderNames
  45. val EXPECTATION_FAILED : Int

    Definition Classes
    Status
  46. val EXPIRES : String

    Definition Classes
    HeaderNames
  47. val EntityTooLarge : Status

    Generates a ‘413 REQUEST_ENTITY_TOO_LARGE’ result.

    Generates a ‘413 REQUEST_ENTITY_TOO_LARGE’ result.

    Definition Classes
    Results
  48. val ExpectationFailed : Status

    Generates a ‘417 EXPECTATION_FAILED’ result.

    Generates a ‘417 EXPECTATION_FAILED’ result.

    Definition Classes
    Results
  49. val FORBIDDEN : Int

    Definition Classes
    Status
  50. 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
  51. val FOUND : Int

    Definition Classes
    Status
  52. val FROM : String

    Definition Classes
    HeaderNames
  53. val Forbidden : Status

    Generates a ‘403 FORBIDDEN’ result.

    Generates a ‘403 FORBIDDEN’ result.

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

    Definition Classes
    Status
  56. val GONE : Int

    Definition Classes
    Status
  57. val Gone : Status

    Generates a ‘410 GONE’ result.

    Generates a ‘410 GONE’ result.

    Definition Classes
    Results
  58. val HOST : String

    Definition Classes
    HeaderNames
  59. 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
  60. val HTTP_VERSION_NOT_SUPPORTED : Int

    Definition Classes
    Status
  61. val IF_MATCH : String

    Definition Classes
    HeaderNames
  62. val IF_MODIFIED_SINCE : String

    Definition Classes
    HeaderNames
  63. val IF_NONE_MATCH : String

    Definition Classes
    HeaderNames
  64. val IF_RANGE : String

    Definition Classes
    HeaderNames
  65. val IF_UNMODIFIED_SINCE : String

    Definition Classes
    HeaderNames
  66. val INTERNAL_SERVER_ERROR : Int

    Definition Classes
    Status
  67. val InternalServerError : Status

    Generates a ‘500 INTERNAL_SERVER_ERROR’ result.

    Generates a ‘500 INTERNAL_SERVER_ERROR’ result.

    Definition Classes
    Results
  68. 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
  69. 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
  70. val LAST_MODIFIED : String

    Definition Classes
    HeaderNames
  71. val LENGTH_REQUIRED : Int

    Definition Classes
    Status
  72. val LOCATION : String

    Definition Classes
    HeaderNames
  73. val MAX_FORWARDS : String

    Definition Classes
    HeaderNames
  74. val METHOD_NOT_ALLOWED : Int

    Definition Classes
    Status
  75. val MOVED_PERMANENTLY : Int

    Definition Classes
    Status
  76. val MULTIPLE_CHOICES : Int

    Definition Classes
    Status
  77. val MethodNotAllowed : Status

    Generates a ‘405 METHOD_NOT_ALLOWED’ result.

    Generates a ‘405 METHOD_NOT_ALLOWED’ result.

    Definition Classes
    Results
  78. 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
  79. val NON_AUTHORITATIVE_INFORMATION : Int

    Definition Classes
    Status
  80. val NOT_ACCEPTABLE : Int

    Definition Classes
    Status
  81. val NOT_FOUND : Int

    Definition Classes
    Status
  82. val NOT_IMPLEMENTED : Int

    Definition Classes
    Status
  83. val NOT_MODIFIED : Int

    Definition Classes
    Status
  84. val NO_CONTENT : Int

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

    Generates a ‘204 NO_CONTENT’ result.

    Generates a ‘204 NO_CONTENT’ result.

    Definition Classes
    Results
  86. val NonAuthoritativeInformation : Status

    Generates a ‘203 NON_AUTHORITATIVE_INFORMATION’ result.

    Generates a ‘203 NON_AUTHORITATIVE_INFORMATION’ result.

    Definition Classes
    Results
  87. val NotAcceptable : Status

    Generates a ‘406 NOT_ACCEPTABLE’ result.

    Generates a ‘406 NOT_ACCEPTABLE’ result.

    Definition Classes
    Results
  88. val NotFound : Status

    Generates a ‘404 NOT_FOUND’ result.

    Generates a ‘404 NOT_FOUND’ result.

    Definition Classes
    Results
  89. val NotImplemented : Status

    Generates a ‘501 NOT_IMPLEMENTED’ result.

    Generates a ‘501 NOT_IMPLEMENTED’ result.

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

    Generates a ‘304 NOT_MODIFIED’ result.

    Generates a ‘304 NOT_MODIFIED’ result.

    Definition Classes
    Results
  91. val OK : Int

    Definition Classes
    Status
  92. val Ok : Status

    Generates a ‘200 OK’ result.

    Generates a ‘200 OK’ result.

    Definition Classes
    Results
  93. val PARTIAL_CONTENT : Int

    Definition Classes
    Status
  94. val PAYMENT_REQUIRED : Int

    Definition Classes
    Status
  95. val PRAGMA : String

    Definition Classes
    HeaderNames
  96. val PRECONDITION_FAILED : Int

    Definition Classes
    Status
  97. val PROXY_AUTHENTICATE : String

    Definition Classes
    HeaderNames
  98. val PROXY_AUTHENTICATION_REQUIRED : Int

    Definition Classes
    Status
  99. val PROXY_AUTHORIZATION : String

    Definition Classes
    HeaderNames
  100. val PartialContent : Status

    Generates a ‘206 PARTIAL_CONTENT’ result.

    Generates a ‘206 PARTIAL_CONTENT’ result.

    Definition Classes
    Results
  101. val PreconditionFailed : Status

    Generates a ‘412 PRECONDITION_FAILED’ result.

    Generates a ‘412 PRECONDITION_FAILED’ result.

    Definition Classes
    Results
  102. val RANGE : String

    Definition Classes
    HeaderNames
  103. val REFERER : String

    Definition Classes
    HeaderNames
  104. val REQUESTED_RANGE_NOT_SATISFIABLE : Int

    Definition Classes
    Status
  105. val REQUEST_ENTITY_TOO_LARGE : Int

    Definition Classes
    Status
  106. val REQUEST_TIMEOUT : Int

    Definition Classes
    Status
  107. val REQUEST_URI_TOO_LONG : Int

    Definition Classes
    Status
  108. val RESET_CONTENT : Int

    Definition Classes
    Status
  109. val RETRY_AFTER : String

    Definition Classes
    HeaderNames
  110. 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
  111. 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
  112. 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
  113. val RequestTimeout : Status

    Generates a ‘408 REQUEST_TIMEOUT’ result.

    Generates a ‘408 REQUEST_TIMEOUT’ result.

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

    Generates a ‘205 RESET_CONTENT’ result.

    Generates a ‘205 RESET_CONTENT’ result.

    Definition Classes
    Results
  115. val SEE_OTHER : Int

    Definition Classes
    Status
  116. val SERVER : String

    Definition Classes
    HeaderNames
  117. val SERVICE_UNAVAILABLE : Int

    Definition Classes
    Status
  118. val SET_COOKIE : String

    Definition Classes
    HeaderNames
  119. val SET_COOKIE2 : String

    Definition Classes
    HeaderNames
  120. val SWITCHING_PROTOCOLS : Int

    Definition Classes
    Status
  121. 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
  122. val ServiceUnavailable : Status

    Generates a ‘503 SERVICE_UNAVAILABLE’ result.

    Generates a ‘503 SERVICE_UNAVAILABLE’ result.

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

    Generates a simple result.

    Generates a simple result.

    code

    the status code

    Definition Classes
    Results
  124. val TE : String

    Definition Classes
    HeaderNames
  125. val TEMPORARY_REDIRECT : Int

    Definition Classes
    Status
  126. 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
  127. 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
  128. val TOO_MANY_REQUEST : Int

    Definition Classes
    Status
  129. val TRAILER : String

    Definition Classes
    HeaderNames
  130. val TRANSFER_ENCODING : String

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

    Generates a ‘429 TOO_MANY_REQUEST’ result.

    Generates a ‘429 TOO_MANY_REQUEST’ result.

    Definition Classes
    Results
  133. val UNAUTHORIZED : Int

    Definition Classes
    Status
  134. val UNSUPPORTED_MEDIA_TYPE : Int

    Definition Classes
    Status
  135. val UPGRADE : String

    Definition Classes
    HeaderNames
  136. val USER_AGENT : String

    Definition Classes
    HeaderNames
  137. val USE_PROXY : Int

    Definition Classes
    Status
  138. val Unauthorized : Status

    Generates a ‘401 UNAUTHORIZED’ result.

    Generates a ‘401 UNAUTHORIZED’ result.

    Definition Classes
    Results
  139. val UnsupportedMediaType : Status

    Generates a ‘415 UNSUPPORTED_MEDIA_TYPE’ result.

    Generates a ‘415 UNSUPPORTED_MEDIA_TYPE’ result.

    Definition Classes
    Results
  140. val UriTooLong : Status

    Generates a ‘414 REQUEST_URI_TOO_LONG’ result.

    Generates a ‘414 REQUEST_URI_TOO_LONG’ result.

    Definition Classes
    Results
  141. val VARY : String

    Definition Classes
    HeaderNames
  142. val VIA : String

    Definition Classes
    HeaderNames
  143. val WARNING : String

    Definition Classes
    HeaderNames
  144. val WWW_AUTHENTICATE : String

    Definition Classes
    HeaderNames
  145. 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
  146. val X_FORWARDED_FOR : String

    Definition Classes
    HeaderNames
  147. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  148. def at (path: String, file: String): Action[AnyContent]

    Generates an Action that serves a static resource.

    Generates an Action that serves a static resource.

    path

    the root folder for searching the static resource files, such as "/public"

    file

    the file part extracted from the URL

  149. def clone (): AnyRef

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

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

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

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

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

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

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

    Attributes
    implicit
    Definition Classes
    Controller
  158. def ne (arg0: AnyRef): Boolean

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

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

    Attributes
    final
    Definition Classes
    AnyRef
  161. object parse extends AnyRef

    Default body parsers.

  162. 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
    Definition Classes
    Controller
  163. def synchronized [T0] (arg0: ⇒ T0): T0

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

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

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

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

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from Controller

Inherited from RequestExtractors

Inherited from AcceptExtractors

Inherited from ContentTypes

Inherited from HeaderNames

Inherited from Status

Inherited from BodyParsers

Inherited from Results

Inherited from AnyRef

Inherited from Any