pandemonium_engine/modules/web/http/web_root.h

57 lines
1.3 KiB
C++
Raw Normal View History

#ifndef WEB_ROOT_H
#define WEB_ROOT_H
#include "core/containers/hash_map.h"
2022-06-27 01:15:01 +02:00
#include "core/os/mutex.h"
#include "core/ustring.h"
#include "core/containers/vector.h"
#include "web_node.h"
2022-06-27 01:15:01 +02:00
#include "web_server_middleware.h"
2022-06-27 01:15:01 +02:00
class WebServerRequest;
class FileCache;
class WebRoot : public WebNode {
2022-06-27 01:15:01 +02:00
GDCLASS(WebRoot, WebNode);
public:
String get_www_root_path();
void set_www_root_path(const String &val);
Ref<FileCache> get_www_root_file_cache();
Vector<Variant> get_middlewares();
void set_middlewares(const Vector<Variant> &data);
2022-06-27 01:15:01 +02:00
void _handle_request_main(Ref<WebServerRequest> request);
void _handle_error_send_request(Ref<WebServerRequest> request, const int error_code);
2022-06-27 01:15:01 +02:00
bool process_middlewares(Ref<WebServerRequest> request);
bool try_send_wwwroot_file(Ref<WebServerRequest> request);
void send_file(const String &path, Ref<WebServerRequest> request);
2022-06-27 01:15:01 +02:00
void register_request_update(Ref<WebServerRequest> request);
void unregister_request_update(Ref<WebServerRequest> request);
WebRoot();
2022-06-27 01:15:01 +02:00
~WebRoot();
2022-06-26 15:00:25 +02:00
Vector<Ref<WebServerMiddleware>> _middlewares;
protected:
void _notification(int p_what);
static void _bind_methods();
2022-06-27 01:15:01 +02:00
Mutex _update_registered_requests_mutex;
Vector<Ref<WebServerRequest>> _update_registered_requests;
String _www_root_path;
Ref<FileCache> _www_root_file_cache;
};
2022-06-26 15:00:25 +02:00
#endif