WebViewAssetLoader.Builder

public static final class WebViewAssetLoader.Builder
extends Object

java.lang.Object
   ↳ androidx.webkit.WebViewAssetLoader.Builder


A builder class for constructing WebViewAssetLoader objects.

Summary

Public constructors

WebViewAssetLoader.Builder()

Public methods

WebViewAssetLoader.Builder addPathHandler(String path, WebViewAssetLoader.PathHandler handler)

Register a WebViewAssetLoader.PathHandler for a specific path.

WebViewAssetLoader build()

Build and return a WebViewAssetLoader object.

WebViewAssetLoader.Builder setDomain(String domain)

Set the domain under which app assets can be accessed.

WebViewAssetLoader.Builder setHttpAllowed(boolean httpAllowed)

Allow using the HTTP scheme in addition to HTTPS.

Inherited methods

Public constructors

WebViewAssetLoader.Builder

public WebViewAssetLoader.Builder ()

Public methods

addPathHandler

public WebViewAssetLoader.Builder addPathHandler (String path, 
                WebViewAssetLoader.PathHandler handler)

Register a WebViewAssetLoader.PathHandler for a specific path.

The path should start and end with a "/" and it shouldn't collide with a real web path.

Parameters
path String: the prefix path where this handler should be register.

handler WebViewAssetLoader.PathHandler: WebViewAssetLoader.PathHandler that handles requests for this path.

Returns
WebViewAssetLoader.Builder WebViewAssetLoader.Builder object.

Throws
IllegalArgumentException if the path is invalid.

build

public WebViewAssetLoader build ()

Build and return a WebViewAssetLoader object.

Returns
WebViewAssetLoader immutable WebViewAssetLoader object.

setDomain

public WebViewAssetLoader.Builder setDomain (String domain)

Set the domain under which app assets can be accessed. The default domain is "appassets.androidplatform.net"

Parameters
domain String: the domain on which app assets should be hosted.

Returns
WebViewAssetLoader.Builder WebViewAssetLoader.Builder object.

setHttpAllowed

public WebViewAssetLoader.Builder setHttpAllowed (boolean httpAllowed)

Allow using the HTTP scheme in addition to HTTPS. The default is to not allow HTTP.

Parameters
httpAllowed boolean

Returns
WebViewAssetLoader.Builder WebViewAssetLoader.Builder object.