Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

# WebResourceRequest

*** ** * ** ***

` public interface WebResourceRequest `   
` `

|---|
| android.webkit.WebResourceRequest |

<br />

*** ** * ** ***

Encompasses parameters to the `https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20android.webkit.WebResourceRequest)` method.

## Summary

| ### Public methods ||
|---|---|
| ` abstract https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/webkit/WebResourceRequest#getMethod()() ` Gets the method associated with the request, for example "GET". |
| ` abstract https://developer.android.com/reference/java/util/Map<https://developer.android.com/reference/java/lang/String, https://developer.android.com/reference/java/lang/String>` | ` https://developer.android.com/reference/android/webkit/WebResourceRequest#getRequestHeaders()() ` Gets the headers associated with the request. |
| ` abstract https://developer.android.com/reference/android/net/Uri` | ` https://developer.android.com/reference/android/webkit/WebResourceRequest#getUrl()() ` Gets the URL for which the resource request was made. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/webkit/WebResourceRequest#hasGesture()() ` Gets whether a gesture (such as a click) was associated with the request. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/webkit/WebResourceRequest#isForMainFrame()() ` Gets whether the request was made in order to fetch the main frame's document. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/webkit/WebResourceRequest#isRedirect()() ` Gets whether the request was a result of a server-side redirect. |

## Public methods

### getMethod

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract String getMethod ()
```

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

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the method associated with the request. <br /> |

### getRequestHeaders

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract Map<String, String> getRequestHeaders ()
```

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

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Map<https://developer.android.com/reference/java/lang/String, https://developer.android.com/reference/java/lang/String>` | the headers associated with the request. <br /> |

### getUrl

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract Uri getUrl ()
```

Gets the URL for which the resource request was made.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/Uri` | the URL for which the resource request was made. <br /> |

### hasGesture

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Returns ||
|---|---|
| `boolean` | whether a gesture was associated with the request. <br /> |

### isForMainFrame

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean isForMainFrame ()
```

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

<br />

| Returns ||
|---|---|
| `boolean` | whether the request was made for the main frame document. Will be `false` for subresources or iframes, for example. <br /> |

### isRedirect

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean isRedirect ()
```

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

<br />

| Returns ||
|---|---|
| `boolean` | whether the request was a result of a server-side redirect. <br /> |