mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 11:56:49 +01:00
Fixed docs, index node support has been moved from WebRoots to WebNodes a while ago.
This commit is contained in:
parent
0c5a35e07a
commit
942e7e802f
@ -6,7 +6,8 @@
|
|||||||
<description>
|
<description>
|
||||||
Their main purpose is to route [WebServerRequest]s, and then to send responses when the proper node was found (or to send errors if it wasn't). The handle_request_main() method is responsible for routing. It can be overridden if the default behaviour needs to be customized. Processing a request and sending a response should take place in the _handle_request() method. This will get called when a request's handler node is found.
|
Their main purpose is to route [WebServerRequest]s, and then to send responses when the proper node was found (or to send errors if it wasn't). The handle_request_main() method is responsible for routing. It can be overridden if the default behaviour needs to be customized. Processing a request and sending a response should take place in the _handle_request() method. This will get called when a request's handler node is found.
|
||||||
As mentioned in [WebServerRequest]'s documentation, this framework uses a stack like url routing model, where the http path is split along forward slashes, and then these get handled going deeper into the given [WebServer]'s [WebNode] hierarchy, effectively using the node structure as a pseudo filesystem. The HTTP uri can be set using the [code]uri_segment[/code] property. Of course [WebNode]s can override this behaviour. For an example look at [WebRoot], or [BrowsableFolderServeWebPage].
|
As mentioned in [WebServerRequest]'s documentation, this framework uses a stack like url routing model, where the http path is split along forward slashes, and then these get handled going deeper into the given [WebServer]'s [WebNode] hierarchy, effectively using the node structure as a pseudo filesystem. The HTTP uri can be set using the [code]uri_segment[/code] property. Of course [WebNode]s can override this behaviour. For an example look at [WebRoot], or [BrowsableFolderServeWebPage].
|
||||||
When the [WebServer] receives an HTTP request, it creates a [WebServerRequest] from it, and then passes this request to the root [WebNode]'s handle_request_main() method. Note that [WebRoot] types will handle request a bit differently than normal [WebNodes], as they will not try handle the request by themselves, if they are matched, instead they try to pass it to a child node which has it's uri segment set to "/", if they can't they send a 404.
|
When the [WebServer] receives an HTTP request, it creates a [WebServerRequest] from it, and then passes this request to the root [WebNode]'s handle_request_main() method.
|
||||||
|
Note that the setting an uri segment to "/" has a special meaning. These are called index nodes. If their parent [WebNode] gets matched, or it can't continue routing (if would send a 404), instead they will pass the [WebServerRequest] to an index node if it's available.
|
||||||
It will contain convenience methods for working with [Database]s if the database module was enabled when the engine was compiled (default).
|
It will contain convenience methods for working with [Database]s if the database module was enabled when the engine was compiled (default).
|
||||||
For a concrete example Let's say we have the following WebNode structure:
|
For a concrete example Let's say we have the following WebNode structure:
|
||||||
[code]WebServer
|
[code]WebServer
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
<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.
|
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.
|
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.
|
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.
|
||||||
|
Note that if any [WebNode]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>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
</tutorials>
|
</tutorials>
|
||||||
|
Loading…
Reference in New Issue
Block a user