if (request.retryCount > 0) {
// disable caching if we have to retry; one cause could be bad cache
xhr.setRequestHeader("Cache-Control", "no-cache");
}
xhr.setOnReadyStateChange(new ReadyStateChangeHandler() {
public void onReadyStateChange(XMLHttpRequest ignored) {
if (xhr.getReadyState() == XMLHttpRequest.DONE) {
xhr.clearOnReadyStateChange();
if ((xhr.getStatus() == HTTP_STATUS_OK || xhr.getStatus() == HTTP_STATUS_NON_HTTP)
&& xhr.getResponseText() != null