Class CefriumContentServers
java.lang.Object
com.cefrium.CefriumContentServers
Ready-made
CefriumContentServers for the app's assets, files and
resources, and the MIME types they use. Combine them under path prefixes
with CefriumPathContentServer.
Each serves index.html for a path that ends in /, gives
404 for anything missing, and refuses a path that leaves its
directory (..).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe originandroidx.webkit.WebViewAssetLoaderuses by default. -
Method Summary
Modifier and TypeMethodDescriptionstatic CefriumContentServerServesassets/<directory>:/index.htmlisassets/<directory>/index.html.static CefriumContentServerServes a directory of files, e.g.static StringmimeTypeOf(String path) The MIME type for a file name or path, by its extension:application/octet-streamwhen unknown.static CefriumContentServerresources(android.content.Context context) Serves the app's resources as/<type>/<name>.<ext>: for example/raw/intro.mp4isR.raw.intro,/drawable/logo.pngR.drawable.logo.
-
Field Details
-
WEBVIEW_ASSET_LOADER_ORIGIN
The originandroidx.webkit.WebViewAssetLoaderuses by default. Register it to keep a migrating app's URLs, and so its pages' storage origin, unchanged in form; the data itself does not move from WebView.- See Also:
-
-
Method Details
-
assets
Servesassets/<directory>:/index.htmlisassets/<directory>/index.html. Pass""for the whole assets folder.Range requests need the length, which Android gives only for assets stored uncompressed: list the extensions in the app's
androidResources { noCompress += [...] }(media types are uncompressed by default). -
files
Serves a directory of files, e.g.context.getFilesDir()or a downloaded game:/a/b.pngis<directory>/a/b.png. -
resources
Serves the app's resources as/<type>/<name>.<ext>: for example/raw/intro.mp4isR.raw.intro,/drawable/logo.pngR.drawable.logo. The counterpart of WebViewAssetLoader'sResourcesPathHandler. -
mimeTypeOf
-