f:ajax and p:ajax request queues

UI Components for JSF
callahan
Posts: 768
Joined: 27 May 2010, 22:52

05 Dec 2010, 19:07

Both f:ajax and p:ajax queue their requests on the browser and execute them sequentially. This means that the browser waits for one ajax request to complete before sending the next one. However, when both f:ajax and p:ajax are used on the same page, there are two request queues, not one. f:ajax and p:ajax use different request queues. This means that f:ajax and p:ajax requests can be executed concurrently.

What is the easiest way to avoid this, and ensure that f:ajax and p:ajax requests are not executed concurrently?

User avatar
gmaldonadonaval
Posts: 6
Joined: 01 Dec 2010, 03:53
Location: Mexico, Jalisco, Guadalajara

06 Dec 2010, 00:22

I needed before do something like you, but at the end I used the same technology in the page, I used f:ajax only.

Can you put your example please? I wants understand what do you want to do.
Autobot
Java Architect
Primefaces 2.2 RC2, Mojarra 2.0.3, Tomcat 6.0, JSF 2.0

callahan
Posts: 768
Joined: 27 May 2010, 22:52

06 Dec 2010, 01:45

Good evening Mexico :),

I have a few composite components I wrote myself that use f:ajax internally. I'm using these components on a page with PrimeFaces components that, naturally enough, use p:ajax internally. Most of the time everything functions correctly, however, there can be problems when the user clicks something that fires an f:ajax request when a different part of the page using p:ajax is still being processed/executed. This is happening because the different technologies are using different ajax queues that are not synchronized.

I'd imagine that my only option at the moment is to do what you suggest, i.e., use the same technology. I can't modify the PrimeFaces components to use f:ajax, so I have to modify my components to used p:ajax.

I somehow feel that something isn't quite right here though. IMHO there should only be one queue for all ajax requests from all components, no matter what person or component library the components are from.

User avatar
gmaldonadonaval
Posts: 6
Joined: 01 Dec 2010, 03:53
Location: Mexico, Jalisco, Guadalajara

06 Dec 2010, 03:26

Sorry but I don't have any other solution, you need change your components to use p:ajax.

Richfaces created a AJAX queue to solve this problem but that solution imply more work and research.

In javascript if you create two instances of ajax objects you have two diferents channels then JSF creates their own channel like Primefaces.

When you mix two or more AJAX technologies is a headache :(
Autobot
Java Architect
Primefaces 2.2 RC2, Mojarra 2.0.3, Tomcat 6.0, JSF 2.0

callahan
Posts: 768
Joined: 27 May 2010, 22:52

06 Dec 2010, 13:05

Hmm, maybe it's possible to intercept the calls to PrimeFaces.ajax.AjaxRequest and jsf.ajax.request and place them on a third request queue that synchronizes everything correctly.

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

06 Dec 2010, 16:44

Hi,

I set for all my p:ajax calls async="true" und don't have problem anymore :-). Queued or not queued requests - doesn't really matter in practice (from my point of view).
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

callahan
Posts: 768
Joined: 27 May 2010, 22:52

06 Dec 2010, 17:10

Wow, you must be able to process requests really quickly.

callahan
Posts: 768
Joined: 27 May 2010, 22:52

19 Feb 2011, 13:26

Hmm, the other leading component suite from Red Hat intercepts calls to jsf.ajax.request inorder to keep everything synchronized. It would be great if PrimeFaces did the same :).

User avatar
bumble.bee
Posts: 723
Joined: 29 Sep 2010, 21:39
Location: United States

20 Feb 2011, 03:55

I'd vote for that. Is there an issue ticket?

callahan
Posts: 768
Joined: 27 May 2010, 22:52

21 Feb 2011, 11:07

For bumble.bee and anyone else who would like to see this fixed, here's the issue to vote for: http://code.google.com/p/primefaces/iss ... il?id=1762

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 50 guests