pandemonium_engine/modules/web/doc_classes/WebRoot.xml

64 lines
3.0 KiB
XML
Raw Normal View History

2022-08-21 00:40:49 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-06-13 17:34:41 +02:00
<class name="WebRoot" inherits="WebNode" version="3.12">
2022-08-21 00:40:49 +02:00
<brief_description>
</brief_description>
<description>
2022-08-21 17:13:06 +02:00
It adds some functionality over [WebNode]s that you need for functional websites, like wwwroot handling, Middleware support, and also requests can register themselves to be notified in case they need to do some special tasks.
When a request is received, WebRoot goes through all it's registered [WebServerMiddleware] in order, and call their on_before_handle_request_main() method. If it returns true that means the middleware ended up handling that request, which means the request should not be processed further. This usually means that the Middleware sent an error.
2022-12-22 19:51:25 +01:00
If none of the [WebServerMiddleware]s handled the request, then routing begins. At first it will check if the request matches a file from the given wwwroot, if not, then it will use the default [WebNode] routing, except the only difference, is that if a [WebRoot]s has a [WebNode] child with it's uri_segment set to "/" (without quotes), that will be used as the root [WebNode], instead of itself.
2022-08-21 00:40:49 +02:00
</description>
<tutorials>
</tutorials>
<methods>
<method name="process_middlewares">
<return type="bool" />
<argument index="0" name="request" type="WebServerRequest" />
<description>
2022-08-21 18:24:36 +02:00
Processes the [WebServerRequest] using registered [WebServerMiddleware].
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name="register_request_update">
<return type="void" />
<argument index="0" name="request" type="WebServerRequest" />
<description>
2022-08-21 17:13:06 +02:00
Registers the [WebServerRequest], to receive update notifications.
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name="send_file">
<return type="void" />
<argument index="0" name="path" type="String" />
<argument index="1" name="request" type="WebServerRequest" />
<description>
2022-08-21 17:13:06 +02:00
Helper method to easily sends files from the wwwroot.
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name="try_send_wwwroot_file">
<return type="bool" />
<argument index="0" name="request" type="WebServerRequest" />
<description>
2022-08-21 17:13:06 +02:00
Helper method that tries to send files from the wwwroot, if the file doesn't exists, returns false.
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name="unregister_request_update">
<return type="void" />
<argument index="0" name="request" type="WebServerRequest" />
<description>
2022-08-21 18:24:36 +02:00
Unregisters the [WebServerRequest], so it doesn't receive update notifications anymore.
2022-08-21 00:40:49 +02:00
</description>
</method>
</methods>
<members>
<member name="middlewares" type="Array" setter="set_middlewares" getter="get_middlewares" default="[ ]">
2022-08-21 17:13:06 +02:00
The registered [WebServerMiddleware]s.
2022-08-21 00:40:49 +02:00
</member>
<member name="www_root_file_cache" type="FileCache" setter="" getter="get_www_root_file_cache">
2022-08-21 17:13:06 +02:00
You can get the underlying [FileCache], that is used for handling the wwwroot.
2022-08-21 00:40:49 +02:00
</member>
<member name="www_root_path" type="String" setter="set_www_root_path" getter="get_www_root_path" default="&quot;&quot;">
2022-08-21 17:13:06 +02:00
The wwwroot's path.
2022-08-21 00:40:49 +02:00
</member>
</members>
<constants>
</constants>
</class>