Really great, Werner! 2010/7/30 Hazem Saleh <haz...@apache.org>
> Wonderful! > > > > On Fri, Jul 30, 2010 at 2:10 PM, Matthias Wessendorf <mat...@apache.org>wrote: > >> kick ass! >> >> great stuff, Werner! >> >> -Matthias >> >> On Fri, Jul 30, 2010 at 12:58 PM, Werner Punz <werner.p...@gmail.com> >> wrote: >> > Hello, as some people might have noticed I recently integrated the Ajax >> > fileupload into our trunk (2.0.2-SNAPSHOT), I also gave the code to the >> JSF >> > EG so that it might be part of JSF 2.1 or the base for a similar >> > functionality. >> > The code changes itself are: >> > >> > a) A small patch on the myfaces side to detect the partoal fileupload >> case >> > as ajax cycle >> > >> > b) Extensions to our scripts which currently are only enabled in dev >> mode >> > (it still is up for discussion whether we should enable it for prod or >> not >> > since they are non standard) >> > >> > >> > Here is what you have to do: >> > >> > First turn your server on into development mode via: >> > <context-param> >> > <param-name>javax.faces.PROJECT_STAGE</param-name> >> > <param-value>Development</param-value> >> > </context-param> >> > >> > Then use the code like I do in my working testcase: >> > http://www.pastebin.org/432572 >> > >> > the important thing is following line: >> > >> > <script type="text/javascript"> >> > myfaces.config = myfaces.config || {}; >> > myfaces.config["transportAutoSelection"] = true; >> > </script> >> > This enables the auto transport selection, which switches to an iframe >> > submit in case of a file uploading form submit. >> > This switch cannot be enabled by default because it would break the spec >> > requirements that an xhr post has to be performed at all costs. >> > >> > Also xhr level2 is out of the question for now because it is only >> supported >> > by the newest browsers. >> > >> > After that it is straight forward, you can use the fileupload component >> from >> > Tomahawk 2 for instance, it should work straight out of the box. >> > >> > I also did a servlet 3.0 fileupload component for prototyping but the >> code >> > is too flakey yet (mainly due to spec deficits less due to the component >> > itself) and I cannot really commit it into the core. Instead I made sure >> > that the standard fileupload components perform ok. >> > So it is ready to be used at least from my point of view, but have in >> mind >> > all this will break compatibility to Mojarra if you use it. >> > >> > So using it means you are bound to MyFaces, which is something I do not >> > particularily recommend (hence also donating the prototype code to the >> EG, I >> > want something like this in the spec) >> > >> > Here again is the pastebin to all relevant files: >> > >> > http://www.pastebin.org/432572 >> > http://www.pastebin.org/432586 for the relevant bean. >> > If your fileupload is correctly configured this code should work out of >> the >> > box. >> > >> > >> > >> > >> > Werner >> > >> > >> > >> > >> >> >> >> -- >> Matthias Wessendorf >> >> blog: http://matthiaswessendorf.wordpress.com/ >> sessions: http://www.slideshare.net/mwessendorf >> twitter: http://twitter.com/mwessendorf >> > > > > -- > Hazem Ahmed Saleh Ahmed > > Author of (The Definitive Guide to Apache MyFaces and Facelets): > > http://www.amazon.com/Definitive-Guide-Apache-MyFaces-Facelets/dp/1590597370 > http://www.amazon.com/-/e/B002M052KY > > Web blog: http://hazems.blogetery.com/ > > [Web 2.0] Mashups Integration with JSF: > http://code.google.com/p/mashups4jsf/ > -- Jakob Korherr blog: http://www.jakobk.com twitter: http://twitter.com/jakobkorherr work: http://www.irian.at