java.lang.Object | |
↳ | android.webkit.WebResourceResponse |
Encapsulates a resource response. Applications can return an instance of this
class from shouldInterceptRequest(WebView, WebResourceRequest)
to provide a custom
response when the WebView requests a particular resource.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a resource response with the given MIME type, encoding, and
input stream.
| |||||||||||
Constructs a resource response with the given parameters.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets the input stream that provides the resource response's data.
| |||||||||||
Gets the resource response's encoding.
| |||||||||||
Gets the resource response's MIME type.
| |||||||||||
Gets the description of the resource response's status code.
| |||||||||||
Gets the headers for the resource response.
| |||||||||||
Gets the resource response's status code.
| |||||||||||
Sets the input stream that provides the resource response's data.
| |||||||||||
Sets the resource response's encoding, for example UTF-8.
| |||||||||||
Sets the resource response's MIME type, for example text/html.
| |||||||||||
Sets the headers for the resource response.
| |||||||||||
Sets the resource response's status code and reason phrase.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Constructs a resource response with the given MIME type, encoding, and
input stream. Callers must implement
InputStream.read(byte[])
for the input
stream.
mimeType | the resource response's MIME type, for example text/html |
---|---|
encoding | the resource response's encoding |
data | the input stream that provides the resource response's data |
Constructs a resource response with the given parameters. Callers must
implement InputStream.read(byte[])
for
the input stream.
mimeType | the resource response's MIME type, for example text/html |
---|---|
encoding | the resource response's encoding |
statusCode | the status code needs to be in the ranges [100, 299], [400, 599]. Causing a redirect by specifying a 3xx code is not supported. |
reasonPhrase | the phrase describing the status code, for example "OK". Must be non-null and not empty. |
responseHeaders | the resource response's headers represented as a mapping of header name -> header value. |
data | the input stream that provides the resource response's data |
Gets the input stream that provides the resource response's data.
Gets the resource response's encoding.
Gets the resource response's MIME type.
Gets the description of the resource response's status code.
Gets the headers for the resource response.
Gets the resource response's status code.
Sets the input stream that provides the resource response's data. Callers
must implement InputStream.read(byte[])
.
data | the input stream that provides the resource response's data |
---|
Sets the resource response's encoding, for example UTF-8. This is used to decode the data from the input stream.
encoding | the resource response's encoding |
---|
Sets the resource response's MIME type, for example text/html.
mimeType | the resource response's MIME type |
---|
Sets the headers for the resource response.
headers | mapping of header name -> header value. |
---|
Sets the resource response's status code and reason phrase.
statusCode | the status code needs to be in the ranges [100, 299], [400, 599]. Causing a redirect by specifying a 3xx code is not supported. |
---|---|
reasonPhrase | the phrase describing the status code, for example "OK". Must be non-null and not empty. |