Take a look at the following code extracted from  one of my project's Session class:

    /**
     * Utility method that gets the context ID string
     * from the passed in request
     */
    public String requestsContextID(WORequest aRequest){
        String uri = aRequest.uri();
        String eID = NSPathUtilities.lastPathComponent(uri);
        NSArray eIDs = NSArray.componentsSeparatedByString(eID, ".");
        String reqCID = "1";
        if(eIDs.count() > 0){
            reqCID = (String)eIDs.objectAtIndex(0);
        }
        return reqCID;
    }

    /**
     * Method inspects the passed in request to see if
     * the user backtracked. If the context ID for the request is 2 clicks
     * less than the context ID for the current WOContext, we know
     * they backtracked.
     */
    public boolean didBacktrack(WORequest aRequest, WOContext aContext){
        boolean didBacktrack = false;
        int reqCID = Integer.parseInt(requestsContextID(aRequest));
        int cid = Integer.parseInt(aContext.contextID());
        int delta = cid - reqCID;
        if(delta > 2){
            didBacktrack = true;
        }else if(delta > 1){
            // Might not have backtracked if their last
            // action was a direct action. I don't know the best way
            // to deal with this, but one way would include
            // overriding performActionNamed() on your WODirectActions
            // indicating the last request was a DirectAction
            if(!lastActionWasDA){
                didBacktrack = true;
            }
        }
        lastActionWasDA = false;
        return didBacktrack;
    }

    /**
     * Overrides the ComponentAction handler to set the didBackTrack
     * flag
     */
    public WOActionResults invokeAction(WORequest aRequest, WOContext aContext){
        String reqCID = requestsContextID(aRequest);
        didBackTrack = didBacktrack(aRequest, aContext);
        return super.invokeAction(aRequest, aContext);
    }

I hope this helps.  Maybe you can do something similar based on this code to solve your particular problem.

On Sep 14, 2006, at 10:15 AM, Ute Hoffmann wrote:

Yes, I know that is the place where i have to hook that in... but how do I get at the right context from the page cache? Do I have to cache the url of the last page somewhere or is there a way to do what I want with what WO provides (i.e. get the last existing Object in the page cache programmatically and hand that back)?

What does it mean in the API:
"page recreation is disabled" Would enable page recreation do what I want by default and if yes, how enable it (and which side effects)?

Any ideas?


Am Donnerstag, 14.09.06 um 16:03 Uhr schrieb Robert Walker:

Take a look at the API document for the following method of WOApplication class:

public WOResponse handlePageRestorationErrorInContext(WOContext aContext)

Maybe you can do what you want by overriding this method.

On Sep 14, 2006, at 9:56 AM, Ute Hoffmann wrote:

Hallo,
is it possible to do the following:

When the user triggers a backtracked too far exception ask in the error handling for the last existing page in pageCache and hand that page back in place of the error-message/an error-page?

If this is possible... how could one archive this?

Thanks a lot,

Ute

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list     ([email protected])
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]


--
Robert Walker



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]

--
Robert Walker



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to