Table of Contents Previous Section
WebObjects defines three request-handling methods that are invoked at particular points in the request-response loop if you implement them:
As with init and awake methods, the request-handling methods can be implemented for an application, a session, and the application's components. All versions of a request-handling method work identically, and can be used for similar purposes. You choose to implement a method for the application, the session, or a component based on which is more appropriate for the behavior you need to provide. Generally, you implement request-handling methods in the application or the session object when the specified behavior should affect every request. You implement request-handling methods in a component when the behavior should affect a particular page.
The WOApplication, WOSession, and WOComponent classes each declare and implement the three methods that handle requests and responses. The implementations of these methods that you provide in scripts---Application.wos, Session.wos, and component scripts---are dynamically added to the appropriate subclass object that WebObjects generates at run time. Consequently, when WOApplication sends takeValuesFromRequest:inContext: to self, the takeValuesFromRequest:inContext: method defined in the corresponding Application.wos (if it exists) is invoked. In compiled subclasses of WOApplication, WOSession, and WOComponent, you can override the request-handling methods, but it is more common to implement them in a script.
In your implementations of request-handling methods you must invoke super's implementation of the same methods. Where you invoke it is an important consideration because it can affect the request, response, and context information available at any given point. You will want to perform certain tasks before super is invoked and, for other tasks, after super is invoked.