com.google.gwt.http.client.Request.cancel()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(451)

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

Request.cancel介绍

[英]Cancels a pending request. If the request has already been canceled or if it has timed out no action is taken.
[中]取消挂起的请求。如果请求已被取消或超时,则不会采取任何操作。

代码示例

代码示例来源:origin: libgdx/libgdx

@Override
public void cancelHttpRequest (HttpRequest httpRequest) {
  HttpResponseListener httpResponseListener = listeners.get(httpRequest);
  Request request = requests.get(httpRequest);
  if (httpResponseListener != null && request != null) {
    request.cancel();
    httpResponseListener.cancelled();
    requests.remove(httpRequest);
    listeners.remove(httpRequest);
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
public void cancelHttpRequest (HttpRequest httpRequest) {
  HttpResponseListener httpResponseListener = listeners.get(httpRequest);
  Request request = requests.get(httpRequest);
  if (httpResponseListener != null && request != null) {
    request.cancel();
    httpResponseListener.cancelled();
    requests.remove(httpRequest);
    listeners.remove(httpRequest);
  }
}

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

private void fireOnTimeout() {
  if (xmlHttpRequest == null) {
   // the request has been received at this point
   return;
  }

  cancel();

  callback.onError(this, new RequestTimeoutException(this, timeoutMillis));
 }
}

代码示例来源:origin: org.jboss.errai/errai-bus

@Override
public Collection<Message> stop(final boolean stopAllCurrentRequests) {
 receiveCommCallback.cancel();
 throttleTimer.cancel();
 
 try {
  if (stopAllCurrentRequests) {
   // Now stop all the in-flight XHRs
   for (final RxInfo r : pendingRequests) {
    r.getRequest().cancel();
   }
   pendingRequests.clear();
   return new ArrayList<Message>(undeliveredMessages);
  }
  else {
   return Collections.emptyList();
  }
 }
 finally {
  undeliveredMessages.clear();
 }
}

代码示例来源:origin: com.ahome-it/ahome-tooling-nativetools

@Override
public final void cancel()
{
  m_rqst.cancel();
}

代码示例来源:origin: com.gwtplatform/gwtp-dispatch-client

@Override
public void cancel() {
  request.cancel();
}

代码示例来源:origin: com.asayama.gwt.angular/gwt-angular-http

@Override
  public void cancel() {
    request.cancel();
  }
}

代码示例来源:origin: org.jboss.as/jboss-as-console-dmr

@Override
public void cancel()
{
  if (delegate != null)
  {
    delegate.cancel();
  }
}

代码示例来源:origin: ArcBees/GWTP

@Override
public void cancel() {
  request.cancel();
}

代码示例来源:origin: com.gwtplatform/gwtp-dispatch-common-client

@Override
public void cancel() {
  request.cancel();
}

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

public void cancel() {
  gwtRequest.cancel();
}

代码示例来源:origin: EmiteGWT/emite

@Override
  public void onWindowClosing(@Nullable final Window.ClosingEvent event) {
    int i = requests.size() - 2;
    logger.finer("Cancelling " + (i + 1) + " pending requests.");
    for (; i >= 0; i--) {
      requests.get(i).cancel();
    }
    logger.finer("Cancelled all requests.");
  }
});

代码示例来源:origin: Putnami/putnami-web-toolkit

@Override
  public void onButtonAction(ButtonEvent event) {
    if (InputFile.this.sendRequest != null) {
      InputFile.this.sendRequest.cancel();
    }
    InputFile.this.edit(null);
  }
});

代码示例来源:origin: fr.putnami.pwt/pwt

@Override
  public void onButtonAction(ButtonEvent event) {
    if (InputFile.this.sendRequest != null) {
      InputFile.this.sendRequest.cancel();
    }
    InputFile.this.edit(null);
  }
});

代码示例来源:origin: stackoverflow.com

RequestBuilder requestBuilder = new RequestBuilder(
  RequestBuilder.GET, FOOBAR_SERVICE_URL);

Request request = requestBuilder.sendRequest("",
  new RequestCallback<ResultList>() { .... });

...

//user clicked cancel button
request.cancel();

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

@Override
public void cancel() {
 super.cancel();
 if (request != null) {
  request.cancel();
 }
}

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

private void fireOnTimeout() {
  if (xmlHttpRequest == null) {
   // the request has been received at this point
   return;
  }

  cancel();

  callback.onError(this, new RequestTimeoutException(this, timeoutMillis));
 }
}

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

private void fireOnTimeout() {
  if (xmlHttpRequest == null) {
   // the request has been received at this point
   return;
  }

  cancel();

  callback.onError(this, new RequestTimeoutException(this, timeoutMillis));
 }
}

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

private void fireOnTimeout() {
    if (xmlHttpRequest == null) {
      // the request has been received at this point
      return;
    }

    cancel();

    callback.onError(this, new RequestTimeoutException(this, timeoutMillis));
  }
}

代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-gwt

@Override
public void cancelHttpRequest (HttpRequest httpRequest) {
  HttpResponseListener httpResponseListener = listeners.get(httpRequest);
  Request request = requests.get(httpRequest);
  if (httpResponseListener != null && request != null) {
    request.cancel();
    httpResponseListener.cancelled();
    requests.remove(httpRequest);
    listeners.remove(httpRequest);
  }
}

相关文章