Nebula
Loading...
Searching...
No Matches
httprequesthandler.h
Go to the documentation of this file.
1#pragma once
2#ifndef HTTP_HTTPREQUESTHANDLER_H
3#define HTTP_HTTPREQUESTHANDLER_H
4//------------------------------------------------------------------------------
21#include "core/refcounted.h"
22#include "http/httprequest.h"
23
24#include "util/string.h"
25#include "threading/safequeue.h"
26
27//------------------------------------------------------------------------------
28namespace Http
29{
69
70//------------------------------------------------------------------------------
73inline void
75{
76 this->name = n;
77}
78
79//------------------------------------------------------------------------------
82inline const Util::String&
84{
85 return this->name;
86}
87
88//------------------------------------------------------------------------------
91inline void
93{
94 this->desc = d;
95}
96
97//------------------------------------------------------------------------------
100inline const Util::String&
102{
103 return this->desc;
104}
105
106//------------------------------------------------------------------------------
109inline void
114
115//------------------------------------------------------------------------------
118inline const Util::String&
120{
121 return this->rootLocation;
122}
123
124} // namespace Http
125//------------------------------------------------------------------------------
126#endif
127
The common base class of Nebula.
Definition refcounted.h:38
HttpRequestHandlers are attached to the HttpServer and process incoming HTTP requests.
Definition httprequesthandler.h:31
void HandlePendingRequests()
handle all pending requests, called by local-thread's HttpServerProxy
Definition httprequesthandler.cc:51
void SetDesc(const Util::String &d)
set human readable description
Definition httprequesthandler.h:92
const Util::String & GetRootLocation() const
get a resource location path which is accepted by the handler (e.g. "/display")
Definition httprequesthandler.h:119
Util::String desc
Definition httprequesthandler.h:64
Util::Array< Ptr< HttpRequest > > curWorkRequests
Definition httprequesthandler.h:67
void SetRootLocation(const Util::String &l)
set the root location of the request handler
Definition httprequesthandler.h:110
virtual ~HttpRequestHandler()
destructor
Definition httprequesthandler.cc:27
const Util::String & GetDesc() const
get a human readable description of the request handler
Definition httprequesthandler.h:101
Threading::SafeQueue< Ptr< HttpRequest > > pendingRequests
Definition httprequesthandler.h:66
virtual void HandleRequest(const Ptr< HttpRequest > &request)
handle a http request, overwrite this method in you subclass
Definition httprequesthandler.cc:73
void SetName(const Util::String &n)
set human readable name of the request handler
Definition httprequesthandler.h:74
void PutRequest(const Ptr< HttpRequest > &httpRequest)
put a request to the pending queue, called by HttpServer thread
Definition httprequesthandler.cc:39
HttpRequestHandler()
constructor
Definition httprequesthandler.cc:19
Util::String rootLocation
Definition httprequesthandler.h:65
const Util::String & GetName() const
get a human readable name of the request handler
Definition httprequesthandler.h:83
Util::String name
Definition httprequesthandler.h:63
__DeclareClass(HttpRequestHandler)
Implements an extremly simple standalone HTTP server with attached HttpRequestHandlers.
Definition httpserver.h:29
Client-side proxy of the HttpServer.
Definition httpserverproxy.h:26
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Thread-safe version of Util::Queue.
Definition safequeue.h:27
Nebula's dynamic array class.
Definition array.h:60
This file was generated with Nebula Trifid's idlc compiler tool.
Definition defaulthttprequesthandler.cc:15
Nebula's universal string class.
Definition String.cs:8