C# Class Gnip.Client.Util.HTTPConnection

Basic abstraction atop an HTTP connection that is used to handle low-level Gnip <> HTTP protocol interaction. This class is used by the {@link com.Gnip.Client.GnipConnection} to communicate with a Gnip server and is not intended to be used by clients. This class sets several headers on the request, in part based on the how the connection is configured by the {@link com.Gnip.Client.Config} instance.
  • Content-Encoding and Accept-Encoding are set if {@link Config#setUseGzip(boolean)} is true
  • User-Agent is set to a Java-client value that includes the version of the client library
  • Authorization is set using basic authentication credentials
Datei anzeigen Open project: electromute/gnip-dotnet

Public Methods

Method Description
DoDelete ( string urlString ) : System.Result

Send an HTTP request of type DELETE to the given URL.

DoGet ( string urlString ) : Stream

Send an HTTP request of type GET to the given URL.

DoPost ( string urlString, byte data ) : System.Result

Send an HTTP request of type POST to the given URL with the given data for the request body.

DoPut ( string urlString, byte data ) : System.Result

Send an HTTP request of type PUT to the given URL with the given data for the request body.

GetServerTimeDelta ( ) : System.TimeSpan

Get the Timespan different betweet the server time and the client time. This allows the server time to be approximated more accurately by DateTime.Now.Add(GetServerTimeDelta());

HTTPConnection ( Config config ) : System

Create a new {@link HTTPConnection} with the provided configuration.

Private Methods

Method Description
CreateConnection ( string urlString, HTTPMethod method ) : HttpWebRequest

Creates a new HttpWebRequest based on the urlString, method and config.

GetData ( HttpWebRequest request ) : Stream

Gets data base on the request.

GetHeaders ( HttpWebRequest request ) : WebHeaderCollection

Gets the response headers for the request.

HTTPConnection ( ) : System
TransferData ( byte data, HttpWebRequest request ) : System.Result

Sends data through the request via put, or post.

Method Details

DoDelete() public method

Send an HTTP request of type DELETE to the given URL.
public DoDelete ( string urlString ) : System.Result
urlString string the URL to receive the DELETE ///
return System.Result

DoGet() public method

Send an HTTP request of type GET to the given URL.
public DoGet ( string urlString ) : Stream
urlString string the URL to receive the GET
return Stream

DoPost() public method

Send an HTTP request of type POST to the given URL with the given data for the request body.
public DoPost ( string urlString, byte data ) : System.Result
urlString string the URL to receive the POST
data byte the bytes to send in the request body
return System.Result

DoPut() public method

Send an HTTP request of type PUT to the given URL with the given data for the request body.
public DoPut ( string urlString, byte data ) : System.Result
urlString string the URL to receive the PUT
data byte the bytes to send in the request body
return System.Result

GetServerTimeDelta() public method

Get the Timespan different betweet the server time and the client time. This allows the server time to be approximated more accurately by DateTime.Now.Add(GetServerTimeDelta());
public GetServerTimeDelta ( ) : System.TimeSpan
return System.TimeSpan

HTTPConnection() public method

Create a new {@link HTTPConnection} with the provided configuration.
public HTTPConnection ( Config config ) : System
config Config the configuration for the connection ///
return System