Class WebHttpRequestInterceptor

Definition

Namespace:
Tizen.NUI
Assembly:
Tizen.NUI.dll

It is a class for http request interceptor of web view.

C#
Copy
public class WebHttpRequestInterceptor : Disposable
Inheritance
WebHttpRequestInterceptor

Properties

View Source

Headers

Gets headers of intercepted http request. Headers is a map with string key-value pairs, for example, "Accept: text/plain", "Accept-Charset: utf-8", etc.

Declaration
C#
Copy
public IDictionary<string, string> Headers { get; }
Property Value
Type Description
IDictionary<String, String>
View Source

InterceptedWebView

Gets webview in which request is intercepted.

Declaration
C#
Copy
public WebView InterceptedWebView { get; }
Property Value
Type Description
WebView
View Source

Method

Gets method of intercepted http request, for example, GET, POST, etc.

Declaration
C#
Copy
public string Method { get; }
Property Value
Type Description
String
View Source

Url

Gets url of intercepted request.

Declaration
C#
Copy
public string Url { get; }
Property Value
Type Description
String

Methods

View Source

AddResponseHeader(String, String)

Adds HTTP header to response for intercepted request. This function can be used inside or outside WebContext.HttpRequestIntercepted.

Declaration
C#
Copy
public bool AddResponseHeader(string fieldName, string fieldValue)
Parameters
Type Name Description
String fieldName

Key of response header

String fieldValue

Value of response header

Returns
Type Description
Boolean
View Source

AddResponseHeaders(IDictionary<String, String>)

Adds HTTP headers to response for intercepted request. This function can be used inside or outside WebContext.HttpRequestIntercepted.

Declaration
C#
Copy
public bool AddResponseHeaders(IDictionary<string, string> headers)
Parameters
Type Name Description
IDictionary<String, String> headers

Map of response headers

Returns
Type Description
Boolean
View Source

Ignore()

Ignores the http request. When application doesn't have a response for intercepted request, this function would be called which notifies engine to proceed with normal resource loading. It can be called only INSIDE WebContext.HttpRequestIntercepted. After it called, any further call on WebHttpRequestInterceptor results in undefined behavior.

Declaration
C#
Copy
public bool Ignore()
Returns
Type Description
Boolean
View Source

ReleaseSwigCPtr(Runtime.InteropServices.HandleRef)

Declaration
C#
Copy
protected override void ReleaseSwigCPtr(Runtime.InteropServices.HandleRef swigCPtr)
Parameters
Type Name Description
Tizen.System.Runtime.InteropServices.HandleRef swigCPtr
Overrides
View Source

SetResponse(String, Byte[])

Writes whole response body with headers at once. To call it, application should have full response headers and body ready for the intercepted request. This function can be used inside or outside WebContext.HttpRequestIntercepted. After this call, any further call on WebHttpRequestInterceptor results in undefined behavior.

Declaration
C#
Copy
public bool SetResponse(string headers, byte[] body)
Parameters
Type Name Description
String headers

Headers of response

Byte[] body

Contents of response

Returns
Type Description
Boolean
View Source

SetResponse(String, String)

Writes whole response body with headers at once. To call it, application should have full response headers and body ready for the intercepted request. This function can be used inside or outside WebContext.HttpRequestIntercepted. After this call, any further call on WebHttpRequestInterceptor results in undefined behavior.

Declaration
C#
Copy
public bool SetResponse(string headers, string body)
Parameters
Type Name Description
String headers

Headers of response

String body

Contents of response. For UTF-8 encoding, body would be got like System.Text.Encoding.UTF8.GetString(...)

Returns
Type Description
Boolean
View Source

SetResponseBody(Byte[])

Writes whole response body at once. To call it, application should have full response body ready for the intercepted request. This function can be used inside or outside WebContext.HttpRequestIntercepted. After this call, any further call on WebHttpRequestInterceptor results in undefined behavior.

Declaration
C#
Copy
public bool SetResponseBody(byte[] body)
Parameters
Type Name Description
Byte[] body

Contents of response

Returns
Type Description
Boolean
View Source

SetResponseBody(String)

Writes whole response body at once. To call it, application should have full response body ready for the intercepted request. This function can be used inside or outside WebContext.HttpRequestIntercepted. After this call, any further call on WebHttpRequestInterceptor results in undefined behavior.

Declaration
C#
Copy
public bool SetResponseBody(string body)
Parameters
Type Name Description
String body

Contents of response. For UTF-8 encoding, body would be got like System.Text.Encoding.UTF8.GetString(...)

Returns
Type Description
Boolean
View Source

SetResponseStatus(Int32, String)

Sets status code and status text of response for intercepted request. This function can be used inside or outside WebContext.HttpRequestIntercepted.

Declaration
C#
Copy
public bool SetResponseStatus(int statusCode, string customStatusText)
Parameters
Type Name Description
Int32 statusCode

Status code of response

String customStatusText

Status text of response

Returns
Type Description
Boolean
View Source

WriteResponseChunk(Byte[])

Writes a part of response body. This function can be called only OUTSIDE WebContext.HttpRequestIntercepted. If it returns false, handling the request is done. Any further calls result in undefined behavior. User should always check return value, because response to this request might not be needed any more, and the function can return false even though user still has data to write.

After writing full response body in chunks using this function, call it again with null as chunk, to signal that response body is finished.

Declaration
C#
Copy
public bool WriteResponseChunk(byte[] chunk)
Parameters
Type Name Description
Byte[] chunk

Chunk of response

Returns
Type Description
Boolean
View Source

WriteResponseChunk(String)

Writes a part of response body. This function can be called only OUTSIDE WebContext.HttpRequestIntercepted. If it returns false, handling the request is done. Any further calls result in undefined behavior. User should always check return value, because response to this request might not be needed any more, and the function can return false even though user still has data to write.

After writing full response body in chunks using this function, call it again with null as chunk, to signal that response body is finished.

Declaration
C#
Copy
public bool WriteResponseChunk(string chunk)
Parameters
Type Name Description
String chunk

Chunk of response. For UTF-8 encoding, chunk would be got like System.Text.Encoding.UTF8.GetString(...)

Returns
Type Description
Boolean

Extension Methods