Re: Ann: MyFaces Ajax Fileupload and how to use it

2010-08-05 Thread Martin Marinschek
Hi guys,

I am saying this in a broader scope - not only for the AJAX features.
But our AJAX features which do make sense out of the box (and this one
does) could also be enabled like this.

best regards,

Martin

On 8/2/10, Werner Punz werner.p...@gmail.com wrote:
 Hi Martin this would make only sense if we had a bunch of features which
 can be turned on via such a switch, which we don´t from my perspective
 because the queue control features which we have internally
 cannot be turned on switch like but have to be configured with params
 like myfaces.config.delay = 300

 What maybe would make sense is some kind of myfaces:ajax tag which is an
 extended f:ajax tag which exposes all new features.

 something along the lines of

 myfaces:ajax delay=300 timeout200 execute=... render=... /




 Werner



 Am 01.08.10 21:42, schrieb Martin Marinschek:
 Perfect.

 Can we talk about having the context param STRICT_COMPATIBILITY_MODE
 again, where this is disabled, and if the param is set to false, this
 feature is enabled?

 best regards,

 Martin

 On 7/30/10, Jakob Korherrjakob.korh...@gmail.com  wrote:
 Really great, Werner!

 2010/7/30 Hazem Salehhaz...@apache.org

 Wonderful!



 On Fri, Jul 30, 2010 at 2:10 PM, Matthias Wessendorf
 mat...@apache.orgwrote:

 kick ass!

 great stuff, Werner!

 -Matthias

 On Fri, Jul 30, 2010 at 12:58 PM, Werner Punzwerner.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-namejavax.faces.PROJECT_STAGE/param-name
 param-valueDevelopment/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










-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces


Re: Ann: MyFaces Ajax Fileupload and how to use it

2010-08-05 Thread Werner Punz
Btw. Martin, I already gave Ed all the needed info and code on how to 
implement it so that they can get everything into the spec for 2.1 
(which hopefully will happen)


I think the entire issue of not being able to support a fileupload in 
the non ajax and ajax case in stock jsf has been going on for way too long.


Roger Kitain also has my proposals for the queue control, I dont know 
what the status on this is, since the richfaces guys have something very 
similar but with the addition of being able to have multiple queues
(which btw. opens a can of worms regarding the component tree 
synchronisation and viewstate handling)



Werner




Am 05.08.10 12:38, schrieb Martin Marinschek:

Hi guys,

I am saying this in a broader scope - not only for the AJAX features.
But our AJAX features which do make sense out of the box (and this one
does) could also be enabled like this.

best regards,

Martin

On 8/2/10, Werner Punzwerner.p...@gmail.com  wrote:

Hi Martin this would make only sense if we had a bunch of features which
can be turned on via such a switch, which we don´t from my perspective
because the queue control features which we have internally
cannot be turned on switch like but have to be configured with params
like myfaces.config.delay = 300

What maybe would make sense is some kind of myfaces:ajax tag which is an
extended f:ajax tag which exposes all new features.

something along the lines of

myfaces:ajax delay=300 timeout200 execute=... render=... /




Werner



Am 01.08.10 21:42, schrieb Martin Marinschek:

Perfect.

Can we talk about having the context param STRICT_COMPATIBILITY_MODE
again, where this is disabled, and if the param is set to false, this
feature is enabled?

best regards,

Martin

On 7/30/10, Jakob Korherrjakob.korh...@gmail.com   wrote:

Really great, Werner!

2010/7/30 Hazem Salehhaz...@apache.org


Wonderful!



On Fri, Jul 30, 2010 at 2:10 PM, Matthias Wessendorf
mat...@apache.orgwrote:


kick ass!

great stuff, Werner!

-Matthias

On Fri, Jul 30, 2010 at 12:58 PM, Werner Punzwerner.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-namejavax.faces.PROJECT_STAGE/param-name
 param-valueDevelopment/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: 

Re: Ann: MyFaces Ajax Fileupload and how to use it

2010-08-02 Thread Ganesh

Hi Martin,


From what I understand the feature is disabled as long as you don't set


myfaces.config[transportAutoSelection] = true;

So why have a second param to do the same thing?

Best regards,
Ganesh

Martin Marinschek schrieb:

Perfect.

Can we talk about having the context param STRICT_COMPATIBILITY_MODE
again, where this is disabled, and if the param is set to false, this
feature is enabled?

best regards,

Martin

On 7/30/10, Jakob Korherr jakob.korh...@gmail.com wrote:

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.orgwrote:


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-namejavax.faces.PROJECT_STAGE/param-name
   param-valueDevelopment/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






