AssetManifestLoader

Defines the API surface of a loader which is capable of searching for an asset manifest at server startup, and then de-serializing the manifest, so it can be indexed and then made available via an AssetManager implementation.

The manifest loader is responsible only for two things:

  1. Locating the manifest on the classpath, if it exists, from a given or default set of candidate locations.

  2. De-serializing the manifest from some known format, and producing the result as an AssetBundle.

At server startup, the default set of manifest locations (assetManifestCandidates) is searched unless otherwise specified by the developer.

Implementation

Typically, this interface is implemented by ServerAssetManifestProvider. The developer may replace this default implementation using the @Replaces annotation from Micronaut. For example:

@Replaces(ServerAssetManifestProvider::class)
class MyAssetManifestProvider : AssetManifestLoader {
// implementation here
}

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open fun findLoadManifest(): AssetBundle?

Find and load an asset manifest embedded within the scope of the current application; search in the default path locations, and if no manifest is found, or no manifest could safely be decoded, return null.

abstract fun findLoadManifest(candidates: List<Pair<ManifestFormat, String>>): AssetBundle?

Find and load an asset manifest embedded within the scope of the current application, using the provided set of candidates as locations in the classpath to search.

Link copied to clipboard
open fun findManifest(): Pair<ManifestFormat, InputStream>?

Find an asset manifest embedded within the scope of the current application; search in the default path locations, and if no manifest is found, return null; otherwise, return the expected format of the found manifest, and an input stream to consume it.

abstract fun findManifest(candidates: List<Pair<ManifestFormat, String>>): Pair<ManifestFormat, InputStream>?

Find an asset manifest present as a resource in the application classpath from the set of provided candidates, each of which represents a potential path and ManifestFormat.