Accessing the session – Apple WebObjects 3.5 User Manual

Page 74

Advertising
background image

Chapter 5

WebObjects Viewed Through Its Classes

74

Figure 19. Taking Values From the Request

A cycle of the request-response loop begins when the WOAdaptor receives an
incoming HTTP request. The adaptor object packages this request in a
WORequest and forwards this object to the application object in a

handleRequest:

message. Upon receiving this message, the application object does the
following:

1. It creates the WOResponse and WOContext objects that will be needed.

2. It invokes its own

awake

method.

3. It determines which session and which request page are associated with the

request, as described next.

Accessing the Session

The application determines whether to create a new session or access an
existing session by searching the request URL (which was passed in as an
argument to the

handleRequest:

method) for a session ID. If the request is the first

one for the session, the request URL looks like the URL shown in Figure 20.

Application

Session

Request Page

Page Template

init
awake
Create WOSession
or
Restore WOSession
Create page
or
Restore page

takeValuesFrom
Request:inContext:

init

awake

takeValuesFrom
Request:inContext:

Gets request page
and stores reference
to it.

init

awake

takeValuesFrom
Request:inContext:

Gets template for
page.

takeValuesFrom
Request:inContext:

Each dynamic element
of the the template that
accepts input responds
to takeValuesFrom
Request:inContext:.
If a user-entered value
belongs to any element,
the element sets the
related value of the
related WOAssociation.

Advertising