Added in API level 21

WebResourceRequest


public interface WebResourceRequest

android.webkit.WebResourceRequest


Encompasses parameters to the WebViewClient#shouldInterceptRequest method.

Summary

Public methods

abstract String getMethod()

Gets the method associated with the request, for example "GET".

abstract Map<StringString> getRequestHeaders()

Gets the headers associated with the request.

abstract Uri getUrl()

Gets the URL for which the resource request was made.

abstract boolean hasGesture()

Gets whether a gesture (such as a click) was associated with the request.

abstract boolean isForMainFrame()

Gets whether the request was made in order to fetch the main frame's document.

abstract boolean isRedirect()

Gets whether the request was a result of a server-side redirect.

Public methods

getMethod

Added in API level 21
public abstract String getMethod ()

Gets the method associated with the request, for example "GET".

Returns
String the method associated with the request.

getRequestHeaders

Added in API level 21
public abstract Map<StringString> getRequestHeaders ()

Gets the headers associated with the request. These are represented as a mapping of header name to header value.

Returns
Map<StringString> the headers associated with the request.

getUrl

Added in API level 21
public abstract Uri getUrl ()

Gets the URL for which the resource request was made.

Returns
Uri the URL for which the resource request was made.

hasGesture

Added in API level 21
public abstract boolean hasGesture ()

Gets whether a gesture (such as a click) was associated with the request. For security reasons in certain situations this method may return false even though the sequence of events which caused the request to be created was initiated by a user gesture.

Returns
boolean whether a gesture was associated with the request.

isForMainFrame

Added in API level 21
public abstract boolean isForMainFrame ()

Gets whether the request was made in order to fetch the main frame's document.

Returns
boolean whether the request was made for the main frame document. Will be false for subresources or iframes, for example.

isRedirect

Added in API level 24
public abstract boolean isRedirect ()

Gets whether the request was a result of a server-side redirect.

Returns
boolean whether the request was a result of a server-side redirect.