dev@javaserverfaces.java.net

Ajax File Uploads

From: Jason Lee <jason_at_steeplesoft.com>
Date: Thu, 25 Aug 2011 13:35:00 -0500

Attached is a diff that adds support for doing file uploads via Ajax.
While I think it's a pretty good start, it's still pretty preliminary
(It needs a lot more testing. There are places where IE-specific code
needs to be added. It needs to do a better job at cleaning up after
itself when the Ajax operation is done. Etc). In a nutshell, the diff
for jsf.js adds a new class, IframeEngine. This class wraps up the
handling of adding an iframe, sending the request, etc. instead of the
normal AjaxEngine. I also had to patch up PartialViewContextImpl to
look for 'Faces-Request' as a form parameter, since we can't modify the
headers when posting from the iframe. Ultimately, I think these types of
changes need to find their way into the spec, but that's a topic for a
different list.

Please take a look at the changes and let me know what you think. I
think the change is pretty low risk, in that this will only affect cases
where the form is set up for a multipart POST (i.e., it doesn't appear
to impede the normal ajax case). I haven't run the test suite (tbh, I
don't have the time right now, as I'm staring down the barrel of a high
priority OOW demo), but, if nothing else, I'll let them run tonight
after hours.

BTW, I should thank Werner Punz for letting me pick his brain as I
worked through this.

--
Jason Lee
http://steeplesoft.com
http://cubtracker.com