Class CefriumPathContentServer
java.lang.Object
com.cefrium.CefriumPathContentServer
- All Implemented Interfaces:
CefriumContentServer
Sends each request to the server registered for the longest prefix of its
path, with the prefix removed: under
/assets/,
/assets/img/a.png reaches that server as /img/a.png. The
counterpart of WebViewAssetLoader.Builder.addPathHandler:
// WebView
WebViewAssetLoader loader = new WebViewAssetLoader.Builder()
.addPathHandler("/assets/", new AssetsPathHandler(context))
.addPathHandler("/res/", new ResourcesPathHandler(context))
.build();
// Cefrium
CefriumProfile.getDefault().registerContentServer(
CefriumContentServers.WEBVIEW_ASSET_LOADER_ORIGIN,
new CefriumPathContentServer.Builder()
.addPath("/assets/", CefriumContentServers.assets(context, ""))
.addPath("/res/", CefriumContentServers.resources(context))
.build());
-
Method Details
-
serve
Description copied from interface:CefriumContentServerAnswers a request.- Specified by:
servein interfaceCefriumContentServer- Parameters:
request- The request, its path relative to the server.- Returns:
- The response, or
nullfor404 Not Found. - Throws:
IOException- If the content cannot be read; the page gets500 Internal Server Error.
-