How webobjects works—a class perspective, Starting the request-response loop – Apple WebObjects 3.5 User Manual

Page 72

Advertising
background image

Chapter 5

WebObjects Viewed Through Its Classes

72

dynamic elements on your page and the objects in the Enterprise Objects
Framework.

EOEditingContext (in Java, next.eo.EditingContext)

Manages a graph of objects fetched from a database. The objects represent
tables, rows, and columns in the database.

When a WebObjects application accesses a database, one or more of the
components in the application contain one or more WODisplayGroup objects.
The session object provides access to an EOEditingContext object that is used,
for example, when changed data is saved to the database. Each session uses an
EOEditingContext to manage graphs of objects fetched from a database and to
ensure that all parts of an application remain synchronized. For read-only
applications, you can customize WOSession to return a per-application
EOEditingContext.

For more information on how the WebObjects and Enterprise Objects classes
interact, see the Enterprise Objects Developer’s Guide.

How WebObjects Works—A Class Perspective

You’ve now had a brief introduction to the classes used in WebObjects. This
section describes the sequence of events that happen during a cycle of the
request-response loop—how the application starts up, what happens when it
receives an HTTP request, and how it processes that request.

Starting the Request-Response Loop

A WebObjects application can start up in one of two ways: automatically, when
it receives a request (autostarting), or manually, when it’s run from the command
line. Either way, its entry point is the same as that of any C program: the

main

function. In a WebObjects application,

main

is usually very short. Its job is to

create and run the application.

The

main

function begins by creating an autorelease pool that’s used for the

automatic deallocation of objects that receive an

autorelease

message. It then calls

a function that loads the Java Virtual Machine (VM) if necessary.

The next step is to create a WOApplication (or WebApplication) object. This
seems fairly straightforward, but in the

init

method or constructor the application

creates and stores, in an instance variable, one or more adaptors. These adaptors,
all instances of a WOAdaptor subclass, handle communication between an

Advertising