AssetResolver

interface AssetResolver

Describes the expected API surface for a resolver of server-side assets, which, in cooperation with an AssetReader and under the management of an AssetManager, is responsible for checking asset paths for existence and translating them to absolute paths which may be read and served.

Asset tags

"Asset tags" are short strings which are computed at build time from a cryptographic hash of the asset's contents. Tags can be used to serve an asset from the asset controller, using URLs like /_/asset/{tag}.{ext}, where {tag} is the asset tag and {ext} is the asset's file extension (prefix adjustable by user).

Developers reference assets by their module ID, which is a short recognizable string assigned by the developer to a given asset.

See also

which is charged with efficiently reading asset content.

which coordinates between the AssetReader and AssetResolver.

for the generic return value model leveraged by AssetManager.

for the symbolic asset reference model leveraged by AssetManager.

Inheritors

Functions

Link copied to clipboard
abstract fun findByModuleId(moduleId: AssetModuleId): ServerAsset?

Return the asset module corresponding to the provided moduleId, if possible, or return null to indicate that the asset could not be located.

Link copied to clipboard
open fun resolve(request: HttpRequest<*>): ServerAsset?

Resolve the provided HTTP request to an asset path string, and then resolve the asset path string to a loaded ServerAsset, if possible; return null if the asset cannot be located.

abstract fun resolve(path: String): ServerAsset?

Resolve the provided path to a server asset, if possible, or return null to indicate that the asset could not be located; the given path value can be prefixed with the asset serving prefix (/_/asset by default) or not prefixed at all.