Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non queued AJAX requests and ES6 modules #4946

Closed
varoliver opened this issue Aug 4, 2021 · 10 comments
Closed

Non queued AJAX requests and ES6 modules #4946

varoliver opened this issue Aug 4, 2021 · 10 comments
Labels

Comments

@varoliver
Copy link

Hi,

it would be great if JSF/mojarra would provide following features for modern web development:

  1. Non-queued AJAX requests
    I know the reasons why the requests get queued, but the Spec and mojarra should provide
    the possibility for parallelization of multiple AJAX requests like primefaces does with async=true.
    Of course developers would have to use this feature with care in a stateless/RequestScoped environment.

  2. Support of ES6 modules
    If an AJAX response containes inline JS code of type "module"
    <script type="module">
    it won't get executed. mojarra uses eval for inline JS execution
    and eval does not support modules/imports.
    It works with primefaces ajax because they directly manipulate the DOM with replaceChild (via jquery)

We have a dependency on primefaces only because of these shortcomings, which is not nice.
Apart from that I think JSF is a nice mature framework.

Thx, kind regards
Oliver

@mnriem mnriem added the 4.0 label Nov 27, 2021
@mnriem mnriem removed the 4.0 label Feb 6, 2022
@mnriem
Copy link
Contributor

mnriem commented Feb 6, 2022

@varoliver We would love to see something like this. Is this something you can work on? Note it won't make it for 4.0, but with your efforts maybe for 5.0?

@mnriem mnriem added the 5.0 label Mar 3, 2022
@varoliver
Copy link
Author

Hi @mnriem
thx for your reply. Unfortunately not at the moment.
But as I read there are already some interesting things going on. @BalusC offered to do a rewrite of faces.js in
#5044 (comment)
Maybe he could implement Point 2 "Support of ES6 modules" within the scope of that rewrite?

Kind regards
Oliver

@pizzi80
Copy link
Contributor

pizzi80 commented Jun 24, 2022

What do you mean for "async" request?

actually inside faces.js what I see is:

req.async = true;              // Default - Asynchronous
req.xmlReq.open(req.method, req.url, req.async);

so basically the request is async

from the Mozilla doc:

If you use an asynchronous XMLHttpRequest, you receive a callback when the data has been received. This lets the browser continue to work as normal while your request is being handled.

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Synchronous_and_Asynchronous_Requests#asynchronous_request

@varoliver
Copy link
Author

Yes, the requests are async but multiple requests get queued by JSF.
The browser could and should execute them in parallel.

@pizzi80
Copy link
Contributor

pizzi80 commented Sep 28, 2022

I'll try to implement this on my forked mojarra!

... I made a PR of my faces.js version but it's still in the air ... :|

#5141

@melloware
Copy link
Contributor

Nice @pizzi80 that would be great.

@mnriem
Copy link
Contributor

mnriem commented Sep 18, 2023

@pizzi80 What is the status of this issue? Is the PR complete?

@pizzi80
Copy link
Contributor

pizzi80 commented Sep 19, 2023

1. Non-queued AJAX requests

We probably need to add a boolean async attribute with the default value false to <f:ajax />
and assign it inside the AjaxHandler / AjaxBehavior processing

If I'm not mistaken I think this requires a ticket on the Faces API

After that, in "faces.js" the "sendRequest" method will skip
the queue and immediately send the "XMLHttpRequest" if "async" is true

I'm going to open the ticket to Faces API

2. Support of ES6 modules

Interesting... I'm currently developing a new, unified DOM replacement algorithm.
However, I've temporarily halted this work because the AJAX tests for Faces TCK are no longer functioning!

Before replacing 300 lines of code I think it's a good idea to have the ajax tests working :)

@mnriem
Copy link
Contributor

mnriem commented Sep 19, 2023

@pizzi80 Looks like a spec change here. Should it be tracked there?

@BalusC
Copy link
Contributor

BalusC commented Sep 16, 2024

Indeed belongs in jakartaee/faces project.

  1. Non-queued AJAX requests

Please continue in jakartaee/faces#1844.

  1. Support of ES6 modules

Please continue in jakartaee/faces#1598.

@BalusC BalusC closed this as completed Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants