This class provides an implementation of AsyncProvider that makes HTTP requests asynchronously. More...
#include <AsyncHttpFetch.h>
Inherits atscppapi::AsyncProvider.
Public Types | |
enum | Result { RESULT_SUCCESS = 10000, RESULT_TIMEOUT, RESULT_FAILURE } |
Public Member Functions | |
AsyncHttpFetch (const std::string &url_str, HttpMethod http_method=HTTP_METHOD_GET) | |
AsyncHttpFetch (const std::string &url_str, const std::string &request_body) | |
Headers & | getRequestHeaders () |
Used to manipulate the headers of the request to be made. | |
Result | getResult () const |
Used to extract the response after request completion. | |
const Url & | getRequestUrl () const |
const std::string & | getRequestBody () const |
const Response & | getResponse () const |
Used to extract the response after request completion. | |
void | getResponseBody (const void *&body, size_t &body_size) const |
Used to extract the body of the response after request completion. | |
virtual void | run () |
Starts a HTTP fetch of the Request contained. | |
Protected Member Functions | |
virtual | ~AsyncHttpFetch () |
Friends | |
class | utils::internal |
This class provides an implementation of AsyncProvider that makes HTTP requests asynchronously.
This provider automatically self-destructs after the completion of the request.
See example async_http_fetch for sample usage.
Definition at line 46 of file AsyncHttpFetch.h.
Definition at line 59 of file AsyncHttpFetch.h.
atscppapi::AsyncHttpFetch::AsyncHttpFetch | ( | const std::string & | url_str, | |
HttpMethod | http_method = HTTP_METHOD_GET | |||
) |
atscppapi::AsyncHttpFetch::AsyncHttpFetch | ( | const std::string & | url_str, | |
const std::string & | request_body | |||
) |
virtual atscppapi::AsyncHttpFetch::~AsyncHttpFetch | ( | ) | [protected, virtual] |
const std::string& atscppapi::AsyncHttpFetch::getRequestBody | ( | ) | const |
Headers& atscppapi::AsyncHttpFetch::getRequestHeaders | ( | ) |
Used to manipulate the headers of the request to be made.
const Url& atscppapi::AsyncHttpFetch::getRequestUrl | ( | ) | const |
const Response& atscppapi::AsyncHttpFetch::getResponse | ( | ) | const |
Used to extract the response after request completion.
void atscppapi::AsyncHttpFetch::getResponseBody | ( | const void *& | body, | |
size_t & | body_size | |||
) | const |
Used to extract the body of the response after request completion.
On unsuccessful completion, values (NULL, 0) are set.
body | Output argument; will point to the body | |
body_size | Output argument; will contain the size of the body |
Result atscppapi::AsyncHttpFetch::getResult | ( | ) | const |
Used to extract the response after request completion.
virtual void atscppapi::AsyncHttpFetch::run | ( | ) | [virtual] |
Starts a HTTP fetch of the Request contained.
Implements atscppapi::AsyncProvider.
friend class utils::internal [friend] |
Definition at line 105 of file AsyncHttpFetch.h.