4 Replies Latest reply on May 30, 2006 10:44 AM by Keith Naas

    cancelling remoting requests

    Keith Naas Newbie

      Any thoughts about JIRA issue 240?

      http://jira.jboss.com/jira/browse/JBSEAM-240

      The ajax request object does support aborting of a command. If that object could be somehow be held onto, it would be easy to do.

      For instance, Seam.Remoting.sendAjaxRequest could return the asyncReq. Then, inside of Seam.Remoting.execute, that async request could be placed into a map keyed by callId. That callId could then be returned back to the javascript client code that is invoking the remote method. If the js client wanted to cancel the request, one could call a method such as

      Seam.Remoting.cancel = function(callId)
      {
       var asyncReq = Seam.Remoting.requests.get(callId);
       Seam.Remoting.requests.remove(callId);
       if (asyncReq) {
       asyncReq.abort();
       }
      }
      


      Of course, this requests map would also need to be cleaned up when the asyncRequest finished.

      I'm sure there's probably a much better way to do this.