Assets
The application's assets: the files it ships in its jar under assets/ and serves as they are, under /assets/, with a version in every address computed from the file's bytes.
The stylesheet the sbt plugin builds from tailwind.css is one, at assets/tailwind.css; a file written by hand under src/main/resources/assets is another, and both are served the same way. A layout links one through url, which spells the version in, so a browser may keep the file for a year and the next deploy, whose bytes differ, is a new address. The route is one of HttpApp.frameworkRoutes, appended after the application's table, so an application that mounts its own catch all under /assets keeps winning.
The version is per file rather than one digest over a list, so that no list has to be kept: a file the build writes and a file nobody told this object about get the same treatment. Each digest is computed once per process. A process's jar never changes, and under the dev loop every restart is a new process.
What is refused: a path that is not a plain descent into assets/ (an empty segment, . or ..), a file that is not there, and a file whose extension names no content type below. All three are the same 404 to the client, because none of them is the client's to tell apart.
Attributes
- Source
- Assets.scala
- Graph
-
- Supertypes
- Self type
-
Assets.type