You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Andrew Robinson <an...@gmail.com> on 2010/02/11 22:10:23 UTC

[Trinidad 2] PPR and AJAX

Looking for feedback on the following requirements of the Trinidad+JSF2 AJAX
implementation:

   1. Client validation will only occur on requests made through Trinidad
   APIs
   2. Calls made to jsf.ajax.request will not perform client-side validation
   3. Trinidad will use jsf.ajax.request for its requests (after blocking ad
   client validation has been performed)
   4. Trinidad will leverage JSF2 server side classes to handle AJAX
   requests
   5. Blocking will only be used for requests through the Trinidad APIs
   6. Calls made to jsf.ajax.request will not block the UI

The code that is not working is multi-part form data (input file) submission
and the code that we have for mobile browsers. We will need to determine
what we want to do there since the AJAX layer in Mojarra and, I think,
MyFaces, is not as robust as what we have in Trinidad 1.2.

-Andrew

Re: [Trinidad 2] PPR and AJAX

Posted by Andy Schwartz <an...@gmail.com>.
Hi Werner -

On Fri, Feb 12, 2010 at 2:28 AM, Werner Punz <we...@gmail.com> wrote:
> Werner Punz schrieb:
> Ok I shot over the top a little bit early, the problem with file input is
> that you cannot cover it within the bounds of XHR at all you have to revert
> to an iframe transport.

Yep.  I raised this requirement a number of times as well since it is
a requirement for both Trinidad and ADF Faces.  Actually, my hope was
that jsf.ajax.request() API was sufficiently generic to allow
alternate transport implementations and I had assumed that the JSF
implementations would be able to provide iframe-based postback support
as an implementation detail.  However, Andrew Robinson recently
pointed out that there is one case where the JSF client-side API
introduces an XHR dependency: jsf.ajax.response() expects an XHR
object, which it uses to grab the responseXML.

FWIW, Jim logged the following spec issue to track the general requirement:

https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=647

I have updated the issue with a comment about the jsf.ajax.response()
XHR dependency.  Are you aware of other such dependencies?  If so, we
should capture these in the spec issue as well.

Note that it still seems possible for JSF implementations to provide
iframe-based postback solutions, though might require a bit of
hackery...  Since the jsf.ajax.response() implementation expects to be
able to retrieve the responseXML off of the XHR object, one possible
approach might be for jsf.ajax.request() to mock up its own pseudo-XHR
object which provides access to the response document from the iframe.
 Andrew R actually thought of this a way to allow us to delegate back
to jsf.ajax.response() in Trinidad in the case where we use Trinidad's
iframe-based postback mechanism.  Perhaps if this works out well, we
can incorporate such a solution back into MyFaces?

Andy

Re: [Trinidad 2] PPR and AJAX

Posted by Werner Punz <we...@gmail.com>.
Werner Punz schrieb:

> The problem with input file is that JSF2 spec simply does not support it 
> at all yet
> I have basically brought this up a number of times within the JSF2 ml 
> (and I assume there has been a bug filed for it)
> if you want file upload you have to bypass the JSF2 ajax api, sadly as 
> it is. We (Ganesh, Alex and I) made preparations for the integration of 
> such a layer by modularizing the entire codebase as much as possible so 
> that you will be able to switch transports on the fly (the hook point is 
> our impl class where you can change the request object)
> 
> But in the end this needs to be solved on spec level :-(. In my opinion 
> this is a huge gap in the spec which should have been covered upfront, 
> but there were two reason for doing it as far as I could get it right.
> First they wanted to get the ajax part right before extending it, 
> secondly multipart form request soon will be first class citizen of
> of the JEE spec which it has not been up until now.
> 
> Sorry to say all this, but the matter of multipart request is somewhat 
> something which leaves a lot of bitter taste in my mouth :-)
> 
> 
Ok I shot over the top a little bit early, the problem with file input 
is that you cannot cover it within the bounds of XHR at all you have to 
revert to an iframe transport. The problem in the spec however is that 
it basically for now binds the transport to an xhr layer, which in 
itself contractics the mechanisms which have to be applied to get an 
ajaxed file upload. All I can say is if it is multipart form request 
bypass the spec and use your own solution for now especially if you have 
to cover both APIs. Nothing prevents you from doing that, and I assume 
that is what everybody will do for file uploading.



