ZeroEQ  0.9.0
ZeroEQ - Zero Event Queue
zeroeq::http Namespace Reference

HTTP protocol support. More...

Classes

struct  Request
 HTTP Request with method, path and body. More...
 
struct  Response
 Response to an HTTP Request. More...
 
class  Server
 Serves HTTP GET and PUT requests for servus::Serializable objects. More...
 

Typedefs

using PUTFunc = std::function< bool()>
 HTTP PUT callback w/o payload, return reply success. More...
 
using PUTPayloadFunc = std::function< bool(const std::string &)>
 HTTP PUT callback w/ JSON payload, return reply success. More...
 
using GETFunc = std::function< std::string()>
 HTTP GET callback to return JSON reply. More...
 
using RESTFunc = std::function< std::future< Response >(const Request &)>
 HTTP REST callback with Request parameter returning a Response future. More...
 

Enumerations

enum  Method {
  GET, POST, PUT, PATCH,
  DELETE, OPTIONS, ALL
}
 HTTP method used in a Request. More...
 
enum  Header {
  ALLOW, CONTENT_TYPE, LAST_MODIFIED, LOCATION,
  RETRY_AFTER
}
 HTTP headers which can be used in a Response. More...
 
enum  Code {
  OK = 200, CREATED = 201, ACCEPTED = 202, NO_CONTENT = 204,
  PARTIAL_CONTENT = 206, MULTIPLE_CHOICES = 300, MOVED_PERMANENTLY = 301, MOVED_TEMPORARILY = 302,
  NOT_MODIFIED = 304, BAD_REQUEST = 400, UNAUTHORIZED = 401, FORBIDDEN = 403,
  NOT_FOUND = 404, NOT_SUPPORTED = 405, NOT_ACCEPTABLE = 406, REQUEST_TIMEOUT = 408,
  PRECONDITION_FAILED = 412, UNSATISFIABLE_RANGE = 416, INTERNAL_SERVER_ERROR = 500, NOT_IMPLEMENTED = 501,
  BAD_GATEWAY = 502, SERVICE_UNAVAILABLE = 503, SPACE_UNAVAILABLE = 507
}
 HTTP codes to be used in a Response. More...
 

Functions

template<typename... Args>
std::future< Responsemake_ready_response (Args &&...args)
 

Detailed Description

HTTP protocol support.

The http::Server is a zeroeq::Receiver which receives and handles http requests.

Typedef Documentation

using zeroeq::http::GETFunc = typedef std::function<std::string()>

HTTP GET callback to return JSON reply.

Definition at line 33 of file http/types.h.

using zeroeq::http::PUTFunc = typedef std::function<bool()>

HTTP PUT callback w/o payload, return reply success.

Definition at line 27 of file http/types.h.

using zeroeq::http::PUTPayloadFunc = typedef std::function<bool(const std::string&)>

HTTP PUT callback w/ JSON payload, return reply success.

Definition at line 30 of file http/types.h.

using zeroeq::http::RESTFunc = typedef std::function<std::future<Response>(const Request&)>

HTTP REST callback with Request parameter returning a Response future.

Definition at line 36 of file http/types.h.

Enumeration Type Documentation

HTTP codes to be used in a Response.

Definition at line 26 of file response.h.

enum zeroeq::http::Header
strong

HTTP headers which can be used in a Response.

Definition at line 16 of file response.h.

enum zeroeq::http::Method
strong

HTTP method used in a Request.

Definition at line 17 of file request.h.

Function Documentation

template<typename... Args>
std::future<Response> zeroeq::http::make_ready_response ( Args &&...  args)
Returns
ready future wrapping an HTTP Response constructed with the values passed.

Definition at line 22 of file helpers.h.