Page level – Apple WebObjects 3.5 User Manual

Page 69

Advertising
background image

The Classes in the Request-Response Loop

69

WOResponse (in Java, Response)

Stores and allows the modification of HTTP response data, such as
header information, status, and HTTP version. It also provides
convenience methods for appending HTML and simple textual data
to the content of the response (that is, the response page).

WOContext (in Java, Context)

Provides access to the objects involved in the current cycle, such as the
current request, response, session, and application objects. It also
stores the component (either the current page or one of its
subcomponents) to which the elements of the page make reference
when they “push and pull” values through association. See “How
HTML Pages Are Generated” (page 82) for an explanation. The
WOContext object acts as a “cursor,” traversing the object graph
during each phase of the request-response loop. The WOContext for a
cycle is identified by a unique context ID, which appears in the URL.

You rarely need to work directly with WORequest, WOResponse, and
WOContext yourself. At the beginning of the request-response loop, the
WOAdaptor and WOApplication objects create instances of these three
classes. The application initiates each phase of the request-response loop
by sending the messages

takeValuesFromRequest:inContext:

,

invokeActionForRequest:inContext:

, and

appendToResponse:inContext:

(in Java,

takeValuesFromRequest

,

invokeAction

, and

appendToResponse

). It passes in the

WORequest, WOResponse, and WOContext objects as arguments to one
or more of these methods. From these objects, the components, dynamic
elements, and other objects involved in the cycle get essential information.
See “How WebObjects Works—A Class Perspective” (page 72) for more on
the mechanics of request handling.

Page Level

At the page level, objects of many classes (most of them private) work
together to compose the HTML content of response pages (see Figure 17).
Many of the same objects also set their variable values from data entered
into request pages and respond to user actions.

Advertising