readAsync

abstract suspend fun readAsync(descriptor: ServerAsset, request: HttpRequest<*>): Deferred<RenderedAsset>

Given a resolved asset descriptor which should be known to exist, read the associated asset content, and return it as an async Deferred task which can be awaited, and then consumed.

If the asset underlying the provided asset descriptor is found not to exist, a FileNotFoundException is raised.

Return

Deferred task which resolves to a rendered asset which may be consumed, corresponding to descriptor.

Parameters

descriptor

Resolved asset descriptor, which is expected to exist.

request

HTTP request which is asking to be served this asset.

Throws

if the provided asset cannot be located.