Packages

  • package root
    Definition Classes
    root
  • package controllers
    Definition Classes
    root
  • object Assets extends AssetsBuilder

    Controller that serves static resources.

    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. If a digest file is available for a given asset then its contents are read and used to supply a digest value. This value will be used for serving up ETag values and for the purposes of reverse routing. For example given "a.js", if there is an "a.js.md5" file available then the latter contents will be used to determine the Etag value. The reverse router also uses the digest in order to translate any file to the form <digest>-<asset> for example "a.js" may be also found at "d41d8cd98f00b204e9800998ecf8427e-a.js". If there is no digest file found then digest values for ETags are formed by forming a sha1 digest of the last-modified time.

    The default digest algorithm to search for is "md5". You can override this quite easily. For example if the SHA-1 algorithm is preferred:

    "play.assets.digest.algorithm" = "sha1"

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

    "play.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)
    Definition Classes
    controllers
  • &
  • Accepts
  • Asset
  • Status
  • render

case class Asset(name: String) extends Product with Serializable

An asset.

name

The name of the asset.

Source
Assets.scala
Linear Supertypes
Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Asset
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Asset(name: String)

    name

    The name of the asset.

Value Members

  1. val name: String
  2. def productElementNames: Iterator[String]
    Definition Classes
    Product