Web framework C++
2.0.0
Simple web framework on c++ designed to easily create web pages, etc
|
object of this class executes every time on new request, this object (and others) construct response to client More...
#include <handler.h>
Public Member Functions | |
Handler (const char *route=nullptr, HTTP::Method method=HTTP::Method::ANY, Handler *next=nullptr) | |
virtual | ~Handler () |
virtual void | setNext (Handler *next) |
virtual void | add (Handler *handler) |
bool | isRouted () |
std::string | getRoute () |
HTTP::Method | getMethod () |
void | setContext (Context *context) |
void | handleRequest () |
virtual void | exec ()=0 |
Protected Member Functions | |
Context * | getContext () |
object of this class executes every time on new request, this object (and others) construct response to client
Handler object can be common (will execute on every response) or adjusted to some specified uri path. It can get all info about request, use added middleware, and make response
|
explicit |
create handler with params: common or routed one
route | uri path route, if null - handler will be common |
method | uri method, if ANY will be executed on any methods |
|
virtual |
destructs local variables
|
virtual |
add handler to end of current chain
handler | Handler object |
Reimplemented in AuthorizedHandler.
|
pure virtual |
this method will be executed on every request (or uri path if set)
Implemented in AuthorizedHandler, and FileHandler.
HTTP::Method Handler::getMethod | ( | ) |
std::string Handler::getRoute | ( | ) |
get route of handler
void Handler::handleRequest | ( | ) |
if method shouldHandleRequest returns true, method exec is executed and if there is a next handler, call method handleRequest
bool Handler::isRouted | ( | ) |
check, if route is set
|
virtual |