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
Afficher le fichier Open project: electromute/gnip-dotnet

Méthodes publiques

Méthode 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

Méthode 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 méthode

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 ///
Résultat System.Result

DoGet() public méthode

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

DoPost() public méthode

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
Résultat System.Result

DoPut() public méthode

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
Résultat System.Result

GetServerTimeDelta() public méthode

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
Résultat System.TimeSpan

HTTPConnection() public méthode

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