#include <HttpClient.h>

Collaboration diagram for HttpClient:
[legend]

Public Member Functions

virtual ~HttpClient ()
 HttpClient destructor. More...
 
bool sendRequest (const Url &url, RequestCompletedDelegate requestComplete)
 
bool sendRequest (const HttpMethod method, const Url &url, const HttpHeaders &headers, RequestCompletedDelegate requestComplete)
 
bool sendRequest (const HttpMethod method, const Url &url, const HttpHeaders &headers, const String &body, RequestCompletedDelegate requestComplete)
 
bool downloadString (const Url &url, RequestCompletedDelegate requestComplete)
 
bool downloadFile (const Url &url, RequestCompletedDelegate requestComplete=nullptr)
 
bool downloadFile (const Url &url, const String &saveFileName, RequestCompletedDelegate requestComplete=nullptr)
 Queue request to download a file. More...
 
bool send (HttpRequest *request)
 
HttpRequestrequest (const String &url)
 
HttpRequestcreateRequest (const Url &url)
 Helper function to create a new request on a URL. More...
 

Static Public Member Functions

static void cleanup ()
 

Protected Types

typedef ObjectMap< String, HttpClientConnectionHttpConnectionPool
 

Protected Member Functions

String getCacheKey (const Url &url)
 

Static Protected Attributes

static HttpConnectionPool httpConnectionPool
 

Member Typedef Documentation

◆ HttpConnectionPool

Constructor & Destructor Documentation

◆ ~HttpClient()

virtual HttpClient::~HttpClient ( )
inlinevirtual

HttpClient destructor.

Note
DON'T call cleanup. If you want to free all resources from HttpClients the correct sequence will be to
  1. Delete all instances of HttpClient
  2. Call the static method HttpClient::cleanup();

Member Function Documentation

◆ cleanup()

static void HttpClient::cleanup ( )
inlinestatic

Use this method to clean all request queues and object pools

◆ createRequest()

HttpRequest* HttpClient::createRequest ( const Url url)
inline

Helper function to create a new request on a URL.

Parameters
url
Return values
HttpRequest*

◆ downloadFile() [1/2]

bool HttpClient::downloadFile ( const Url url,
RequestCompletedDelegate  requestComplete = nullptr 
)
inline

◆ downloadFile() [2/2]

bool HttpClient::downloadFile ( const Url url,
const String saveFileName,
RequestCompletedDelegate  requestComplete = nullptr 
)

Queue request to download a file.

Parameters
urlSource of file data
saveFileNamePath to save file to. Optional: specify nullptr to use name from url
requestCompleteCompletion callback

◆ downloadString()

bool HttpClient::downloadString ( const Url url,
RequestCompletedDelegate  requestComplete 
)
inline

◆ getCacheKey()

String HttpClient::getCacheKey ( const Url url)
inlineprotected

◆ request()

HttpRequest* HttpClient::request ( const String url)
inline

◆ send()

bool HttpClient::send ( HttpRequest request)

◆ sendRequest() [1/3]

bool HttpClient::sendRequest ( const Url url,
RequestCompletedDelegate  requestComplete 
)
inline

◆ sendRequest() [2/3]

bool HttpClient::sendRequest ( const HttpMethod  method,
const Url url,
const HttpHeaders headers,
RequestCompletedDelegate  requestComplete 
)
inline

◆ sendRequest() [3/3]

bool HttpClient::sendRequest ( const HttpMethod  method,
const Url url,
const HttpHeaders headers,
const String body,
RequestCompletedDelegate  requestComplete 
)
inline

Member Data Documentation

◆ httpConnectionPool

HttpConnectionPool HttpClient::httpConnectionPool
staticprotected

The documentation for this class was generated from the following file: