PATH  WebObjects 4.0 Documentation > What's New in WebObjects 4.0

Table of Contents Previous Section

WOLongResponsePage Class

WOLongResponsePage, defined in the WOExtensions Framework, is an abstract subclass of WOComponent. You use WOLongResponsePage when a requested action will take a long time to complete, say more than 5 seconds.

To use WOLongResponsePage, your long-running action should instantiate (with pageWithName:) and return a component that is a subclass of WOLongResponsePage. The subclass of WOLongResponsePage should override the method performAction, which is where the actual computation takes place. WOLongResponsePage performs the computation in a separate thread and returns a status page that indicates that the request is being processed.

Note: If you access WebObjects framework objects within performAction, you must check out the session (using the WOSessionStore's checkOutSessionWithSessionID:request: method) just before the WebObjects call and check it back in (with the checkInSessionForContext: method) just after the call.

WOLongResponsePage defines the following methods:
WOLongResponsePage
Method Description
performAction Override this method to perform the requested long computation. Returns the result of that computation as an object.
pageForResult: Returns the result page that is displayed when performAction completes.
setStatus: Sets the status of the computation. The long computation should send this message periodically so that the refresh page reflects the status of the computation.
refreshPageForStatus: Returns the page that is displayed while the computation is running. This page displays the current status of the computation.
refreshInterval The interval after which the refresh page is refreshed.
setRefreshInterval: Sets the refresh interval.
refresh Called by the WOMetaRefresh invokeAction callback (can also be called manually if the page is not self refreshing). This method calls either pageForException:, pageForResult:, refreshPageForStatus: or cancelPageForStatus: depending of the state of the long response.
isCancelled Returns YES or true if the request has been cancelled. The long running computation should check this value to see if it should abort.
cancel Cancels the request. You should bind a cancel button on the refresh page to this method.
cancelPageForStatus: Returns the cancel page, displayed when the request is cancelled.
pageForException: Returns the exception page, displayed when an exception occurs in performAction.
lock Locks the page.
unlock Unlocks the page.

Table of Contents Next Section