Dispatching Request Messages

From RAD Studio
Jump to: navigation, search

Go Up to The Web Dispatcher


When the dispatcher receives the client request, it generates a BeforeDispatch event. This provides your application with a chance to preprocess the request message before it is seen by any of the Action Items.

Next, the dispatcher iterates over its list of action items, looking for an entry that matches the PathInfo portion of the request message's target URL and that also provides the service specified as the method of the request message. It does this by comparing the PathInfo and MethodType properties of the TWebRequest object with the property of the same name on the action item.

When the dispatcher finds an appropriate action item, it causes that action item to fire. When the action item fires, it does one of the following:

  • Fills in the response content and sends the response or signals that the request is completely handled.
  • Adds to the response and then allows other action items to complete the job.
  • Defers the request to other action items.

After checking all its action items, if the message is not handled the dispatcher checks any specially registered auto-dispatching components that do not use action items.

If, after checking all the action items and any specially registered auto-dispatching components, the request message has still not been fully handled, the dispatcher calls the default action item. The default action item does not need to match either the target URL or the method of the request.

If the dispatcher reaches the end of the action list (including the default action, if any) and no actions have been triggered, nothing is passed back to the server. The server simply drops the connection to the client.

If the request is handled by the action items, the dispatcher generates an AfterDispatch event. This provides a final opportunity for your application to check the response that was generated, and make any last minute changes.

See Also