Stay organized with collections
Save and categorize content based on your preferences.
WebResourceRequest
interface WebResourceRequest
Encompasses parameters to the android.webkit.WebViewClient#shouldInterceptRequest method.
Summary
Public methods |
abstract String! |
Gets the method associated with the request, for example "GET".
|
abstract MutableMap<String!, String!>! |
Gets the headers associated with the request.
|
abstract Uri! |
Gets the URL for which the resource request was made.
|
abstract Boolean |
Gets whether a gesture (such as a click) was associated with the request.
|
abstract Boolean |
Gets whether the request was made in order to fetch the main frame's document.
|
abstract Boolean |
Gets whether the request was a result of a server-side redirect.
|
Public methods
getMethod
abstract fun getMethod(): String!
Gets the method associated with the request, for example "GET".
Return |
String! |
the method associated with the request. |
abstract fun getRequestHeaders(): MutableMap<String!, String!>!
Gets the headers associated with the request. These are represented as a mapping of header name to header value.
getUrl
abstract fun getUrl(): Uri!
Gets the URL for which the resource request was made.
Return |
Uri! |
the URL for which the resource request was made. |
hasGesture
abstract fun hasGesture(): Boolean
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.
Return |
Boolean |
whether a gesture was associated with the request. |
isForMainFrame
abstract fun isForMainFrame(): Boolean
Gets whether the request was made in order to fetch the main frame's document.
Return |
Boolean |
whether the request was made for the main frame document. Will be false for subresources or iframes, for example. |
isRedirect
abstract fun isRedirect(): Boolean
Gets whether the request was a result of a server-side redirect.
Return |
Boolean |
whether the request was a result of a server-side redirect. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# WebResourceRequest\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nWebResourceRequest\n==================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/webkit/WebResourceRequest \"View this page in Java\") \n\n```\ninterface WebResourceRequest\n```\n\n|----------------------------------------|\n| [android.webkit.WebResourceRequest](#) |\n\nEncompasses parameters to the android.webkit.WebViewClient#shouldInterceptRequest method.\n\nSummary\n-------\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|\n| abstract [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getMethod](#getMethod())`()` Gets the method associated with the request, for example \"GET\". |\n| abstract [MutableMap](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-map/index.html)\\\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!, [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\\\u003e! | [getRequestHeaders](#getRequestHeaders())`()` Gets the headers associated with the request. |\n| abstract [Uri](../net/Uri.html#)! | [getUrl](#getUrl())`()` Gets the URL for which the resource request was made. |\n| abstract [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [hasGesture](#hasGesture())`()` Gets whether a gesture (such as a click) was associated with the request. |\n| abstract [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isForMainFrame](#isForMainFrame())`()` Gets whether the request was made in order to fetch the main frame's document. |\n| abstract [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isRedirect](#isRedirect())`()` Gets whether the request was a result of a server-side redirect. |\n\nPublic methods\n--------------\n\n### getMethod\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getMethod(): String!\n```\n\nGets the method associated with the request, for example \"GET\".\n\n| Return ||\n|-----------------------------------------------------------------------------------|-----------------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | the method associated with the request. |\n\n### getRequestHeaders\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getRequestHeaders(): MutableMap\u003cString!, String!\u003e!\n```\n\nGets the headers associated with the request. These are represented as a mapping of header name to header value.\n\n| Return ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------|\n| [MutableMap](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-map/index.html)\u003c[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!,` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\u003e! | the headers associated with the request. |\n\n### getUrl\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getUrl(): Uri!\n```\n\nGets the URL for which the resource request was made.\n\n| Return ||\n|--------------------------|--------------------------------------------------|\n| [Uri](../net/Uri.html#)! | the URL for which the resource request was made. |\n\n### hasGesture\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun hasGesture(): Boolean\n```\n\nGets 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.\n\n| Return ||\n|------------------------------------------------------------------------------------|----------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | whether a gesture was associated with the request. |\n\n### isForMainFrame\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun isForMainFrame(): Boolean\n```\n\nGets whether the request was made in order to fetch the main frame's document.\n\n| Return ||\n|------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | whether the request was made for the main frame document. Will be `false` for subresources or iframes, for example. |\n\n### isRedirect\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun isRedirect(): Boolean\n```\n\nGets whether the request was a result of a server-side redirect.\n\n| Return ||\n|------------------------------------------------------------------------------------|-------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | whether the request was a result of a server-side redirect. |"]]