Table of Contents
Previous Section
All requests received by a WebObjects application are associated with one of the application's pages---the request page. If the request doesn't explicitly specify a page, the WOWebScriptApplication object associates the request with a page named "Main". During the first phase of the request-response loop, the application finds or creates a component to represent the request page. This component---called the request component---is represented with an instance of a custom WOComponentController subclass or a WOWebScriptComponentController.
If the WOWebScriptApplication object has already created a component to represent the request page, it uses that same component. If it hasn't, the WOWebScriptApplication object performs the following steps to create it:
- It looks in the Objective-C runtime system for a class with the same name as the request page. If it finds a class with the same name, it creates an instance of that class. For example, if the request specifies a request page named "LoginPanel" and a class with the same name is present in the Objective-C runtime system, the WOWebScriptComponentController instantiates a LoginPanel object as the request component.
- If the WOWebScriptApplication object fails to find a class in the runtime, it creates an instance of WOWebScriptComponentController.
Note: A WOWebScriptApplication object follows this same procedure whenever it's called upon to provide a component.
During the first phase of the request-response loop, the request component assigns user input to variables. This is the basic sequence of events in preparing for a request:
- The WOWebScriptApplication object restores the values of all session and persistent variables. For more information on how a WebObjects application manages state, see the chapter "Managing State."
- The WOWebScriptApplication object receives a willPrepareForRequest:inContext: message.
- The request component receives a prepareForRequest:inContext: message. prepareForRequest:inContext: invokes the request component's willPrepareForRequest:inContext: method, stores user input in variables according to the component's declarations file, and then invokes the request component's didPrepareForRequest:inContext: method.
- The WOWebScriptApplication object receives a didPrepareForRequest:inContext: message.
Table of Contents
Next Section