atscppapi  1.0.9
C++ wrapper for Apache Traffic Server API
 All Classes Files Functions Enumerations Enumerator Macros
Public Types | Public Member Functions | List of all members
atscppapi::AsyncHttpFetch Class Reference

This class provides an implementation of AsyncProvider that makes HTTP requests asynchronously. This provider automatically self-destructs after the completion of the request. More...

#include "AsyncHttpFetch.h"

Inheritance diagram for atscppapi::AsyncHttpFetch:
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)
 
HeadersgetRequestHeaders ()
 
Result getResult () const
 
const UrlgetRequestUrl () const
 
const ResponsegetResponse () const
 
void getResponseBody (const void *&body, size_t &body_size) const
 
virtual void run (shared_ptr< AsyncDispatchControllerBase > dispatch_controller)
 

Detailed Description

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.

Member Function Documentation

Headers & AsyncHttpFetch::getRequestHeaders ( )

Used to manipulate the headers of the request to be made.

Returns
A reference to mutable headers.
const Url & AsyncHttpFetch::getRequestUrl ( ) const
Returns
Non-mutable reference to the request URL.
const Response & AsyncHttpFetch::getResponse ( ) const

Used to extract the response after request completion.

Returns
Non-mutable reference to the response.
void 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.

Parameters
bodyOutput argument; will point to the body
body_sizeOutput argument; will contain the size of the body
AsyncHttpFetch::Result AsyncHttpFetch::getResult ( ) const

Used to extract the response after request completion.

Returns
Result of the operation
void AsyncHttpFetch::run ( shared_ptr< AsyncDispatchControllerBase >  dispatch_controller)
virtual

Starts a HTTP fetch of the Request contained.

Implements atscppapi::AsyncProvider.


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