Here is a proposal:
1. having a "default action" construct that defaults to None, but can be set in a SitePage. If an action is in the request, it's run instead of default.
We have defaultAction now. It's only wonky because it doesn't call preAction/postAction, where all other actions do. But if we get rid of those, then it's not a problem. Anyway, defaultAction now just calls writeHTML.
2. There be a method in page that sets a redirect address, but DOES NOT end the transaction. I suggest .setRedirectURI( ). Of course, the default redirect address would be None.
I'm still not clear what the problems are with sendRedirectAndEnd()? If there's a bug there we should fix it -- otherwise we're fine right now.
3. The lifecycle of a servlet is preserved: awake/respond/sleep, with actions continuing to be called from respond, at the beginning of respond
4. After any actions are run, respond does one of two things, depending on the "pending redirect" instance attribute that I mentioned:
- if it's non-empty, sends a redirect header to the browser based on the value
- if it's empty, it calls writeHTML (or whatever analog for non-html http servlets)
Right now there's no analog for non-HTML output. You just override writeHTML and write other text. It's a misnomer, but it works fine. However, for some actions you may wish to suppress writeHTML. Of course you can code this yourself (setting some flag), but it might be nice to include. Forcing writeHTML to be called by the action would serve to do this.
This means that unless you set a redirect, all pages, with and without actions, will call the *normal* writeHTML chain, rather than the stumpy one that's in preAction and postAction now.
Also, this keeps what is in effect a "pre-respond", although it's called from respond. An argument can be made that this part should happen in awake, but that is likely to cause greater incompatibility, and I'm shying away from it.
The only thing special about awake is that it happens before respond. So I don't think it matters.
Perhaps Aaron's suggestion of having two types of page; one that has the whole pre-respond/action thing, and one that doesn't is a good one. Though, this is so trivial that a simple if/else test in one servlet could easily do it.
Plus, I like the idea of there being a default action method to run if there's nothing explicit. An alternative to the above proposal would be Ian's idea of "writeHTML" being the default action, but I still don't like the idea of "output" being an action.
-- Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org
------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
