MetriVis Overview | Download | User Manual | Development
Reference Overview | Design Documentation | Reference Backend | Reference Frontend

metrivis::RequestDispatcher Class Reference

Dispatches a HTTP request. More...

#include <RequestDispatcher.h>

Inheritance diagram for metrivis::RequestDispatcher:

metrivis::Thread metrivis::RawDataDispatcher metrivis::SearchDispatcher metrivis::SQL2JsonDispatcher metrivis::TimeLineDispatcher metrivis::XYPlotDispatcher

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

Pipelinepipeline_
 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.

Detailed Description

Dispatches a HTTP request.

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.

See also:
XYPlotDispatcher

RawDataDispatcher

You will never directly use the RequestDispatcher class but instead work with it's subclasses.

Constructor & Destructor Documentation

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.


Member Function Documentation

void metrivis::RequestDispatcher::set_request_description ( const RequestDescription description  )  [inline]

Interface to memeber variable request_description.

Parameters:
description,: Sets the request description to handle.

const RequestDescription& metrivis::RequestDispatcher::request_description (  )  const [inline]

Interface to memeber variable request_description.

Returns:
The request description handeled by this dispatcher.

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.

Parameters:
image_data,: The PNG image data saved in a string.
Sends an PNG image back to the client. After this call returns, the data will be transmitted and the connection will be closed.

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.

Parameters:
image_data,: The plain text data saved in a string.
Sends a plain text back to the client. After this call returns, the data will be transmitted and the connection will be closed.

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.

Parameters:
image_data,: The http text data saved in a string.
Sends a http formated text back to the client. After this call returns, the data will be transmitted and the connection will be closed.

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.

Parameters:
image_data,: The http text data saved in a string.
Sends a json formated text back to the client. After this call returns, the data will be transmitted and the connection will be closed.

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.

Parameters:
message,: The message to be sent to the client as a string, raw data.
type,: String expressing the HTTP file type.
See header file for overview.


The documentation for this class was generated from the following files:
Generated on Fri Feb 29 16:47:20 2008 for MetriVis by  doxygen 1.5.3