drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
drizzle_plugin::json_server::HttpHandler Class Reference

#include <http_handler.h>

Collaboration diagram for drizzle_plugin::json_server::HttpHandler:
[legend]

Public Member Functions

 HttpHandler (Json::Value &json_out, Json::Value json_in, struct evhttp_request *req)
bool handleRequest ()
bool validate (string &default_schema, string &default_table, bool allow_drop_table)
void sendResponse ()
void generateHttpError ()
void generateDropTableError ()
const char * getSchema () const
const char * getTable () const
const string & getQuery () const
const char * getId () const
const Json::Value getOutputJson () const
const Json::Value getInputJson () const
void setOutputJson (Json::Value &json_out)

Private Attributes

const char * _schema
const char * _table
string _query
const char * _id
Json::Value _json_out
Json::Value _json_in
int _http_response_code
const char * _http_response_text
struct evhttp_request * _req

Detailed Description

a class. used to handles http request and response.

Definition at line 46 of file http_handler.h.

Constructor & Destructor Documentation

◆ HttpHandler()

drizzle_plugin::json_server::HttpHandler::HttpHandler ( Json::Value & json_out,
Json::Value json_in,
struct evhttp_request * req )

Constructor

Parameters
json_outan empty json output object.
json_inan empty json input object.
reqthe http request object to parse.

Definition at line 31 of file http_handler.cc.

Member Function Documentation

◆ generateDropTableError()

void drizzle_plugin::json_server::HttpHandler::generateDropTableError ( )

Generate a error occurs using DROP Table command.

Definition at line 139 of file http_handler.cc.

◆ generateHttpError()

void drizzle_plugin::json_server::HttpHandler::generateHttpError ( )

Generate a http error when table is null.

Definition at line 131 of file http_handler.cc.

◆ getId()

const char * drizzle_plugin::json_server::HttpHandler::getId ( ) const
inline

Get id being used.

Returns
a constant id string.

Definition at line 117 of file http_handler.h.

◆ getInputJson()

const Json::Value drizzle_plugin::json_server::HttpHandler::getInputJson ( ) const
inline

Get input json object.

Returns
a constant json object.

Definition at line 133 of file http_handler.h.

◆ getOutputJson()

const Json::Value drizzle_plugin::json_server::HttpHandler::getOutputJson ( ) const
inline

Get output json object.

Returns
a constant json object.

Definition at line 125 of file http_handler.h.

◆ getQuery()

const string & drizzle_plugin::json_server::HttpHandler::getQuery ( ) const
inline

Get query being used.

Returns
a constant query string.

Definition at line 109 of file http_handler.h.

◆ getSchema()

const char * drizzle_plugin::json_server::HttpHandler::getSchema ( ) const
inline

Get schema being used.

Returns
a constant schema string.

Definition at line 92 of file http_handler.h.

◆ getTable()

const char * drizzle_plugin::json_server::HttpHandler::getTable ( ) const
inline

Get table being used.

Returns
a constant table string.

Definition at line 101 of file http_handler.h.

◆ handleRequest()

bool drizzle_plugin::json_server::HttpHandler::handleRequest ( )

Parse http request and retrieve various http headers.

Returns
false Success
true Failure

Definition at line 44 of file http_handler.cc.

◆ sendResponse()

void drizzle_plugin::json_server::HttpHandler::sendResponse ( )

Send http response back.

Parameters
json_outa Json::Value object.

Definition at line 147 of file http_handler.cc.

◆ setOutputJson()

void drizzle_plugin::json_server::HttpHandler::setOutputJson ( Json::Value & json_out)
inline

Set Output json object.

Parameters
json_outa Json::Value object.

Definition at line 141 of file http_handler.h.

◆ validate()

bool drizzle_plugin::json_server::HttpHandler::validate ( string & default_schema,
string & default_table,
bool allow_drop_table )

Parse input json query and generate input json object.

Parameters
default_schemaa string.
default_tablea string.
allow_drop_tablea boolean value.
Returns
false Success.
true Failure.

Definition at line 76 of file http_handler.cc.

Member Data Documentation

◆ _http_response_code

int drizzle_plugin::json_server::HttpHandler::_http_response_code
private

Stores http response code.

Definition at line 174 of file http_handler.h.

◆ _http_response_text

const char* drizzle_plugin::json_server::HttpHandler::_http_response_text
private

Stores http response text.

Definition at line 178 of file http_handler.h.

◆ _id

const char* drizzle_plugin::json_server::HttpHandler::_id
private

Stores id primary key for a dcument.

Definition at line 162 of file http_handler.h.

◆ _json_in

Json::Value drizzle_plugin::json_server::HttpHandler::_json_in
private

Stores input json object.

Definition at line 170 of file http_handler.h.

◆ _json_out

Json::Value drizzle_plugin::json_server::HttpHandler::_json_out
private

Stores output json object.

Definition at line 166 of file http_handler.h.

◆ _query

string drizzle_plugin::json_server::HttpHandler::_query
private

Stores query being used.

Definition at line 158 of file http_handler.h.

◆ _req

struct evhttp_request* drizzle_plugin::json_server::HttpHandler::_req
private

Stores http request object.

Definition at line 182 of file http_handler.h.

◆ _schema

const char* drizzle_plugin::json_server::HttpHandler::_schema
private

Stores schema being used.

Definition at line 150 of file http_handler.h.

◆ _table

const char* drizzle_plugin::json_server::HttpHandler::_table
private

Stores table being used.

Definition at line 154 of file http_handler.h.


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