Web.HTTPApp.TCustomWebDispatcher.DispatchAction

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function DispatchAction(Request: TWebRequest;  Response: TWebResponse): Boolean;

C++

bool __fastcall DispatchAction(TWebRequest* Request, TWebResponse* Response);

Properties

Type Visibility Source Unit Parent
function protected
Web.HTTPApp.pas
Web.HTTPApp.hpp
Web.HTTPApp TCustomWebDispatcher

Description

Passes an HTTP request message to the action items in Actions until it is handled.

The Web application calls DispatchAction when it receives an HTTP request message so that the dispatcher can dispatch the request to any action items that can generate the response.

Before DispatchAction looks for action items to handle the HTTP request message represented by the Request parameter, it generates a BeforeDispatch event. If the BeforeDispatch event handler handles the action, the dispatcher does not pass the request message to any of the action items.

If there is no BeforeDispatch event handler, or of the BeforeDispatch event handler does not handle the request, DispatchAction attempts to match the MethodType and PathInfo of the request with the MethodType and PathInfo properties of each action item in the Actions property. When an action item matches the MethodType and PathInfo of the request, DispatchAction calls its OnAction event handler.

The OnAction event handler can complete the response to the request, or indicate that the request is not fully handled and allow another action item to finish processing the request. If the OnAction event handler does not complete the request, DispatchAction continues checking the action items in the Actions property and calling the OnAction event handler when a match is found.

If all of the action items are checked, and the request is still not fully handled, DispatchAction calls the OnAction event handler of the default action item.

Finally, if the request has been handled by the BeforeDispatch event handler or any of the action items, DispatchAction generates an AfterDispatch event. The AfterDispatch event does not occur if the BeforeDispatch event or any of the action items has already sent the response.

DispatchAction returns a Boolean value indicating whether the Web application should send the response message if it is not already sent. DispatchAction returns true if the action was handled by the action items and the AfterDispatch event handler did not change its Handled parameter to false.

See Also