Class HttpTransfer
Base class that defines methods for transferring content over HTTP.
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public abstract class HttpTransfer : object
Properties
WildcardCharacters
Gets or sets the wildcard characters used to replace asterisks in ReplaceWildcards.
Declaration
public static string WildcardCharacters { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
AddQueryToUrl(String, String)
Escapes and adds a query parameter as a key/empty-value pair to a URL.
Declaration
public static string AddQueryToUrl(string url, string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL with the query to which the key/value should be added. |
System.String | key | The key of the query parameter to add. |
Returns
Type | Description |
---|---|
System.String | The original URL with the query parameter added. |
AddQueryToUrl(String, String, String)
Escapes and adds a query parameter as a key/value pair to a URL.
Declaration
public static string AddQueryToUrl(string url, string key, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL with the query to which the key/value should be added. |
System.String | key | The key of the query parameter to add. |
System.String | value | The value of the query parameter to add. |
Returns
Type | Description |
---|---|
System.String | The original URL with the query parameter added. |
GetRandomWildcardCharacter()
Gets a random wildcard character.
Declaration
public static string GetRandomWildcardCharacter()
Returns
Type | Description |
---|---|
System.String | A random wildcard character. |
ReplaceWildcards(String)
Replaces asterisks in URLs with characters from WildcardCharacters.
Declaration
public static string ReplaceWildcards(string url)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL with asterisks. |
Returns
Type | Description |
---|---|
System.String |
Send(HttpRequestArgs)
Sends a request synchronously.
Declaration
public HttpResponseArgs Send(HttpRequestArgs requestArgs)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestArgs | requestArgs | The request parameters. |
Returns
Type | Description |
---|---|
HttpResponseArgs | The resulting response. |
SendAsync(HttpRequestArgs, Action1<HttpResponseArgs>)
Sends a request asynchronously.
Declaration
public void SendAsync(HttpRequestArgs requestArgs, Action1<HttpResponseArgs> callback)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestArgs | requestArgs | The request parameters. |
Action1<HttpResponseArgs> | callback | The callback to execute with the resulting response. |
SendBinary(HttpRequestArgs)
Sends binary content synchronously using the specified arguments.
Declaration
public abstract HttpResponseArgs SendBinary(HttpRequestArgs requestArgs)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestArgs | requestArgs | The request arguments. |
Returns
Type | Description |
---|---|
HttpResponseArgs | The response arguments from the server. |
SendBinaryAsync(HttpRequestArgs, Action1<HttpResponseArgs>)
Sends binary content asynchronously using the specified arguments.
Declaration
public abstract void SendBinaryAsync(HttpRequestArgs requestArgs, Action1<HttpResponseArgs> callback)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestArgs | requestArgs | The request arguments. |
Action1<HttpResponseArgs> | callback | The callback to execute on success or failure. |
SendText(HttpRequestArgs)
Sends text content synchronously using the specified arguments.
Declaration
public abstract HttpResponseArgs SendText(HttpRequestArgs requestArgs)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestArgs | requestArgs | The request arguments. |
Returns
Type | Description |
---|---|
HttpResponseArgs | The response arguments from the server. |
SendTextAsync(HttpRequestArgs, Action1<HttpResponseArgs>)
Sends text content asynchronously using the specified arguments.
Declaration
public abstract void SendTextAsync(HttpRequestArgs requestArgs, Action1<HttpResponseArgs> callback)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestArgs | requestArgs | The request arguments. |
Action1<HttpResponseArgs> | callback | The callback to execute on success or failure. |
Shutdown()
Releases any resources and shuts down.
Declaration
public abstract void Shutdown()
Events
OnSendFinish
Raised before an HTTP request is sent.
Declaration
public static event Action1<HttpSendFinishArgs> OnSendFinish
Event Type
Type | Description |
---|---|
Action1<HttpSendFinishArgs> |
OnSendStart
Raised before an HTTP request is sent.
Declaration
public static event Action1<HttpSendStartArgs> OnSendStart
Event Type
Type | Description |
---|---|
Action1<HttpSendStartArgs> |