pandemonium_engine/modules/web/doc_classes/WebServerMiddleware.xml

30 lines
1.9 KiB
XML
Raw Normal View History

2022-08-21 00:40:49 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-08-26 22:41:21 +02:00
<class name="WebServerMiddleware" inherits="Resource" version="4.1">
2022-08-21 00:40:49 +02:00
<brief_description>
</brief_description>
<description>
2022-08-21 17:31:01 +02:00
[WebRoot] uses these to preprocess requests. They can do various tasks ranging from setting up session variables, querying data from a database, collect usage information, or to block a non admin user from accessing an admin only section of the site (Note that [WebPermission]s are better suited for this purpose though.)
When a request is received [WebRoot] (if it's used for a particular server) will go through all of it's registered Middlewares 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-08-21 00:40:49 +02:00
</description>
<tutorials>
</tutorials>
<methods>
<method name="_on_before_handle_request_main" qualifiers="virtual">
<return type="void" />
<argument index="0" name="request" type="WebServerRequest" />
<description>
2022-08-23 13:09:12 +02:00
The default implementation of on_before_handle_request_main(). This is where you can implement your middleware's logic.
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name="on_before_handle_request_main">
<return type="bool" />
<argument index="0" name="request" type="WebServerRequest" />
<description>
2022-08-21 17:31:01 +02:00
This method is used to process the given [WebServerRequest]. Return false if you want the processing to continue, return true to signal to the caller [WebRoot] that this [WebServerRequest] handled the request, and no further processing should be done. If you do this, you need to actually send something back in your implementation using the [WebServerRequest], othrewise the [WebServerRequest] will just get kept alive hanging until a timeout occurs.
2022-08-21 00:40:49 +02:00
</description>
</method>
</methods>
<constants>
</constants>
</class>