Adaptive Framework
0.9.0
|
Files | |
file | afw_request.h |
Header for interface afw_request* helpers. | |
Macros | |
#define | AFW_REQUEST_Q_PN_CONTENT_TYPE AFW_Q_CONTENT_TYPE |
Request property name CONTENT_TYPE quoted string. More... | |
#define | AFW_REQUEST_s_PN_CONTENT_TYPE afw_s_CONTENT_TYPE |
Request property name CONTENT_TYPE afw_utf8_t. More... | |
#define | AFW_REQUEST_Q_PN_CONTENT_LENGTH AFW_Q_CONTENT_LENGTH |
Request property name CONTENT_LENGTH quoted string. More... | |
#define | AFW_REQUEST_s_PN_CONTENT_LENGTH afw_s_CONTENT_LENGTH |
Request property name CONTENT_LENGTH afw_utf8_t. More... | |
#define | AFW_REQUEST_Q_PN_HTTP_ACCEPT AFW_Q_HTTP_ACCEPT |
Request property name HTTP_ACCEPT quoted string. | |
#define | AFW_REQUEST_s_PN_HTTP_ACCEPT afw_s_HTTP_ACCEPT |
Request property name HTTP_ACCEPT afw_utf8_t. | |
#define | AFW_REQUEST_Q_PN_PATH_INFO AFW_Q_PATH_INFO |
Request property name PATH_INFO quoted string. More... | |
#define | AFW_REQUEST_s_PN_PATH_INFO afw_s_PATH_INFO |
Request property name PATH_INFO afw_utf8_t. More... | |
#define | AFW_REQUEST_Q_PN_QUERY_STRING AFW_Q_QUERY_STRING |
Request property name QUERY_STRING quoted string. More... | |
#define | AFW_REQUEST_s_PN_QUERY_STRING afw_s_QUERY_STRING |
Request property name QUERY_STRING afw_utf8_t. More... | |
#define | AFW_REQUEST_Q_PN_REQUEST_METHOD AFW_Q_REQUEST_METHOD |
Request property name REQUEST_METHOD quoted string. More... | |
#define | AFW_REQUEST_s_PN_REQUEST_METHOD afw_s_REQUEST_METHOD |
Request accept header REQUEST_METHOD afw_utf8_t. More... | |
#define | AFW_REQUEST_Q_PN_REQUEST_URI AFW_Q_REQUEST_URI |
Request property name REQUEST_URI quoted string. More... | |
#define | AFW_REQUEST_s_PN_REQUEST_URI afw_s_REQUEST_URI |
Request property name REQUEST_URI afw_utf8_t. More... | |
#define | AFW_REQUEST_Q_METHOD_GET AFW_Q_GET |
Request method GET quoted string. | |
#define | AFW_REQUEST_s_METHOD_GET afw_s_GET |
Request method GET afw_utf8_t. | |
#define | AFW_REQUEST_Q_METHOD_POST AFW_Q_POST |
#define | AFW_REQUEST_s_METHOD_POST afw_s_POST |
#define | AFW_REQUEST_Q_METHOD_PUT AFW_Q_PUT |
#define | AFW_REQUEST_s_METHOD_PUT afw_s_PUT |
#define | AFW_REQUEST_Q_METHOD_PATCH AFW_Q_PATCH |
#define | AFW_REQUEST_s_METHOD_PATCH afw_s_PATCH |
#define | AFW_REQUEST_Q_METHOD_DELETE AFW_Q_DELETE |
#define | AFW_REQUEST_s_METHOD_DELETE afw_s_DELETE |
Typedefs | |
typedef enum afw_request_state_e | afw_request_state_t |
Enumerations | |
enum | afw_request_state_e { afw_request_state_initial , afw_request_state_content_read , afw_request_state_status_set , afw_request_state_header_written , afw_request_state_response_written , afw_request_state_response_finished } |
Functions | |
const afw_utf8_t * | afw_request_body_to_utf8 (const afw_request_t *instance, const afw_pool_t *p, afw_xctx_t *xctx) |
Read a request body into a utf-8 string in a specifed pool. More... | |
const afw_value_t * | afw_request_body_to_value (const afw_request_t *instance, const afw_pool_t *p, afw_xctx_t *xctx) |
Read a request body to value in a specifed pool. More... | |
afw_request_get_response_content_type (const afw_request_t *instance, const afw_content_type_t **response_content_type, const afw_utf8_t **type, const afw_utf8_t **type_parameter, afw_xctx_t *xctx) | |
const afw_content_type_t * | afw_request_prepare_response_content_type (const afw_request_t *instance, afw_xctx_t *xctx) |
afw_request_response_body_raw_writer_create (const afw_request_t *request, afw_xctx_t *xctx) | |
void | afw_request_write_value_to_response_body (const afw_request_t *instance, const afw_value_t *value, const afw_object_options_t *options, afw_xctx_t *xctx) |
Write value to response body. More... | |
void | afw_request_write_error_to_response_body (const afw_request_t *instance, const afw_utf8_t *code, const afw_error_t *error, afw_xctx_t *xctx) |
Write xctx error to response body. More... | |
void | afw_request_write_success_response (const afw_request_t *instance, const afw_object_t *response, afw_xctx_t *xctx) |
Write simple success to response body. More... | |
Provide afw_request interface common support.
#define AFW_REQUEST_Q_METHOD_DELETE AFW_Q_DELETE |
Request method DELETE quoted string.
Definition at line 147 of file afw_request.h.
#define AFW_REQUEST_Q_METHOD_PATCH AFW_Q_PATCH |
Request method PATCH quoted string.
Definition at line 141 of file afw_request.h.
#define AFW_REQUEST_Q_METHOD_POST AFW_Q_POST |
Request method POST quoted string.
Definition at line 129 of file afw_request.h.
#define AFW_REQUEST_Q_METHOD_PUT AFW_Q_PUT |
Request method PUT quoted string.
Definition at line 135 of file afw_request.h.
#define AFW_REQUEST_Q_PN_CONTENT_LENGTH AFW_Q_CONTENT_LENGTH |
Request property name CONTENT_LENGTH quoted string.
The content length of the request, if available.
Definition at line 46 of file afw_request.h.
#define AFW_REQUEST_Q_PN_CONTENT_TYPE AFW_Q_CONTENT_TYPE |
Request property name CONTENT_TYPE quoted string.
The content type of the request.
Definition at line 34 of file afw_request.h.
#define AFW_REQUEST_Q_PN_PATH_INFO AFW_Q_PATH_INFO |
Request property name PATH_INFO quoted string.
The query string.
Definition at line 69 of file afw_request.h.
#define AFW_REQUEST_Q_PN_QUERY_STRING AFW_Q_QUERY_STRING |
Request property name QUERY_STRING quoted string.
The query string.
Definition at line 83 of file afw_request.h.
#define AFW_REQUEST_Q_PN_REQUEST_METHOD AFW_Q_REQUEST_METHOD |
Request property name REQUEST_METHOD quoted string.
The http method of the request. Usually, "GET", "POST", "PUT", "PATCH", or "DELETE".
Definition at line 98 of file afw_request.h.
#define AFW_REQUEST_Q_PN_REQUEST_URI AFW_Q_REQUEST_URI |
Request property name REQUEST_URI quoted string.
The query string.
Definition at line 113 of file afw_request.h.
#define AFW_REQUEST_s_METHOD_DELETE afw_s_DELETE |
Request method DELETE afw_utf8_t.
Definition at line 150 of file afw_request.h.
#define AFW_REQUEST_s_METHOD_PATCH afw_s_PATCH |
Request method PATCH afw_utf8_t.
Definition at line 144 of file afw_request.h.
#define AFW_REQUEST_s_METHOD_POST afw_s_POST |
Request method POST afw_utf8_t.
Definition at line 132 of file afw_request.h.
#define AFW_REQUEST_s_METHOD_PUT afw_s_PUT |
Request method PUT afw_utf8_t.
Definition at line 138 of file afw_request.h.
#define AFW_REQUEST_s_PN_CONTENT_LENGTH afw_s_CONTENT_LENGTH |
Request property name CONTENT_LENGTH afw_utf8_t.
The content length of the request, if available.
Definition at line 52 of file afw_request.h.
#define AFW_REQUEST_s_PN_CONTENT_TYPE afw_s_CONTENT_TYPE |
Request property name CONTENT_TYPE afw_utf8_t.
The content type of the request.
Definition at line 40 of file afw_request.h.
#define AFW_REQUEST_s_PN_PATH_INFO afw_s_PATH_INFO |
Request property name PATH_INFO afw_utf8_t.
The query string.
Definition at line 76 of file afw_request.h.
#define AFW_REQUEST_s_PN_QUERY_STRING afw_s_QUERY_STRING |
Request property name QUERY_STRING afw_utf8_t.
The query string.
Definition at line 90 of file afw_request.h.
#define AFW_REQUEST_s_PN_REQUEST_METHOD afw_s_REQUEST_METHOD |
Request accept header REQUEST_METHOD afw_utf8_t.
The http method of the request. Usually, "GET", "POST", "PUT", "PATCH", or "DELETE".
Definition at line 106 of file afw_request.h.
#define AFW_REQUEST_s_PN_REQUEST_URI afw_s_REQUEST_URI |
Request property name REQUEST_URI afw_utf8_t.
The query string.
Definition at line 120 of file afw_request.h.
typedef enum afw_request_state_e afw_request_state_t |
Request state enum. This CAN be used by implementations of afw_request.
enum afw_request_state_e |
Request state enum. This CAN be used by implementations of afw_request.
Definition at line 154 of file afw_request.h.
const afw_utf8_t* afw_request_body_to_utf8 | ( | const afw_request_t * | instance, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Read a request body into a utf-8 string in a specifed pool.
request | instance |
p | Pool for string. |
xctx | of caller. |
Definition at line 120 of file afw_request.c.
const afw_value_t* afw_request_body_to_value | ( | const afw_request_t * | instance, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Read a request body to value in a specifed pool.
request | instance |
p | Pool for string. |
xctx | of caller. |
The request body is parsed based on content-type header.
Definition at line 149 of file afw_request.c.
void afw_request_write_error_to_response_body | ( | const afw_request_t * | instance, |
const afw_utf8_t * | code, | ||
const afw_error_t * | error, | ||
afw_xctx_t * | xctx | ||
) |
Write xctx error to response body.
request | instance |
http | response code. |
error | to write. |
xctx | of caller. |
This function leaves xctx->error unchanged if it is successful.
Definition at line 216 of file afw_request.c.
void afw_request_write_success_response | ( | const afw_request_t * | instance, |
const afw_object_t * | response, | ||
afw_xctx_t * | xctx | ||
) |
Write simple success to response body.
request | instance |
response | is a memory object where response meta will be added. |
xctx | of caller. |
Definition at line 248 of file afw_request.c.
void afw_request_write_value_to_response_body | ( | const afw_request_t * | instance, |
const afw_value_t * | value, | ||
const afw_object_options_t * | options, | ||
afw_xctx_t * | xctx | ||
) |
Write value to response body.
request | instance |
value | to write. |
options. | |
xctx | of caller. |
The value is converted based on the content-type header and written to the response body.
Definition at line 187 of file afw_request.c.