Partager via


WebResourceResponse Constructors

Definition

Overloads

WebResourceResponse(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

WebResourceResponse(String, String, Stream)

Constructs a resource response with the given MIME type, character encoding, and input stream.

WebResourceResponse(String, String, Int32, String, IDictionary<String,String>, Stream)

Constructs a resource response with the given parameters.

WebResourceResponse(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

protected WebResourceResponse (IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Android.Webkit.WebResourceResponse : nativeint * Android.Runtime.JniHandleOwnership -> Android.Webkit.WebResourceResponse

Parameters

javaReference
IntPtr

nativeint

A IntPtrcontaining a Java Native Interface (JNI) object reference.

transfer
JniHandleOwnership

A JniHandleOwnershipindicating how to handle javaReference

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

WebResourceResponse(String, String, Stream)

Constructs a resource response with the given MIME type, character encoding, and input stream.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/String;Ljava/io/InputStream;)V", "")]
public WebResourceResponse (string? mimeType, string? encoding, System.IO.Stream? data);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/String;Ljava/io/InputStream;)V", "")>]
new Android.Webkit.WebResourceResponse : string * string * System.IO.Stream -> Android.Webkit.WebResourceResponse

Parameters

mimeType
String

the resource response's MIME type, for example "text/html".

encoding
String

the resource response's character encoding, for example "utf-8".

data
Stream

the input stream that provides the resource response's data. Must not be a StringBufferInputStream.

Attributes

Remarks

Constructs a resource response with the given MIME type, character encoding, and input stream. Callers must implement InputStream#read(byte[]) for the input stream. InputStream#close() will be called after the WebView has finished with the response.

<p class="note"><b>Note:</b> The MIME type and character encoding must be specified as separate parameters (for example "text/html" and "utf-8"), not a single value like the "text/html; charset=utf-8" format used in the HTTP Content-Type header. Do not use the value of a HTTP Content-Encoding header for encoding, as that header does not specify a character encoding. Content without a defined character encoding (for example image resources) should pass null for encoding.

Java documentation for android.webkit.WebResourceResponse.WebResourceResponse(java.lang.String, java.lang.String, java.io.InputStream).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

WebResourceResponse(String, String, Int32, String, IDictionary<String,String>, Stream)

Constructs a resource response with the given parameters.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/util/Map;Ljava/io/InputStream;)V", "")]
public WebResourceResponse (string? mimeType, string? encoding, int statusCode, string reasonPhrase, System.Collections.Generic.IDictionary<string,string>? responseHeaders, System.IO.Stream? data);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/util/Map;Ljava/io/InputStream;)V", "")>]
new Android.Webkit.WebResourceResponse : string * string * int * string * System.Collections.Generic.IDictionary<string, string> * System.IO.Stream -> Android.Webkit.WebResourceResponse

Parameters

mimeType
String

the resource response's MIME type, for example "text/html".

encoding
String

the resource response's character encoding, for example "utf-8".

statusCode
Int32

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
String

the phrase describing the status code, for example "OK". Must be non-empty.

responseHeaders
IDictionary<String,String>

the resource response's headers represented as a mapping of header name -> header value.

data
Stream

the input stream that provides the resource response's data. Must not be a StringBufferInputStream.

Attributes

Remarks

Constructs a resource response with the given parameters. Callers must implement InputStream#read(byte[]) for the input stream. InputStream#close() will be called after the WebView has finished with the response.

<p class="note"><b>Note:</b> See #WebResourceResponse(String,String,InputStream) for details on what should be specified for mimeType and encoding.

Java documentation for android.webkit.WebResourceResponse.WebResourceResponse(java.lang.String, java.lang.String, int, java.lang.String, java.util.Map<java.lang.String, java.lang.String>, java.io.InputStream).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to