Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes
rail::spatial_temporal_learning::worldlib::remote::HttpClient Class Reference

The main HTTP client connection. More...

#include <HttpClient.h>

Inheritance diagram for rail::spatial_temporal_learning::worldlib::remote::HttpClient:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 HttpClient (const HttpClient &client)
 Create a new HttpClient.
 HttpClient (const std::string &host="localhost", const uint16_t port=80)
 Create a new HttpClient.
virtual ~HttpClient ()
 Cleans up a HttpClient.

Static Public Attributes

static const unsigned int DEFAULT_PORT = 80

Protected Member Functions

std::string get (const std::string &url) const
 Execute a HTTP GET request to the server.

Private Member Functions

void init ()
 Initialize the cURL client.

Private Attributes

std::string base_
CURL * curl_

Detailed Description

The main HTTP client connection.

The worldlib SQL HTTP can make HTTP get requests to remote web servers.

Definition at line 35 of file HttpClient.h.


Constructor & Destructor Documentation

HttpClient::HttpClient ( const HttpClient client)

Create a new HttpClient.

Creates a new HttpClient by copying the values from the given HttpClient.

Parameters:
clientThe HttpClient to copy.

Definition at line 20 of file HttpClient.cpp.

rail::spatial_temporal_learning::worldlib::remote::HttpClient::HttpClient ( const std::string &  host = "localhost",
const uint16_t  port = 80 
)

Create a new HttpClient.

Creates a new HttpClient with the given connection information.

Parameters:
hostThe host of the server (without a protocol specification; defaults to localhost).
portThe host port of the server (defaults to port 80).
HttpClient::~HttpClient ( ) [virtual]

Cleans up a HttpClient.

Cleans up any connections used by the HttpClient.

Definition at line 32 of file HttpClient.cpp.


Member Function Documentation

string HttpClient::get ( const std::string &  url) const [protected]

Execute a HTTP GET request to the server.

Attempt to make an HTTP GET request to the server. The request is made to http://<host>:<port>/<url>. If the request fails, an empty string is returned.

Parameters:
urlThe URL (minus the host information) to make the request to.
Returns:
The resulting contents of the HTTP request or the empty string if an error occured.

Definition at line 57 of file HttpClient.cpp.

void HttpClient::init ( ) [private]

Initialize the cURL client.

Initialize the cURL client paramters.

Definition at line 41 of file HttpClient.cpp.


Member Data Documentation

The base URL.

Definition at line 83 of file HttpClient.h.

The main HTTP connection.

Definition at line 81 of file HttpClient.h.

The default HTTP port.

Reimplemented from rail::spatial_temporal_learning::worldlib::remote::Client.

Definition at line 39 of file HttpClient.h.


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


worldlib
Author(s): Russell Toris
autogenerated on Fri Feb 12 2016 00:24:19