Builder
class Builder
kotlin.Any | |
↳ | androidx.webkit.WebViewAssetLoader.Builder |
A builder class for constructing WebViewAssetLoader
objects.
Summary
Public constructors | |
---|---|
<init>() |
Public methods | |
---|---|
WebViewAssetLoader.Builder |
addPathHandler(@NonNull path: String, @NonNull handler: WebViewAssetLoader.PathHandler) Register a |
WebViewAssetLoader |
build() Build and return a |
WebViewAssetLoader.Builder |
Set the domain under which app assets can be accessed. |
WebViewAssetLoader.Builder |
setHttpAllowed(httpAllowed: Boolean) Allow using the HTTP scheme in addition to HTTPS. |
Public constructors
<init>
Builder()
Public methods
addPathHandler
@NonNull fun addPathHandler(
@NonNull path: String,
@NonNull handler: WebViewAssetLoader.PathHandler
): WebViewAssetLoader.Builder
Register a 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: PathHandler that handles requests for this path. |
Return | |
---|---|
WebViewAssetLoader.Builder |
Builder object. |
Exceptions | |
---|---|
IllegalArgumentException |
if the path is invalid. |
build
@NonNull fun build(): WebViewAssetLoader
Build and return a WebViewAssetLoader
object.
Return | |
---|---|
WebViewAssetLoader |
immutable WebViewAssetLoader object. |
setDomain
@NonNull fun setDomain(@NonNull domain: String): WebViewAssetLoader.Builder
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. |
Return | |
---|---|
WebViewAssetLoader.Builder |
Builder object. |
setHttpAllowed
@NonNull fun setHttpAllowed(httpAllowed: Boolean): WebViewAssetLoader.Builder
Allow using the HTTP scheme in addition to HTTPS. The default is to not allow HTTP.
Return | |
---|---|
WebViewAssetLoader.Builder |
Builder object. |