The library contains classes specifically for REST processing, which are built on classes that provide basic CGI functionality. The basic CGI functionality is documented in the method class where there is example code for using CGI without REST. The rest class contains the documentation for the REST classes that are built on and hide some of the basic CGI classes.
Classes | |
class | content |
Base class for content stream (HTTP message body). More... | |
class | icontent |
Input content stream from HTTP request message body. More... | |
class | ocontent |
Output content stream for HTTP response message body. More... | |
struct | cookie_attrs |
Cookie attributes. More... | |
class | cookie |
HTTP cookie as a name, value, and attributes. More... | |
class | cookies |
Collection of cookies. More... | |
class | ctmpl |
Template for creating content using variable replacement. More... | |
class | date_time |
Date and time class wrapping UTC time_t type for HTTP formats. More... | |
class | endpoint |
Represents the HTTP service endpoint. More... | |
class | env |
CGI environment variables. More... | |
class | exception |
Base class for throwing exceptions when processing HTTP methods. More... | |
class | no_content |
"No content" exception. More... | |
class | reset_content |
"Reset content" exception. More... | |
class | see_other |
"See other" exception. More... | |
class | not_modified |
"Not modified" exception. More... | |
class | bad_request |
"Bad request" exception. More... | |
class | unauthorized |
"Unauthorized" exception. More... | |
class | not_found |
"Not found" exception. More... | |
class | method_not_allowed |
"Method not allowed" exception. More... | |
class | conflict |
"Conflict" exception. More... | |
class | gone |
"Gone" exception. More... | |
class | precondition_failed |
"Precondition failed" exception. More... | |
class | request_entity_too_large |
"Request Entity Too Large" exception. More... | |
class | unsupported_media_type |
"Unsupported Media Type" exception. More... | |
class | internal_server_error |
"Internal server error" exception. More... | |
class | hdr |
HTTP header base class mapping field names to values. More... | |
class | general_hdr |
General HTTP header fields. More... | |
class | request_hdr |
Request and general HTTP header fields. More... | |
class | response_hdr |
Response, general, and some entity HTTP header fields. More... | |
class | content_hdr |
Entity content HTTP header fields. More... | |
class | http_token |
HTTP/1.1 specification "token". More... | |
class | http_text |
HTTP/1.1 specification "TEXT". More... | |
class | http_word |
HTTP/1.1 specification "word", either a "token" or quoted text. More... | |
class | method |
HTTP method class. More... | |
class | method_e |
Method type enumeration. More... | |
class | uri_info |
URI information for the located resource. More... | |
class | resource |
Base class for REST resource. More... | |
class | rest |
REST processing for application resources. More... | |
class | status_code_e |
HTTP status code enumeration. More... | |
class | tiny_parser |
Tiny parser. More... | |
class | version_tag |
Version tag class for identifying versions using a string. More... | |
class | version |
Information that identifies a version of a resource. More... | |
class | version_constraint |
Constraint on a resource's version which governs the operation of or response to a method. More... | |
Namespaces | |
namespace | httpsyn |
HTTP syntax declarations. | |
Typedefs | |
typedef std::map< status_code_e, ctmpl > | sc_ctmpls |
Map of status codes to content templates. | |
Functions | |
template<typename T> | |
icontent & | operator>> (icontent &ic, T &v) |
Stream in content. | |
template<typename T> | |
ocontent & | operator<< (ocontent &oc, const T &v) |
Stream out content. | |
ocontent & | operator<< (ocontent &oc, std::ostream &(*v)(std::ostream &)) |
Stream out content function. | |
std::ostream & | operator<< (std::ostream &os, const cookie_attrs &v) |
Stream out in HTTP header (response) format. | |
std::ostream & | operator<< (std::ostream &os, const cookie &v) |
Stream out in HTTP header (response) format. | |
std::ostream & | operator<< (std::ostream &os, const cookies &v) |
Stream out in HTTP header (response) format. | |
bool RESTCGI_API | parse (std::string::const_iterator &first, std::string::const_iterator last, date_time &v) |
Parse a date_time, returning whether found or not and advancing first and setting v if found. | |
std::ostream & | operator<< (std::ostream &os, const hdr &v) |
Stream out in HTTP header format. | |
void RESTCGI_API | copy (const env &e, request_hdr &rh, content_hdr &ch) |
Copy the request and content headers from the environment. | |
content_hdr RESTCGI_API | content_hdr_from_type (const std::string &type) |
Creates a content hdr that has a field entry for the content type given by the type arg. | |
bool RESTCGI_API | parse (std::string::const_iterator &first, std::string::const_iterator last, http_token &v, bool noskipls=false) |
Parse HTTP token. | |
bool RESTCGI_API | parse (std::string::const_iterator &first, std::string::const_iterator last, http_text &v, const char *terms=0, bool lastok=false) |
Parse HTTP text. | |
bool RESTCGI_API | parse (std::string::const_iterator &first, std::string::const_iterator last, http_word &v) |
Parse HTTP word. | |
void RESTCGI_API | copy (const request_hdr &rh, version_constraint &vc) |
Copy version constraint info from request hdr. | |
void RESTCGI_API | copy (const version &v, response_hdr &rh) |
Copy version info to response hdr. | |
std::ostream & | operator<< (std::ostream &os, const status_code_e &v) |
Stream out in HTTP header format. | |
std::string RESTCGI_API | encode_ctl (const std::string &v) |
URI encode all (ISO 8859) control chars. |
bool RESTCGI_API restcgi::parse | ( | std::string::const_iterator & | first, | |
std::string::const_iterator | last, | |||
date_time & | v | |||
) |
Parse a date_time, returning whether found or not and advancing first and setting v if found.
Skips leading isspace chars.
std::invalid_argument | if a complete pattern is found but the date or time is invalid |
void RESTCGI_API restcgi::copy | ( | const env & | e, | |
request_hdr & | rh, | |||
content_hdr & | ch | |||
) |
Copy the request and content headers from the environment.
Note that the "general" and "other" fields are put into the request hdr, only content-specific ones are put in the content hdr.
bool RESTCGI_API restcgi::parse | ( | std::string::const_iterator & | first, | |
std::string::const_iterator | last, | |||
http_token & | v, | |||
bool | noskipls = false | |||
) |
Parse HTTP token.
Returns whether found or not and advances first and sets v if found. Skips leading SP or HT chars unless noskipls
is true.
bool RESTCGI_API restcgi::parse | ( | std::string::const_iterator & | first, | |
std::string::const_iterator | last, | |||
http_text & | v, | |||
const char * | terms = 0 , |
|||
bool | lastok = false | |||
) |
Parse HTTP text.
Returns whether found or not and advances first and sets v if found. LWS is compressed. If terms is specified it stops on any of those chars, i.e. on return *first == <term>
(note that true is returned and v is empty if term is the first char). If last encountered before a term char and lastok is true, this returns all chars in interval. If terms not specified, this returns all chars in interval or up to first invalid char.
bool RESTCGI_API restcgi::parse | ( | std::string::const_iterator & | first, | |
std::string::const_iterator | last, | |||
http_word & | v | |||
) |
Parse HTTP word.
Returns whether found or not and advances first and sets if found. Skips leading SP or HT chars.
void RESTCGI_API restcgi::copy | ( | const request_hdr & | rh, | |
version_constraint & | vc | |||
) |
Copy version constraint info from request hdr.
Notes:
If-Match
is paired with If-Unmodified-Since
and If-None-Match
with If-Modified-Since
. If-Match
and If-None-Match
are not supported. If-Match
of "*" is the same as no constraint since the resource was found and has some sort of tag and in this library methods are only applied to exising resources. If-None-Match
of "*" is the unsatisfiable constraint, because in this library methods are only performed on existing resources which always have a tag. We leave "*" as is for version_constraint to handle. std::string RESTCGI_API restcgi::encode_ctl | ( | const std::string & | v | ) |
URI encode all (ISO 8859) control chars.
This is useful as a way of making CTL chars printable, for error msgs, for example.