Werner


Re: [Trinidad 2] PPR and AJAX

Posted by Werner Punz <we...@gmail.com>.
Andrew Robinson schrieb:
> Looking for feedback on the following requirements of the Trinidad+JSF2 
> AJAX implementation:
> 
>    1. Client validation will only occur on requests made through
>       Trinidad APIs
>    2. Calls made to jsf.ajax.request will not perform client-side validation
>    3. Trinidad will use jsf.ajax.request for its requests (after
>       blocking ad client validation has been performed)
>    4. Trinidad will leverage JSF2 server side classes to handle AJAX
>       requests
>    5. Blocking will only be used for requests through the Trinidad APIs
>    6. Calls made to jsf.ajax.request will not block the UI
> 
> The code that is not working is multi-part form data (input file) 
> submission and the code that we have for mobile browsers. We will need 
> to determine what we want to do there since the AJAX layer in Mojarra 
> and, I think, MyFaces, is not as robust as what we have in Trinidad 1.2.
> 
The problem with input file is that JSF2 spec simply does not support it 
at all yet
I have basically brought this up a number of times within the JSF2 ml 
(and I assume there has been a bug filed for it)
if you want file upload you have to bypass the JSF2 ajax api, sadly as 
it is. We (Ganesh, Alex and I) made preparations for the integration of 
such a layer by modularizing the entire codebase as much as possible so 
that you will be able to switch transports on the fly (the hook point is 
our impl class where you can change the request object)

But in the end this needs to be solved on spec level :-(. In my opinion 
this is a huge gap in the spec which should have been covered upfront, 
but there were two reason for doing it as far as I could get it right.
First they wanted to get the ajax part right before extending it, 
secondly multipart form request soon will be first class citizen of
of the JEE spec which it has not been up until now.

Sorry to say all this, but the matter of multipart request is somewhat 
something which leaves a lot of bitter taste in my mouth :-)


Re: [Trinidad 2] PPR and AJAX

Posted by ma...@oracle.com.
Hi Andrew,

Mobile browsers provide very limited support for JavaScript, and the 
level of support varies widely. Hence, unless jsf.ajax.request specially 
handles limitations of a mobile browser, using jsf.ajax.request probably 
won't work in mobile browsers. So to preserve PPR support, for mobile 
browsers, we can continue to use Trinidad APIs instead of jsf.ajax.request.

Thanks
Mamallan

On 2/11/2010 1:10 PM, Andrew Robinson wrote:
> Looking for feedback on the following requirements of the 
> Trinidad+JSF2 AJAX implementation:
>
>    1. Client validation will only occur on requests made through
>       Trinidad APIs
>    2. Calls made to jsf.ajax.request will not perform client-side
>       validation
>    3. Trinidad will use jsf.ajax.request for its requests (after
>       blocking ad client validation has been performed)
>    4. Trinidad will leverage JSF2 server side classes to handle AJAX
>       requests
>    5. Blocking will only be used for requests through the Trinidad APIs
>    6. Calls made to jsf.ajax.request will not block the UI
>
> The code that is not working is multi-part form data (input file) 
> submission and the code that we have for mobile browsers. We will need 
> to determine what we want to do there since the AJAX layer in Mojarra 
> and, I think, MyFaces, is not as robust as what we have in Trinidad 1.2.
>
> -Andrew

Re: [Trinidad 2] PPR and AJAX

Posted by Gabrielle Crawford <ga...@oracle.com>.
Hi Andrew,

Andrew Robinson wrote:
> Looking for feedback on the following requirements of the 
> Trinidad+JSF2 AJAX implementation:
>
>    1. Client validation will only occur on requests made through
>       Trinidad APIs
>    2. Calls made to jsf.ajax.request will not perform client-side
>       validation
>
I have this vague recollection that the inputDate is relying on client 
side conversion in trinidad, I think it sends milliseconds to the server 
rather than the string entered by the user, or maybe this is only 
happening when you open the date picker. I'm not totally sure about all 
this, but you may want to try out an inputDate for the case where you 
don't run client side validation.

Thanks,

Gabrielle