Android APIs
Added in API level 21
public interface

WebResourceRequest

android.webkit.WebResourceRequest

Class Overview

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.

Public Methods

public abstract String getMethod ()

Added in API level 21

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

Returns
  • the method associated with the request.

public abstract Map<StringString> getRequestHeaders ()

Added in API level 21

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

Returns
  • the headers associated with the request.

public abstract Uri getUrl ()

Added in API level 21

Gets the URL for which the resource request was made.

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

public abstract boolean hasGesture ()

Added in API level 21

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
  • whether a gesture was associated with the request.

public abstract boolean isForMainFrame ()

Added in API level 21

Gets whether the request was made for the main frame.

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