C# Class CSharpAnalytics.Network.BackgroundHttpWebRequester

Responsible for requesting a queue of URIs over HTTP or HTTPS in background using HttpWebRequest.
Inheritance: BackgroundHttpRequester
Show file Open project: TechSmith/CSharpAnalytics Class Usage Examples

Public Methods

Method Description
BackgroundHttpWebRequester ( Action preprocessor = null ) : System

Create a new BackgroundHttpWebRequester.

Protected Methods

Method Description
RequestWithFailureRetry ( Uri requestUri, CancellationToken cancellationToken ) : void

Request the URI with retry logic using HttpWebRequest.

Private Methods

Method Description
CreateGetRequest ( Uri requestUri ) : HttpWebRequest

Create a HttpWebRequest using the HTTP GET method.

CreatePostRequest ( Uri requestUri, bool writeBody ) : HttpWebRequest

Create a HttpWebRequest using the HTTP POST method.

CreateRequest ( Uri requestUri, bool writePostBody = true ) : HttpWebRequest

Creates the HttpWebRequest for a URI taking into consideration the length. For URIs over 2000 bytes it will be a GET otherwise it will become a POST with the query payload moved to the POST body.

Method Details

BackgroundHttpWebRequester() public method

Create a new BackgroundHttpWebRequester.
public BackgroundHttpWebRequester ( Action preprocessor = null ) : System
preprocessor Action Optional preprocessor for setting user agents, debugging etc.
return System

RequestWithFailureRetry() protected method

Request the URI with retry logic using HttpWebRequest.
protected RequestWithFailureRetry ( Uri requestUri, CancellationToken cancellationToken ) : void
requestUri System.Uri URI to request.
cancellationToken System.Threading.CancellationToken CancellationToken to indicate if the request should be cancelled.
return void