Table of Contents
Previous Section
There are three types of methods that allow your application to influence what happens in the request-response loop:
- Initialization methods---init and awake--- are invoked, respectively, when an object is created and just before the receiver begins to participate in each cycle of the request-response loop. The methods dealloc and sleep allow the deallocation of variables initialized in init and awake.
- Action methods are associated with a particular user action such as clicking a button or hyperlink.
- Request--handling methods, if implemented, are invoked in application, session, and component objects at particular points in the request-response loop.
You can participate in the request-response loop by implementing any of these methods.
The following list summarizes common uses of the request-response loop "hooks":
- Action methods perform page navigation.
- Application init and awake methods are places to initialize application variables and configure application behavior.
- Session init and awake methods are places to initialize session variables and configure session behavior.
- Component init and awake methods are places to initialize component variables and configure component behavior.
- The sleep and dealloc methods are places to deallocate variables initialized in awake and init, respectively.
- In most situations, you can use init to initialize variables. To optimize applications, you might do more of your initializations in awake, especially if they involve inexpensive operations.
- Use takeValuesForRequest:inContext: methods to access request and context information and to perform postprocessing of user input.
- Use invokeActionForRequest:inContext: methods to substitute a different page for the response (except for initial requests).
- Use appendToResponse:inContext: methods to add to the response content or otherwise manipulate the HTTP response.