pandemonium_engine/modules/web/doc_classes/WebRoot.xml

64 lines
3.0 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<class name="WebRoot" inherits="WebNode" version="3.12">
<brief_description>
</brief_description>
<description>
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.
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.
</description>
<tutorials>
</tutorials>
<methods>
<method name="process_middlewares">
<return type="bool" />
<argument index="0" name="request" type="WebServerRequest" />
<description>
Processes the [WebServerRequest] using registered [WebServerMiddleware].
</description>
</method>
<method name="register_request_update">
<return type="void" />
<argument index="0" name="request" type="WebServerRequest" />
<description>
Registers the [WebServerRequest], to receive update notifications.
</description>
</method>
<method name="send_file">
<return type="void" />
<argument index="0" name="path" type="String" />
<argument index="1" name="request" type="WebServerRequest" />
<description>
Helper method to easily sends files from the wwwroot.
</description>
</method>
<method name="try_send_wwwroot_file">
<return type="bool" />
<argument index="0" name="request" type="WebServerRequest" />
<description>
Helper method that tries to send files from the wwwroot, if the file doesn't exists, returns false.
</description>
</method>
<method name="unregister_request_update">
<return type="void" />
<argument index="0" name="request" type="WebServerRequest" />
<description>
Unregisters the [WebServerRequest], so it doesn't receive update notifications anymore.
</description>
</method>
</methods>
<members>
<member name="middlewares" type="Array" setter="set_middlewares" getter="get_middlewares" default="[ ]">
The registered [WebServerMiddleware]s.
</member>
<member name="www_root_file_cache" type="FileCache" setter="" getter="get_www_root_file_cache">
You can get the underlying [FileCache], that is used for handling the wwwroot.
</member>
<member name="www_root_path" type="String" setter="set_www_root_path" getter="get_www_root_path" default="&quot;&quot;">
The wwwroot's path.
</member>
</members>
<constants>
</constants>
</class>