Choosing a Default Action Item

From RAD Studio
Jump to: navigation, search

Go Up to Determining When Action Items Fire


Only one of the action items can be the default action item. The default action item is selected by setting its Default property to True. When the Default property of an action item is set to True, the Default property for the previous default action item (if any) is set to False.

When the dispatcher searches its list of action items to choose one to handle a request, it stores the name of the default action item. If the request has not been fully handled when the dispatcher reaches the end of its list of action items, it executes the default action item.

The dispatcher does not check the PathInfo or MethodType of the default action item. The dispatcher does not even check the Enabled property of the default action item. Thus, you can make sure the default action item is only called at the very end by setting its Enabled property to False.

The default action item should be prepared to handle any request that is encountered, even if it is only to return an error code indicating an invalid URI or MethodType. If the default action item does not handle the request, no response is sent to the Web client.

Warning: Changing the Default property of an action during execution may cause unexpected results for the current request. If the Default property of an action that has already been triggered is set to True, that action will not be reevaluated and the dispatcher will not trigger that action when it reaches the end of the action list.

See Also