MetriVis | Overview | Download | User Manual | Development |
Reference | Overview | Design Documentation | Reference Backend | Reference Frontend |
#include <RequestDispatcher.h>
Public Member Functions | |
RequestDispatcher (int clone_id) | |
Default constructor. | |
virtual | ~RequestDispatcher () |
Deconstructor. | |
void | set_request_description (const RequestDescription &description) |
Interface to memeber variable request_description. | |
const RequestDescription & | request_description () const |
Interface to memeber variable request_description. | |
Protected Member Functions | |
virtual void | Run () |
Thread internal run function. | |
int | SendHTTPImage (const std::string &image_data) |
Sends a PNG image back to the client as HTTP reply. | |
int | SendHTTPPlainText (const std::string &plain_text) |
Sends a plain text back to the client as HTTP reply. | |
int | SendHTTPText (const std::string &http_text) |
Sends a html formated text back to the client as HTTP reply. | |
int | SendJSONText (const std::string &json_text) |
Sends a JSON text back to the client as HTTP reply. | |
Protected Attributes | |
Pipeline * | pipeline_ |
The pipeline that will be executed in the subclass. | |
RequestDescription | request_description_ |
The HTTP request description. | |
Private Member Functions | |
int | SendHTTPReplyRaw (const std::string &message, const std::string &type) |
Sends a HTTP reply message back to the client. |
MetriVis will use a RequestDispatcher for every type of request that it may handle. HTTPDriver will get the HTTP request, check if there is a handler registered that will send the request to this RequestDispatcher class.
If you want to handle your own HTTP request you will want to create a subclass from this RequestDispatcher.
metrivis::RequestDispatcher::RequestDispatcher | ( | int | clone_id | ) |
Default constructor.
Doesn't do anything.
Default constructor. See header file for overview.
metrivis::RequestDispatcher::~RequestDispatcher | ( | ) | [virtual] |
Deconstructor.
Doesn't do anything.
Grounds all variables to initial values to minimize lucky post-mortem usage. See header file for overview.
void metrivis::RequestDispatcher::set_request_description | ( | const RequestDescription & | description | ) | [inline] |
Interface to memeber variable request_description.
description,: | Sets the request description to handle. |
const RequestDescription& metrivis::RequestDispatcher::request_description | ( | ) | const [inline] |
Interface to memeber variable request_description.
void metrivis::RequestDispatcher::Run | ( | ) | [protected, virtual] |
Thread internal run function.
Doesn't do anything. Overload in subclasses.
See header file for overview.
Implements metrivis::Thread.
Reimplemented in metrivis::RawDataDispatcher, metrivis::SearchDispatcher, metrivis::SQL2JsonDispatcher, metrivis::TimeLineDispatcher, and metrivis::XYPlotDispatcher.
int metrivis::RequestDispatcher::SendHTTPImage | ( | const std::string & | image_data | ) | [protected] |
Sends a PNG image back to the client as HTTP reply.
image_data,: | The PNG image data saved in a string. |
See header file for overview.
int metrivis::RequestDispatcher::SendHTTPPlainText | ( | const std::string & | plain_text | ) | [protected] |
Sends a plain text back to the client as HTTP reply.
image_data,: | The plain text data saved in a string. |
See header file for overview.
int metrivis::RequestDispatcher::SendHTTPText | ( | const std::string & | http_text | ) | [protected] |
Sends a html formated text back to the client as HTTP reply.
image_data,: | The http text data saved in a string. |
See header file for overview.
int metrivis::RequestDispatcher::SendJSONText | ( | const std::string & | json_text | ) | [protected] |
Sends a JSON text back to the client as HTTP reply.
image_data,: | The http text data saved in a string. |
See header file for overview.
int metrivis::RequestDispatcher::SendHTTPReplyRaw | ( | const std::string & | message, | |
const std::string & | type | |||
) | [private] |
Sends a HTTP reply message back to the client.
message,: | The message to be sent to the client as a string, raw data. | |
type,: | String expressing the HTTP file type. |