--
There are two kinds of people in the world, those who believe there are two kinds 
of people and those who don't.
— Robert Benchley


Re: Ann: MyFaces Ajax Fileupload and how to use it

2010-08-02 Thread Werner Punz
Btw. another thing, I tried to enable fileupload via xhr level2 
(upcoming xhr extension in html5) I was able to send the form data but
unfortunately the sent multipart form request was missing some vital 
meta information and broke the spec, on both implementations I could 
grasp (Firefox4 and chrome)


I will commit the code, but for now I wont be able to enable it until
I have gotten info wether this is a bug, or expected.
Once things are cleared out in this area we can enable it as
second option to the iframe, if the browser provides it.

The advantage over the iframe method is that you can do progress 
monitoring without a second push channel.



Werner



Am 02.08.10 08:26, schrieb Ganesh:

Hi Martin,

 From what I understand the feature is disabled as long as you don't set

myfaces.config[transportAutoSelection] = true;

So why have a second param to do the same thing?

Best regards,
Ganesh

Martin Marinschek schrieb:

Perfect.

Can we talk about having the context param STRICT_COMPATIBILITY_MODE
again, where this is disabled, and if the param is set to false, this
feature is enabled?

best regards,

Martin

On 7/30/10, Jakob Korherr jakob.korh...@gmail.com wrote:

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.orgwrote:


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-namejavax.faces.PROJECT_STAGE/param-name
param-valueDevelopment/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











Re: Ann: MyFaces Ajax Fileupload and how to use it

2010-08-02 Thread Werner Punz
Hi Martin this would make only sense if we had a bunch of features which 
can be turned on via such a switch, which we don´t from my perspective 
because the queue control features which we have internally
cannot be turned on switch like but have to be configured with params 
like myfaces.config.delay = 300


What maybe would make sense is some kind of myfaces:ajax tag which is an 
extended f:ajax tag which exposes all new features.


something along the lines of

myfaces:ajax delay=300 timeout200 execute=... render=... /




Werner



Am 01.08.10 21:42, schrieb Martin Marinschek:

Perfect.

Can we talk about having the context param STRICT_COMPATIBILITY_MODE
again, where this is disabled, and if the param is set to false, this
feature is enabled?

best regards,

Martin

On 7/30/10, Jakob Korherrjakob.korh...@gmail.com  wrote:

Really great, Werner!

2010/7/30 Hazem Salehhaz...@apache.org


Wonderful!



On Fri, Jul 30, 2010 at 2:10 PM, Matthias Wessendorf
mat...@apache.orgwrote:


kick ass!

great stuff, Werner!

-Matthias

On Fri, Jul 30, 2010 at 12:58 PM, Werner Punzwerner.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-namejavax.faces.PROJECT_STAGE/param-name
param-valueDevelopment/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











Re: Ann: MyFaces Ajax Fileupload and how to use it

2010-08-01 Thread Martin Marinschek
Perfect.

Can we talk about having the context param STRICT_COMPATIBILITY_MODE
again, where this is disabled, and if the param is set to false, this
feature is enabled?

best regards,

Martin

On 7/30/10, Jakob Korherr jakob.korh...@gmail.com wrote:
 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.orgwrote:

 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-namejavax.faces.PROJECT_STAGE/param-name
 param-valueDevelopment/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



-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces


Re: Ann: MyFaces Ajax Fileupload and how to use it

2010-07-31 Thread Werner Punz

Hi... theoretically it would be possible to use both at the same time.
The idea is that I have a clear boundary between api and impl. The API 
is just a loosely coupled facade which routes into impl.

(I am not sure if I dont call api functions in impl though)

I could decouple it even stronger so that in that case we could load the 
impl alone (I have to go through the code to check where api functions 
are called and reroute them to the impl).



Werner


Am 30.07.10 23:35, schrieb Leonardo Uribe:

Hi

I would like to know if someone has ideas about how to include the
myfaces core javascript code (partially) into tomahawk or other jsf
library.

It seems to be the same problem as we have with shared (maybe use maven
shade plugin?). There is a cool api on myfaces core that someone wants
to use in a jsf component library, but it is required the library works
with ri. I would like if myfaces is available on a webapp, use myfaces
javascript otherwise load other resource with the function subset, to
keep things working.

regards,

Leonardo Uribe

2010/7/30 Jakob Korherr jakob.korh...@gmail.com
mailto:jakob.korh...@gmail.com

Really great, Werner!

2010/7/30 Hazem Saleh haz...@apache.org mailto:haz...@apache.org

Wonderful!



