[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
"Bug" in WOF backtracking handling?
I have what I think may be a bug in the way WOF (3.5.1) handles
backtracking. If it's not a bug, per se, it's at least a behavior
different from that described in the WO Dev Guide.
I'd like someone to confirm this, or at least tell me if I'm wrong,
or perhaps just loony.
First off, there's a paragraph on p.140 of the Dev Guide (last page
of Ch. 7, "Managing State") that says,
"When the application determines that the request URL is identical
to one it has previously received (that is, the session and context
IDs in the request URL are identical to those in a request it has
previously received), it simply returns the response page that was
associated with this earlier request. The first two steps of a
normal request handling loop (value extraction from the request and
action invocation) don't occur."
I set up a test app to let me observe this behavior, in action.
The app has setPageRefreshOnBacktrackEnabled set to YES, which may be
affecting the observed behavior. pageCacheSize is the default, 30.
The app presents a simple menu of hyperlinks to 5 simple pages, which
are identical (named: Main, Two, Three, Four, Five). Each of the 5 page
components contains *only* a subcomponent, which displays a WOString
showing the current page name (via. self.context.page.name) and 5
WOHyperlinks whose action attributes are bound to these methods, defined
in Application.wos:
- pageMain { return [self pageWithName:@"Main"]; }
- pageTwo { return [self pageWithName:@"Two"]; }
- pageThree { return [self pageWithName:@"Three"]; }
- pageFour { return [self pageWithName:@"Four"]; }
- pageFive { return [self pageWithName:@"Five"]; }
I told you it was simple! :-)
In Application.wos, I'm logging (via logWithFormat) when various methods
are called, e.g. restorePageForContextID, savePage, and the three request
handling methods.
Here's what happens:
I run the app, and click on several hyperlinks, taking me through various
pages. Then I start backtracking (via my browser's Back button).
The first time I hit Back, the App calls restorePageForContextID twice --
once to restore the appropriate request component (2 contextIDs back), and
then again to restore the response component (1 contextID back) that was
generated during that transaction -- then the App calls appendToResponse,
then savePage.
This is all fine, so far -- it's consistent with the behavior described
in the paragraph I quoted, above.
But then, I hit the Back button a 2nd time, and the app _consistently_
restores the request for the prior transaction (now we're 3 contextIDs
back), then it calls ALL THREE request handling methods, generating a
NEW response page. I keep hitting Back, and it keeps doing the same
thing. Unless I'm misinterpreting that paragraph, this is NOT correct
behavior.
If I then start randomly hitting the Forward and Back buttons, it will
sometimes restore the cached response page and call only appendToResponse,
and sometimes call all three request handling methods, generating and
returning a brand new response page. It seems erratic... at least, I
haven't been able to detect a pattern, and I'm at a real loss to determine
what's going on. "Bewildered", even. :-)
Has anyone noticed this? Or is this just perfectly normal, and I'm
just nuts?
I'd be happy to email the App to anyone who's interested in seeing this
first hand.
Thanks much,
---
Patrick Robinson
Extension Information Systems, Virginia Tech
pgr@ramandu.ext.vt.edu