Class WebHttpRequestInterceptor
Definition
- Namespace:
- Tizen.NUI
- Assembly:
- Tizen.NUI.dll
It is a class for http request interceptor of web view.
C#Copypublic class WebHttpRequestInterceptor : Disposable
- Inheritance
Properties
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#Copypublic IDictionary<string, string> Headers { get; }
Property Value
Type | Description |
---|---|
IDictionary<String, String> |
Declaration
C#Copypublic WebView InterceptedWebView { get; }
Property Value
Type | Description |
---|---|
WebView |
Declaration
C#Copypublic string Method { get; }
Property Value
Type | Description |
---|---|
String |
Declaration
C#Copypublic string Url { get; }
Property Value
Type | Description |
---|---|
String |
Methods
AddResponseHeader(String, String)
Adds HTTP header to response for intercepted request. This function can be used inside or outside WebContext.HttpRequestIntercepted.
Declaration
C#Copypublic 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 |
AddResponseHeaders(IDictionary<String, String>)
Adds HTTP headers to response for intercepted request. This function can be used inside or outside WebContext.HttpRequestIntercepted.
Declaration
C#Copypublic bool AddResponseHeaders(IDictionary<string, string> headers)
Parameters
Type | Name | Description |
---|---|---|
IDictionary<String, String> | headers | Map of response headers |
Returns
Type | Description |
---|---|
Boolean |
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#Copypublic bool Ignore()
Returns
Type | Description |
---|---|
Boolean |
Declaration
C#Copyprotected override void ReleaseSwigCPtr(Runtime.InteropServices.HandleRef swigCPtr)
Parameters
Type | Name | Description |
---|---|---|
Tizen.System.Runtime.InteropServices.HandleRef | swigCPtr |
Overrides
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#Copypublic bool SetResponse(string headers, byte[] body)
Parameters
Type | Name | Description |
---|---|---|
String | headers | Headers of response |
Byte[] | body | Contents of response |
Returns
Type | Description |
---|---|
Boolean |
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#Copypublic 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 |
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#Copypublic bool SetResponseBody(byte[] body)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | body | Contents of response |
Returns
Type | Description |
---|---|
Boolean |
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#Copypublic 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 |
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#Copypublic 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 |
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#Copypublic bool WriteResponseChunk(byte[] chunk)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | chunk | Chunk of response |
Returns
Type | Description |
---|---|
Boolean |
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#Copypublic 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 |