If the user has just begun a new session (that is, if the request URL looks like the one shown in Figure 20), the user has not requested a specific page. Therefore, the application object creates a new instance of the WOComponent class for the page named "Main." The application object performs the following steps to create a component:
The component may not be in the cache for one of three reasons:
Note that to retrieve the page from the cache, a context ID is required in addition to the page name. The context ID identifies a page as it existed at the end of a particular request-response loop. Why is the context ID necessary? Imagine you're accessing a WebObjects application that lets you subscribe to various publications. You navigate from the site's home page to the order page, where you select a publication, and then you go to the customer information page and fill in your address. After submitting this information, you navigate back to the home page. Next, you decide to enter a subscription for a friend. You follow the process a second time, selecting a different publication and entering your friend's address.
At this point, within a single session with the subscriptions application, you've accessed the same pages twice, entering different information each time. Let's say that you now realize that you made a mistake in your own address, so you backtrack to that page, change the address, and resubmit the information. It's important that the new address information is submitted to the customer information page as it existed during the first order so that the revised information can be associated with the right publication order.
WebObjects associates a different context ID (again, a randomly generated integer-to maintain security) with each request-response loop cycle. A request to a session includes both the name of request page and a context ID so the session object can locate, from its cache of page instances, the appropriate one to handle the request.
Table of Contents Next Section