Added a new Middleware class.

This commit is contained in:
Relintai 2022-01-08 12:05:33 +01:00
parent d873312915
commit ef18e705f4
3 changed files with 36 additions and 0 deletions

14
core/http/middleware.cpp Normal file
View File

@ -0,0 +1,14 @@
#include "middleware.h"
#include "request.h"
bool Middleware::on_before_handle_request_main(Request *request) {
return false;
}
Middleware::Middleware() {
}
Middleware::~Middleware() {
}

21
core/http/middleware.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef MIDDLEWARE_H
#define MIDDLEWARE_H
#include "core/string.h"
#include "core/reference.h"
class Request;
class Middleware : public Reference {
RCPP_OBJECT(Middleware, Reference);
public:
//returnring true means handled, false, means continue
virtual bool on_before_handle_request_main(Request *request);
Middleware();
~Middleware();
};
#endif

View File

@ -24,6 +24,7 @@ class Request;
//Update the rest of the modules to the new systems
//remove middleware stack from request
class WebRoot : public WebRouterNode {
RCPP_OBJECT(WebRoot, WebRouterNode);