On Fri, Jul 30, 2010 at 2:10 PM, Matthias Wessendorf
mat...@apache.org mailto: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 mailto: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-namejavax.faces.PROJECT_STAGE/param-name
  param-valueDevelopment/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.
 
 
 
 
  

Re: Ann: MyFaces Ajax Fileupload and how to use it

2010-07-31 Thread Werner Punz
Also if you want to use the helpers from the core, they have a double 
include prevention, so what you can use is theoretically the _Runtime.js

_Lang.js, _ExtLang.js, _Dom.js (mostly in that order) they are not
directly related with the implementation but are the foundations.
But I cannot guarantee a stable API yet outside of the _Runtime.js.
Maybe we should add some kind of versioning scheme to allow two 
different versions of the same class be loaded parallely, this could be 
done over the namespace sort of myfaces.core._Runtime10.js or
myfaces.core.11._Runtime.js. This would allow us also to have stable 
versions of the codebase side by side. (But it would introduce a 
maintenance headache for me :-(


I will think of some proposals to make the code more shareable.
Which also was my initial intention, to get it sort of as a base lib 
into Tomahawk as well to make the javascripts there more maintainable.





Werner




Am 30.07.10 23:35, schrieb Leonardo Uribe:

Hi

I would like to know if someone has ideas about how to include the
myfaces core javascript code (partially) into tomahawk or other jsf
library.

It seems to be the same problem as we have with shared (maybe use maven
shade plugin?). There is a cool api on myfaces core that someone wants
to use in a jsf component library, but it is required the library works
with ri. I would like if myfaces is available on a webapp, use myfaces
javascript otherwise load other resource with the function subset, to
keep things working.

regards,

Leonardo Uribe

2010/7/30 Jakob Korherr jakob.korh...@gmail.com
mailto:jakob.korh...@gmail.com

Really great, Werner!

2010/7/30 Hazem Saleh haz...@apache.org mailto:haz...@apache.org

Wonderful!



On Fri, Jul 30, 2010 at 2:10 PM, Matthias Wessendorf
mat...@apache.org mailto: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 mailto: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-namejavax.faces.PROJECT_STAGE/param-name
  param-valueDevelopment/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

Re: Ann: MyFaces Ajax Fileupload and how to use it

2010-07-30 Thread Matthias Wessendorf
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-namejavax.faces.PROJECT_STAGE/param-name
        param-valueDevelopment/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


Re: Ann: MyFaces Ajax Fileupload and how to use it

2010-07-30 Thread Hazem Saleh
Wonderful!


On Fri, Jul 30, 2010 at 2:10 PM, Matthias Wessendorf mat...@apache.orgwrote:

 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-namejavax.faces.PROJECT_STAGE/param-name
 param-valueDevelopment/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/


Re: Ann: MyFaces Ajax Fileupload and how to use it

2010-07-30 Thread Jakob Korherr
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.orgwrote:

 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-namejavax.faces.PROJECT_STAGE/param-name
 param-valueDevelopment/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


Re: Ann: MyFaces Ajax Fileupload and how to use it

2010-07-30 Thread Leonardo Uribe
Hi

I would like to know if someone has ideas about how to include the myfaces
core javascript code (partially) into tomahawk or other jsf library.

It seems to be the same problem as we have with shared (maybe use maven
shade plugin?). There is a cool api on myfaces core that someone wants to
use in a jsf component library, but it is required the library works with
ri. I would like if myfaces is available on a webapp, use myfaces javascript
otherwise load other resource with the function subset, to keep things
working.

regards,

Leonardo Uribe

2010/7/30 Jakob Korherr jakob.korh...@gmail.com

 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.orgwrote:

 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-namejavax.faces.PROJECT_STAGE/param-name
 param-valueDevelopment/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



Re: Ann: MyFaces Ajax Fileupload and how to use it

2010-07-30 Thread Leonardo Uribe
Hi

Good stuff Werner!

regards,

Leonardo

2010/7/30 Leonardo Uribe lu4...@gmail.com

 Hi

 I would like to know if someone has ideas about how to include the myfaces
 core javascript code (partially) into tomahawk or other jsf library.

 It seems to be the same problem as we have with shared (maybe use maven
 shade plugin?). There is a cool api on myfaces core that someone wants to
 use in a jsf component library, but it is required the library works with
 ri. I would like if myfaces is available on a webapp, use myfaces javascript
 otherwise load other resource with the function subset, to keep things
 working.

 regards,

 Leonardo Uribe

 2010/7/30 Jakob Korherr jakob.korh...@gmail.com

 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.orgwrote:

 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-namejavax.faces.PROJECT_STAGE/param-name
 param-valueDevelopment/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