Possible to cancel XForms http request from client side?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Possible to cancel XForms http request from client side?

Vedha
Possible to cancel XForms http request from client side?

I have two pages in my application, let's call as , FIRST page and SECOND page.

FIRST page is simple angularJs page.
SECOND page is having complex xforms form.

User's are allowed to navigate between FIRST and SECOND anytime.

When a User is in SECOND page and performs a XForms action thats is still in progress and before it completes, user tries to navigate to FIRST page. How to cancel la Ajax request which is in progress and navigate to FIRST?
rac
Reply | Threaded
Open this post in threaded view
|

Re: Possible to cancel XForms http request from client side?

rac
Doesnt it fall into more general problem where u can not simply cancel http request completely?

https://lists.w3.org/Archives/Public/ietf-http-wg/2003OctDec/0012.html

You can cancel angularjs promise (which is like abandoning its results on client side), but you are not guaranteed what happens to backend transaction - if http request was sent, transaction will probably be completed even if it's about to take few minutes after your client-side request cancel.
Reply | Threaded
Open this post in threaded view
|

Re: Possible to cancel XForms http request from client side?

Alessandro  Vernet
Administrator
In reply to this post by Vedha
Hi Vedha,

As mentioned by Radek, there is no mechanism in HTTP to "cancel a request". Will the request the user does on SECOND have a side-effect? If not, maybe you don't need to worry about canceling it; the user clicks on a link taking her from SECOND to FIRST, the browser closes the HTTP connection started by the Ajax request, and when the server finishes its processing, it tries to write an answer, but notices the connection was closed, so logs an exception on the server, but it's all fine from the user's perspective.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Possible to cancel XForms http request from client side?

Vedha
Thanks to both. I understand now.

The side effect which i was getting is the angular loading bar. Angular loading bar will be displayed for all http requests made by xforms. Since we navigate before the http request completes, loading bar starts behaving incorrectly(it keeps loading even without any http connection).

By the way, i was able to resolve this by, manually stopping the angular loading before any page navigation.
Reply | Threaded
Open this post in threaded view
|

Re: Possible to cancel XForms http request from client side?

Alessandro  Vernet
Administrator
Hi Vedha,

Good, I'm glad you found a solution to this one. And thanks for the update.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet