Open Lighting Architecture
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
ola::http::HTTPServer Class Reference
Inheritance diagram for ola::http::HTTPServer:
ola::thread::Thread

Classes

struct  HTTPServerOptions
struct  static_file_info

Public Types

typedef ola::Callback2< int,
const HTTPRequest
*, HTTPResponse * > 
BaseHTTPCallback

Public Member Functions

 HTTPServer (const HTTPServerOptions &options)
bool Init ()
void * Run ()
void Stop ()
void UpdateSockets ()
void HandleHTTPIO ()
int DispatchRequest (const HTTPRequest *request, HTTPResponse *response)
bool RegisterHandler (const string &path, BaseHTTPCallback *handler)
bool RegisterFile (const string &path, const string &content_type)
bool RegisterFile (const string &path, const string &file, const string &content_type)
void RegisterDefaultHandler (BaseHTTPCallback *handler)
void Handlers (vector< string > *handlers) const
const string DataDir () const
int ServeError (HTTPResponse *response, const string &details="")
int ServeNotFound (HTTPResponse *response)
int ServeStaticContent (const string &path, const string &content_type, HTTPResponse *response)
ola::io::SelectServerSelectServer ()
- Public Member Functions inherited from ola::thread::Thread
virtual bool Start ()
virtual bool FastStart ()
virtual bool Join (void *ptr=NULL)
bool IsRunning ()
ThreadId Id () const
void * _InternalRun ()

Static Public Member Functions

static int ServeRedirect (HTTPResponse *response, const string &location)
- Static Public Member Functions inherited from ola::thread::Thread
static ThreadId Self ()

Static Public Attributes

static const char CONTENT_TYPE_PLAIN [] = "text/plain"
static const char CONTENT_TYPE_HTML [] = "text/html"
static const char CONTENT_TYPE_GIF [] = "image/gif"
static const char CONTENT_TYPE_PNG [] = "image/png"
static const char CONTENT_TYPE_CSS [] = "text/css"
static const char CONTENT_TYPE_JS [] = "text/javascript"

Member Function Documentation

void ola::http::HTTPServer::HandleHTTPIO ( )
inline

Called when there is HTTP IO activity to deal with. This is a noop as MHD_run is called in UpdateSockets above.

void * ola::http::HTTPServer::Run ( )
virtual

The entry point into the new thread

Implements ola::thread::Thread.

int ola::http::HTTPServer::ServeStaticContent ( const string &  path,
const string &  content_type,
HTTPResponse response 
)

Return the contents of a file

void ola::http::HTTPServer::UpdateSockets ( )

This is run every loop iteration to update the list of sockets in the SelectServer from MHD.


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