mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-14 04:57:21 +01:00
Moved get_server from WebRoot to WebNode.
This commit is contained in:
parent
f00e5c5c9e
commit
d873312915
@ -1,10 +1,11 @@
|
||||
|
||||
#include "web_node.h"
|
||||
|
||||
#include "request.h"
|
||||
#include "http_enums.h"
|
||||
#include "request.h"
|
||||
|
||||
#include "core/settings/settings.h"
|
||||
#include "core/http/web_server.h"
|
||||
|
||||
#ifdef DATABASES_ENABLED
|
||||
#include "core/database/database.h"
|
||||
@ -72,8 +73,8 @@ void WebNode::handle_request_main(Request *request) {
|
||||
}
|
||||
|
||||
void WebNode::handle_error_send_request(Request *request, const int error_code) {
|
||||
//this is a fallback error handler.
|
||||
//Webroot implements a proper one
|
||||
// this is a fallback error handler.
|
||||
// Webroot implements a proper one
|
||||
request->compiled_body = "<html><body>Internal server error!</body></html>";
|
||||
request->set_status_code(HTTP_STATUS_CODE_503_SERVICE_UNAVAILABLE);
|
||||
request->send();
|
||||
@ -94,6 +95,11 @@ void WebNode::migrate() {
|
||||
void WebNode::create_default_entries() {
|
||||
}
|
||||
|
||||
WebServer *WebNode::get_server() {
|
||||
// todo this shoult probably be cached
|
||||
return Object::cast_to<WebServer>(get_tree());
|
||||
}
|
||||
|
||||
WebNode::WebNode() :
|
||||
Node() {
|
||||
// should look this up in parents when parented (and node parenting is implemented)
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
class Request;
|
||||
class Settings;
|
||||
class WebServer;
|
||||
|
||||
#ifdef DATABASES_ENABLED
|
||||
class DataBase;
|
||||
@ -41,6 +42,8 @@ public:
|
||||
virtual void migrate();
|
||||
virtual void create_default_entries();
|
||||
|
||||
WebServer *get_server();
|
||||
|
||||
WebNode();
|
||||
~WebNode();
|
||||
|
||||
|
@ -12,8 +12,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "core/http/web_server.h"
|
||||
|
||||
void WebRoot::load_settings() {
|
||||
}
|
||||
|
||||
@ -165,11 +163,6 @@ void WebRoot::update() {
|
||||
}
|
||||
}
|
||||
|
||||
WebServer *WebRoot::get_server() {
|
||||
// todo this shoult probably be cached
|
||||
return Object::cast_to<WebServer>(get_tree());
|
||||
}
|
||||
|
||||
WebRoot::WebRoot() :
|
||||
WebRouterNode() {
|
||||
}
|
||||
|
@ -12,21 +12,19 @@
|
||||
#include "handler_instance.h"
|
||||
|
||||
class Request;
|
||||
class WebServer;
|
||||
|
||||
//Middleware turn into a class (reference)
|
||||
//add them to a folder
|
||||
//method should return bool -> true to continue, false if done
|
||||
|
||||
//Error handlers
|
||||
//Add to WebNode api -> send_error(code) v handle_error_send_request(request, int error, variant additional data ?);
|
||||
//have generic one implemented by default
|
||||
//Webroot overrides -> uses same logic as now
|
||||
|
||||
//notification -> variant additional data?
|
||||
|
||||
//FileCache -> set up, for this webroot, don't use singleton
|
||||
|
||||
//clean up unused things here
|
||||
//remove handler instances!
|
||||
|
||||
//Update the rest of the modules to the new systems
|
||||
|
||||
|
||||
class WebRoot : public WebRouterNode {
|
||||
RCPP_OBJECT(WebRoot, WebRouterNode);
|
||||
|
||||
@ -56,8 +54,6 @@ public:
|
||||
void unregister_request_update(Request *request);
|
||||
void update();
|
||||
|
||||
WebServer *get_server();
|
||||
|
||||
WebRoot();
|
||||
virtual ~WebRoot();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user