webtier@glassfish.java.net

jsf.ajax.response: send success event in all "success" cases

From: Lucas Ventura Carro <useyour.mind_at_gmail.com>
Date: Wed, 11 Feb 2015 13:32:49 +0100

I'm developing a webapp with AJAX requests, using plain JSF2 and JavaScript.

As I need to get called back to a JS function after a success status
response, I added the callback with 'jsf.ajax.addOnEvent'.
One of the server responses is to force the browser to redirect, using the
method 'javax.faces.context.ExternalContext.redirect(String)'. So
partial-response content is the redirect itself.
But in my callback, if I only watch the "data.status === success", the
redirect partial-response never gets in that case.

Looking the JS source code [1], success status event is not send in that
case, and other "success" cases.
Is there any reason not to callback in those cases?

I need to update the view, because the forced redirect is not as fast as it
should be, so view is not consistent and JS continues executing.
If you need some example, ask it ;)

Thanks!

  [1]:
https://svn.java.net/svn/mojarra~svn/tags/2.2.9/jsf-api/src/main/resources/jsf.js
--
Lucas