Abort HTTP-Request Server process
Asked Answered
M

0

0

As shown in Abort DoJo XHR-Request it is possible to cancel a (dojo/request/xhr) http request on the Client. The problem is, that the according server process (initiated by the request) is still running.

If we use a XMLHttpRequest-Object, calling abort() on it would stop the server process.

So the question is: Is it possible to achive this with dojo? Or is it possible to get access to the internal XMLHttpRequest-Object (used by dojo/request/xhr) to call abort() on it?

Mayfly answered 8/3, 2014 at 18:16 Comment(5)
dojo/request/xhr calls abort on the underlying xhr object when you cancel, so it's not clear why it should behave any differently than calling xhr.abort directly; see here and here. Are you testing with the same service in both cases?Easter
Ah, thanks for this information. I must review...Mayfly
I call cancel(). Then the error handler of the request is called. This is good. But the Server process (a long poll) is still running (I can see it in my logfile). Maybe it could be a solution if the server process could detect the cancelation. In this case it could terminate itself!?Mayfly
Yes, you might need to do something on the server end to abort a process when the connection aborts. Check your net tab in firebug / developer tools to make sure the request shows up as canceled once cancel is called; beyond that there's no more you can do client-side.Easter
My mistake was, that in my obsolet version the page has been reloaded on each user action. So my "abort" on the server seems to work. But with AJAX there is another environment. Sorry.Mayfly

© 2022 - 2024 — McMap. All rights reserved.