pandemonium_engine/modules/web/doc_classes/WebServer.xml

91 lines
3.8 KiB
XML
Raw Normal View History

2022-08-21 00:40:49 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-10-12 01:59:32 +02:00
<class name="WebServer" inherits="Node" version="4.2">
2022-08-21 00:40:49 +02:00
<brief_description>
2022-08-21 18:24:20 +02:00
The WebServer class can be used as a base for Webserver implementations.
2022-08-21 00:40:49 +02:00
</brief_description>
<description>
2022-08-21 18:24:20 +02:00
The WebServer class can be used as a base for Webserver implementations.
When the actual server implementation receives an HTTP request it needs to take it's [WebServerRequest] implementation, set it up properly, then it needs to call the [code]server_handle_request()[/code] method with it, to start handling it.
It sould have one [WebNode] (or a derived class) as a child, it will be set as the web root. If you add more than one, only the first one will be used. Requests will be sent to this [WebNode]'s [code]handle_request_main()[/code].
If a [HTTPSessionManager] is added as a child, it will be picked up automatically, and then it can be used by [WebNodes]s to store session information.
2022-08-21 00:40:49 +02:00
</description>
<tutorials>
</tutorials>
<methods>
<method name="_start" qualifiers="virtual">
<return type="void" />
<description>
2022-08-21 18:24:20 +02:00
The default implementation of start().
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name="_stop" qualifiers="virtual">
<return type="void" />
<description>
2022-08-21 18:24:20 +02:00
The default implementation of stop().
2022-08-21 00:40:49 +02:00
</description>
</method>
2023-12-22 19:49:04 +01:00
<method name="_unregister_connection_for_request" qualifiers="virtual">
<return type="Dictionary" />
<argument index="0" name="request" type="WebServerRequest" />
<description>
</description>
</method>
2022-08-21 00:40:49 +02:00
<method name="get_session_manager">
<return type="HTTPSessionManager" />
<description>
2022-08-21 18:24:20 +02:00
Returns the active [HTTPSessionManager].
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name="get_web_root">
<return type="WebNode" />
<description>
2022-08-21 18:24:20 +02:00
Returns the root [WebNode].
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name="request_write_lock">
<return type="void" />
<description>
2022-08-21 18:24:20 +02:00
Request a write lock, in order to be able to change your active [WebNode] tree. Actually change the tree in _notification, when you receive NOTIFICATION_WEB_SERVER_WRITE_LOCK_ACQUIRED.
Note that HTTP servers are highly asynchronous, and due to how the system works adding and even removing [WebNode]s from the tree is not that big of a deal, however deallocating [WebNode]s while they are processing requests will crash your app sooner or later. Just to be safe I recommended that you lock your [WebNode] tree branch before touching it.
Do not forget to make your nodes refresh their internal handler map when you change the tree using other helper methods like build_handler_map().
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name="server_handle_request">
<return type="void" />
<argument index="0" name="request" type="WebServerRequest" />
<description>
2022-08-21 18:24:20 +02:00
The default request handler method that your implementations can use.
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name="start">
<return type="void" />
<description>
2022-08-21 18:24:20 +02:00
Start the server.
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name="stop">
<return type="void" />
<description>
2022-08-21 18:24:20 +02:00
Stop the server.
2022-08-21 00:40:49 +02:00
</description>
</method>
2023-12-22 19:49:04 +01:00
<method name="unregister_connection_for_request">
<return type="Dictionary" />
<argument index="0" name="request" type="WebServerRequest" />
<description>
</description>
</method>
2022-08-21 00:40:49 +02:00
</methods>
<constants>
<constant name="NOTIFICATION_WEB_SERVER_STARTED" value="2000">
2022-08-21 18:24:20 +02:00
This notification will be sent after the server is started.
2022-08-21 00:40:49 +02:00
</constant>
<constant name="NOTIFICATION_WEB_SERVER_STOPPED" value="2001">
2022-08-21 18:24:20 +02:00
This notification will be sent after the server is stopped.
2022-08-21 00:40:49 +02:00
</constant>
<constant name="NOTIFICATION_WEB_SERVER_WRITE_LOCK_ACQUIRED" value="2002">
2022-08-21 18:24:20 +02:00
This is sent to self, and children when a write lock is acquired. Only change the tree in _notification if you get this.
2022-08-21 00:40:49 +02:00
</constant>
</constants>
</class>