Skip to content

Most visited

Recently visited

navigation
added in API level 21

WebResourceRequest

public interface WebResourceRequest

android.webkit.WebResourceRequest


Encompasses parameters to the shouldInterceptRequest(WebView, WebResourceRequest) 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 for the main frame.

abstract boolean isRedirect()

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

Public methods

getMethod

added in API level 21
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
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
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
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
boolean isForMainFrame ()

Gets whether the request was made for the main frame.

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

isRedirect

added in API level 24
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.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.