PathHandler

interface PathHandler
androidx.webkit.WebViewAssetLoader.PathHandler

A handler that produces responses for a registered path.

Implement this interface to handle other use-cases according to your app's needs.

Methods of this handler will be invoked on a background thread and care must be taken to correctly synchronize access to any shared state.

On Android KitKat and above these methods may be called on more than one thread. This thread may be different than the thread on which the shouldInterceptRequest method was invoked. This means that on Android KitKat and above it is possible to block in this method without blocking other resources from loading. The number of threads used to parallelize loading is an internal implementation detail of the WebView and may change between updates which means that the amount of time spent blocking in this method should be kept to an absolute minimum.

Summary

Public methods

abstract WebResourceResponse?
handle(@NonNull path: String)

Handles the requested URL by returning the appropriate response.

Public methods

handle

@WorkerThread @Nullable abstract fun handle(@NonNull path: String): WebResourceResponse?

Handles the requested URL by returning the appropriate response.

Parameters
path String: the suffix path to be handled.
Return
WebResourceResponse?: WebResourceResponse for the requested path or null if it can't handle this path.