Apple WebObjects 3.5 User Manual

Page 81

Advertising
background image

How WebObjects Works—A Class Perspective

81

1. The application object stores the response component indicated by the

action method’s return value. (This action method was invoked during
the second phase of the request-response loop.)

2. If the response component is different from the request component,

application sends the

awake

message to the response component.

3. The application object sends

appendToResponse:inContext:

to itself; its

implementation simply invokes the session object’s

appendToResponse:inContext:

method.

4. The session pushes the response component onto the WOContext

stack and sends the response component the

appendToResponse:inContext:

message.

5. The response component, in its implementation of

appendToResponse:inContext:

, gets the template for the component and sends

appendToResponse:inContext:

to the template’s root object.

6. All static and dynamic HTML elements in the response-page

template, and in subcomponent templates, receive the

appendToResponse:inContext:

message. In it, they append to the content of the

response the HTML code that represents them. For dynamic
elements, this code includes the values assigned to variables.

7. When control returns to the session object, the session object asks the

WOStatisticsStore to record statistics about the response.
WOStatisticsStore sends the session a

descriptionForResponse:inContext:

message. The session, in turn, sends the response component

descriptionForResponse:inContext:

message. By default, this method returns the

response component’s name.

After the response has been generated, but before returning the response
to the adaptor, the application object concludes request handling by doing
the following:

1. It causes the

sleep

method—the counterpart of

awake

—to be invoked in

all components involved in the cycle (request, response, and
subcomponents). As described in the chapter “Managing State”
(page 109), in the

sleep

method, objects can release resources that don’t

have to be saved between cycles.

2. It requests the session object to save the response page in the page

cache.

3. It invokes the session object’s

sleep

method.

Advertising