 |
- Let the server decide whether or not to send back state
- Add a header to advise the server to omit the wrapping XML.
- remove the com.sun.faces.lifecycle._PHASE_ID_ header
- Modify the jMaki AjaxWrapperRenderer to be usable on AJAX postback. Make it aware of the com.sun.faces.avatar.Partial header and have it not render just the converted value in that case.
- Parse the xml messages into a JavaScript collection, so the user doesn't have to do so.
- Have an event queue on the client to ensure total ordering of responses.
Making events work.
By having a custom lifecycle instead of a custom UIViewRoot, we lose the ability to have transient output components present in the view when rendering. This is a problem, as shown in Jacob's server suggest renderer example. It needs the transient output components present when processing the ajax response so he can use the template text to format the output.
By having a custom UIViewRoot, instead of a custom lifecycle, we lose the ability for a third party component library to subclass UIViewRoot, which some libraries may do. Also, you incur some level of AJAX cost on non-AJAX requests.
There is a third way!
Let's have a custom lifecycle that does the following
- in the execute method, check for the "partial" header. If not present, simply delegate to parent.execute().
- if the "partial" header is present, wrap the UIViewRoot from facesContext.getViewRoot() in a special UIViewRoot that knows about all the header business to enable partial tree traversals.
- install this wrapped UIViewRoot in the FacesContext, and then delegateto parent.execute().
- before returning from the execute method, re-place the old UIViewRoot
- in the render method, do the same as above, but make sure to be careful about state saving.
-- Main.edburns - 20 Jun 2006
|