Drizzled Public API Documentation

drizzle_plugin::json_server::HttpHandler Class Reference

#include <http_handler.h>

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

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

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

Generate a error occurs using DROP Table command.

Definition at line 128 of file http_handler.cc.

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

Generate a http error when table is null.

Definition at line 120 of file http_handler.cc.

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.

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.

Referenced by drizzle_plugin::json_server::process_json_req().

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.

Referenced by drizzle_plugin::json_server::process_json_req().

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.

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.

Referenced by drizzle_plugin::json_server::process_json_req().

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.

Referenced by drizzle_plugin::json_server::process_json_req().

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.

Referenced by drizzle_plugin::json_server::process_json_req().

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

Send http response back.

Parameters
json_outa Json::Value object.

Definition at line 136 of file http_handler.cc.

References Json::StyledWriter::write().

Referenced by drizzle_plugin::json_server::process_json_req().

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.

Referenced by drizzle_plugin::json_server::process_json_req().

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.

References Json::Reader::getFormatedErrorMessages(), and Json::Reader::parse().

Referenced by drizzle_plugin::json_server::process_json_req().

Member Data Documentation

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

Stores http response code.

Definition at line 174 of file http_handler.h.

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

Stores http response text.

Definition at line 178 of file http_handler.h.

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::Value drizzle_plugin::json_server::HttpHandler::_json_in
private

Stores input json object.

Definition at line 170 of file http_handler.h.

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

Stores output json object.

Definition at line 166 of file http_handler.h.

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

Stores query being used.

Definition at line 158 of file http_handler.h.

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

Stores http request object.

Definition at line 182 of file http_handler.h.

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

Stores schema being used.

Definition at line 150 of file http_handler.h.

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: