com.google.gwt.xhr.client.XMLHttpRequest.clearOnReadyStateChange()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中com.google.gwt.xhr.client.XMLHttpRequest.clearOnReadyStateChange()方法的一些代码示例,展示了XMLHttpRequest.clearOnReadyStateChange()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLHttpRequest.clearOnReadyStateChange()方法的具体详情如下:
包路径:com.google.gwt.xhr.client.XMLHttpRequest
类名称:XMLHttpRequest
方法名:clearOnReadyStateChange

XMLHttpRequest.clearOnReadyStateChange介绍

[英]Clears the ReadyStateChangeHandler.

See http://www.w3.org/TR/XMLHttpRequest/#handler-xhr-onreadystatechange.
[中]清除ReadyStateChangeHandler。
http://www.w3.org/TR/XMLHttpRequest/#handler-xhr-onreadystatechange

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

public void onReadyStateChange(XMLHttpRequest xhr) {
  if (xhr.getReadyState() == XMLHttpRequest.DONE) {
   xhr.clearOnReadyStateChange();
   request.fireOnResponseReceived(callback);
  }
 }
});

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Cancels a pending request. If the request has already been canceled or if
 * it has timed out no action is taken.
 */
public void cancel() {
 if (xmlHttpRequest == null) {
  return;
 }
 timer.cancel();
 /*
  * There is a strange race condition that occurs on Mozilla when you cancel
  * a request while the response is coming in. It appears that in some cases
  * the onreadystatechange handler is still called after the handler function
  * has been deleted and during the call to XmlHttpRequest.abort(). So we
  * null the xmlHttpRequest here and that will prevent the
  * fireOnResponseReceived method from calling the callback function.
  * 
  * Setting the onreadystatechange handler to null gives us the correct
  * behavior in Mozilla but crashes IE. That is why we have chosen to fixed
  * this in Java by nulling out our reference to the XmlHttpRequest object.
  */
 final XMLHttpRequest xhr = xmlHttpRequest;
 xmlHttpRequest = null;
 xhr.clearOnReadyStateChange();
 xhr.abort();
}

代码示例来源:origin: org.atmosphere/atmosphere-gwt-client

private void onLoaded(int statusCode, String responseText) {
  xmlHttpRequest.clearOnReadyStateChange();
  xmlHttpRequest = null;
  onReceiving(statusCode, responseText, false);
}

代码示例来源:origin: com.googlecode.gwtquery/gwtquery

public void onReadyStateChange(XMLHttpRequest xhr) {
  if (xhr.getReadyState() == XMLHttpRequest.DONE) {
   xhr.clearOnReadyStateChange();
   fireOnResponseReceivedVltr(request, PromiseReqBuilder.this);
  }
 }
});

代码示例来源:origin: com.vaadin.external.atmosphere/atmosphere-gwt-client

private void onLoaded(int statusCode, String responseText) {
  xmlHttpRequest.clearOnReadyStateChange();
  xmlHttpRequest = null;
  onReceiving(statusCode, responseText, false);
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

public void onReadyStateChange(XMLHttpRequest xhr) {
  if (xhr.getReadyState() == XMLHttpRequest.DONE) {
   xhr.clearOnReadyStateChange();
   request.fireOnResponseReceived(callback);
  }
 }
});

代码示例来源:origin: net.wetheinter/gwt-user

public void onReadyStateChange(XMLHttpRequest xhr) {
  if (xhr.getReadyState() == XMLHttpRequest.DONE) {
   xhr.clearOnReadyStateChange();
   request.fireOnResponseReceived(callback);
  }
 }
});

代码示例来源:origin: io.reinert.requestor.core/requestor-api

public void onReadyStateChange(com.google.gwt.xhr.client.XMLHttpRequest xhr) {
    if (xhr.getReadyState() == XMLHttpRequest.DONE) {
      xhr.clearOnReadyStateChange();
      ((XMLHttpRequest) xhr).clearOnProgress();
      gwtRequest.fireOnResponseReceived(callback);
    }
  }
});

代码示例来源:origin: reinert/requestor

public void onReadyStateChange(com.google.gwt.xhr.client.XMLHttpRequest xhr) {
    if (xhr.getReadyState() == XMLHttpRequest.DONE) {
      xhr.clearOnReadyStateChange();
      ((XMLHttpRequest) xhr).clearOnProgress();
      gwtRequest.fireOnResponseReceived(callback);
    }
  }
});

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

/**
 * Cancels a pending request. If the request has already been canceled or if
 * it has timed out no action is taken.
 */
public void cancel() {
 if (xmlHttpRequest == null) {
  return;
 }
 timer.cancel();
 /*
  * There is a strange race condition that occurs on Mozilla when you cancel
  * a request while the response is coming in. It appears that in some cases
  * the onreadystatechange handler is still called after the handler function
  * has been deleted and during the call to XmlHttpRequest.abort(). So we
  * null the xmlHttpRequest here and that will prevent the
  * fireOnResponseReceived method from calling the callback function.
  * 
  * Setting the onreadystatechange handler to null gives us the correct
  * behavior in Mozilla but crashes IE. That is why we have chosen to fixed
  * this in Java by nulling out our reference to the XmlHttpRequest object.
  */
 final XMLHttpRequest xhr = xmlHttpRequest;
 xmlHttpRequest = null;
 xhr.clearOnReadyStateChange();
 xhr.abort();
}

代码示例来源:origin: net.wetheinter/gwt-user

/**
 * Cancels a pending request. If the request has already been canceled or if
 * it has timed out no action is taken.
 */
public void cancel() {
 if (xmlHttpRequest == null) {
  return;
 }
 timer.cancel();
 /*
  * There is a strange race condition that occurs on Mozilla when you cancel
  * a request while the response is coming in. It appears that in some cases
  * the onreadystatechange handler is still called after the handler function
  * has been deleted and during the call to XmlHttpRequest.abort(). So we
  * null the xmlHttpRequest here and that will prevent the
  * fireOnResponseReceived method from calling the callback function.
  * 
  * Setting the onreadystatechange handler to null gives us the correct
  * behavior in Mozilla but crashes IE. That is why we have chosen to fixed
  * this in Java by nulling out our reference to the XmlHttpRequest object.
  */
 final XMLHttpRequest xhr = xmlHttpRequest;
 xmlHttpRequest = null;
 xhr.clearOnReadyStateChange();
 xhr.abort();
}

代码示例来源:origin: io.reinert.requestor.core/requestor-api

/**
 * Cancels a pending request. If the request has already been canceled or if
 * it has timed out no action is taken.
 */
public void cancel() {
  if (xmlHttpRequest == null) {
    return;
  }
  timer.cancel();
/*
 * There is a strange race condition that occurs on Mozilla when you cancel
 * a request while the response is coming in. It appears that in some cases
 * the onreadystatechange handler is still called after the handler function
 * has been deleted and during the call to XmlHttpRequest.abort(). So we
 * null the xmlHttpRequest here and that will prevent the
 * fireOnResponseReceived method from calling the callback function.
 * 
 * Setting the onreadystatechange handler to null gives us the correct
 * behavior in Mozilla but crashes IE. That is why we have chosen to fixed
 * this in Java by nulling out our reference to the XmlHttpRequest object.
 */
  final XMLHttpRequest xhr = xmlHttpRequest;
  xmlHttpRequest = null;
  xhr.clearOnReadyStateChange();
  xhr.abort();
}

代码示例来源:origin: org.atmosphere/atmosphere-gwt-client

@Override
  public void run() {
    r.clearOnReadyStateChange();
    if (r.getReadyState() != XMLHttpRequest.DONE
        && r.getReadyState() != XMLHttpRequest.UNSENT) {
      listener.onDisconnected();
      r.abort();
    }
    r = null;
  }
}.schedule(5000);

代码示例来源:origin: com.vaadin.external.atmosphere/atmosphere-gwt-client

@Override
  public void run() {
    r.clearOnReadyStateChange();
    if (r.getReadyState() != XMLHttpRequest.DONE
        && r.getReadyState() != XMLHttpRequest.UNSENT) {
      listener.onDisconnected();
      r.abort();
    }
    r = null;
  }
}.schedule(5000);

代码示例来源:origin: org.atmosphere/atmosphere-gwt-client

if (xmlHttpRequest.getReadyState() >= XMLHttpRequest.HEADERS_RECEIVED) {
  xmlHttpRequest.clearOnReadyStateChange();
  if (xmlHttpRequest.getReadyState() != XMLHttpRequest.DONE) {
    listener.onDisconnected();

代码示例来源:origin: com.vaadin.external.atmosphere/atmosphere-gwt-client

if (xmlHttpRequest.getReadyState() >= XMLHttpRequest.HEADERS_RECEIVED) {
  xmlHttpRequest.clearOnReadyStateChange();
  if (xmlHttpRequest.getReadyState() != XMLHttpRequest.DONE) {
    listener.onDisconnected();

代码示例来源:origin: com.vaadin.external.atmosphere/atmosphere-gwt-client

@Override
  public void onReadyStateChange(XMLHttpRequest request) {
    if (!aborted) {
      switch (request.getReadyState()) {
        case XMLHttpRequest.LOADING:
          onReceiving(request.getStatus(), request.getResponseText());
          if (needPolling()) {
            pollingTimer.scheduleRepeating(POLLING_INTERVAL);
          }
          break;
        case XMLHttpRequest.DONE:
          onLoaded(request.getStatus(), request.getResponseText());
          pollingTimer.cancel();
          break;
      }
    } else {
      request.clearOnReadyStateChange();
      if (request.getReadyState() != XMLHttpRequest.DONE) {
        request.abort();
      }
    }
  }
});

代码示例来源:origin: org.atmosphere/atmosphere-gwt-client

@Override
  public void onReadyStateChange(XMLHttpRequest request) {
    if (!aborted) {
      switch (request.getReadyState()) {
        case XMLHttpRequest.LOADING:
          onReceiving(request.getStatus(), request.getResponseText());
          if (needPolling()) {
            pollingTimer.scheduleRepeating(POLLING_INTERVAL);
          }
          break;
        case XMLHttpRequest.DONE:
          onLoaded(request.getStatus(), request.getResponseText());
          pollingTimer.cancel();
          break;
      }
    } else {
      request.clearOnReadyStateChange();
      if (request.getReadyState() != XMLHttpRequest.DONE) {
        request.abort();
      }
    }
  }
});

相关文章