Built-in asset manager implementation for use with Elide applications.

Resolves and loads assets embedded in the application at build-time, based on binary-encoded protocol buffer messages which define the dependency structure and metadata of each embedded asset.



Server-side asset configuration.


Active asset index for this server run.


Active asset reader implementation for this server run.


Link copied to clipboard
object Companion


Link copied to clipboard
open override val logging: Logger

Logger which should be used to emit not-found warnings and other messages from the asset manager implementation which is live for the current server lifecycle.

Link copied to clipboard
open override val reader: AssetReader


Link copied to clipboard

Resolve an AssetPointer for the specified asset module ID; if none can be located within the current set of live server assets, return null.

Link copied to clipboard
open override fun linkForAsset(module: AssetModuleId, overrideType: AssetType?): String

Generate a relative link to serve the asset specified by the provided module ID; the link is built from the active configured asset prefix, plus the "asset tag," which is a variable-length cryptographic fingerprint of the asset's content.

Link copied to clipboard
open suspend override fun renderAssetAsync(request: HttpRequest<*>, asset: ServerAsset): Deferred<StreamedAssetResponse>

Responsible for converting a known-good asset held by the server into an efficient StreamedAssetResponse which serves the asset to the invoking client.

Link copied to clipboard
open fun resolve(request: HttpRequest<*>, moduleId: String? = null): ServerAsset?

Resolve the asset requested by the provided HTTP request; if the corresponding file cannot be found, return null, and otherwise, throw an error.

Link copied to clipboard
open suspend fun serveAsync(request: HttpRequest<*>, moduleId: String? = null): Deferred<StreamedAssetResponse>

Asynchronously produce an HTTP response which serves the asset described by the provided request; if the asset in question cannot be located, serve a 404 Not Found, and for any other error, serve a 500 Internal Server Error.

Link copied to clipboard
open fun serveNotFoundAsync(request: HttpRequest<*>): Deferred<StreamedAssetResponse>

Serve a response of status HTTP 404 (Not Found), in response to a request for an asset which could not be located by the built-in asset system.