com.alecdorrington.assetloader

Members list

Type members

Classlikes

class AssetLoader

A utility for loading and caching static assets so that they can be served by a web server.

A utility for loading and caching static assets so that they can be served by a web server.

Only intended for use when the total number of assets is small enough to fit comfortably in memory.

Warning: Work with the assumption that all files in assetPath will be made publicly accessible.

Value parameters

assetPath

The root directory on the server's file system where assets are stored, relative to the directory of the running server process.

maxAge

The maximum age (in seconds) for which an asset should be considered fresh for caching purposes. Caching is disabled by default (0).

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object AssetLoader

Attributes

See also
Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
object MIME

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
MIME.type

Types

type Asset = (content: Array[Byte], contentType: String, eTag: String, cacheControl: String)

A static asset that can be served by a web server.

A static asset that can be served by a web server.

Value parameters

cacheControl

The caching rules for the asset. Appears in the Cache-Control header. Tells the browser when a cached asset needs to be replaced.

content

The raw bytes from the asset file.

contentType

The MIME type of the asset. Appears in the Content-Type header. Helps the browser understand how to handle the file.

eTag

The version hash of the asset. Appears in the ETag header. Helps the browser determine when a cached asset is up-to-date.

Attributes