C# Класс 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
Показать файл Открыть проект

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

DoDelete() публичный Метод

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 ///
Результат System.Result

DoGet() публичный Метод

Send an HTTP request of type GET to the given URL.
public DoGet ( string urlString ) : Stream
urlString string the URL to receive the GET
Результат Stream

DoPost() публичный Метод

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
Результат System.Result

DoPut() публичный Метод

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
Результат System.Result

GetServerTimeDelta() публичный Метод

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
Результат System.TimeSpan

HTTPConnection() публичный Метод

Create a new {@link HTTPConnection} with the provided configuration.
public HTTPConnection ( Config config ) : System
config Config the configuration for the connection ///
Результат System