PATH  Documentation > WebObjects 4.5 > WebObjects Reference

Table of Contents

WOLongResponsePage


Inherits from: WOComponent WOElement NSObject
Package: com.apple.yellow.webobjects


Class Description


WOLongReponsePage is an abstract subclass of WOComponent that spawns a separate thread in which to perform the action and returns a status page indicating that the request is being processed. Use WOLongReponsePage when a requested action will take a long time to complete (more than 5 seconds, say).

To use WOLongResponsePage, your long-running action should use WOComponent's pageWithName method to instantiate and return a component that is a subclass of WOLongResponsePage. This subclass should override the performAction method and perform the actual computation.






Method Types


Performing the computation
performAction
Returning pages
cancelPageForStatus
pageForException
pageForResult
refreshPageForStatus
Locking
lock
unlock
Managing refresh
refresh
refreshInterval
setRefreshInterval
setStatus
Managing cancellation
cancel
isCancelled


Instance Methods



cancel

public WOComponent cancel()

Cancels the request. You should bind a cancel button on the refresh page to this method.

See Also: isCancelled



cancelPageForStatus

public WOComponent cancelPageForStatus(Object status)

Returns the cancel page, which is displayed when the request is cancelled.

isCancelled

public boolean isCancelled()

Returns true if the request has been cancelled. The long running computation should check this value to see if it should abort.

See Also: cancel



lock

public void lock()

Locks the page.

See Also: unlock



pageForException

public WOComponent pageForException(Throwable anException)

Returns the exception page, which is displayed when an exception occurs in performAction.

pageForResult

public WOComponent pageForResult(Object aResult)

Returns the result page that is displayed when performAction completes.

performAction

public Object performAction()

Override this method to perform the requested long computation. Returns the result of that computation as an object.

refresh

public WOComponent refresh()

Called by the WOMetaRefresh invokeAction callback (can also be called manually if the page is not self refreshing). This method either invokes pageForException, pageForResult, refreshPageForStatus, or cancelPageForStatus depending on the state of the long response.

refreshInterval

public double refreshInterval()

Returns the interval after which the refresh page is refreshed.

refreshPageForStatus

public WOComponent refreshPageForStatus(Object status)

Returns the page that is displayed while the long-running computation is running. This page displays the current status of the computation.

setRefreshInterval

public void setRefreshInterval(double interval)

Sets the refresh interval.

See Also: refreshInterval



setStatus

public void setStatus(Object status)

Sets the status of the computation to status. The long computation should send this message periodically so that the refresh page reflects the status of the computation.

unlock

public void unlock()

Unlocks the page.

See Also: lock




Table of Contents
If you access WebObjects framework objects from within your implementation of performAction, you must check out the session (using WOSessionStore's checkOutSessionWithID method) just before invoking the WebObjects framework method, and check it back in (using WOSessionStore's checkInSessionForContext method) just after.