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

x33g5p2x  于2022-01-28 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(141)

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

RequestBuilder.setTimeoutMillis介绍

[英]Sets the number of milliseconds to wait for a request to complete. Should the request timeout, the com.google.gwt.http.client.RequestCallback#onError(Request,Throwable)method will be called on the callback instance given to the com.google.gwt.http.client.RequestBuilder#sendRequest(String,RequestCallback)method. The callback method will receive an instance of the com.google.gwt.http.client.RequestTimeoutException class as its java.lang.Throwable argument.
[中]设置等待请求完成的毫秒数。如果请求超时,com。谷歌。gwt。http。客户RequestCallback#onError(Request,Throwable)方法将在给定给com的回调实例上调用。谷歌。gwt。http。客户RequestBuilder#sendRequest(字符串,RequestCallback)方法。回调方法将接收com的一个实例。谷歌。gwt。http。客户RequestTimeoutException类作为其java。lang.可抛弃的论点。

代码示例

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

builder.setTimeoutMillis(httpRequest.getTimeOut());

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

builder.setTimeoutMillis(httpRequest.getTimeOut());

代码示例来源:origin: org.fusesource.restygwt/restygwt

public Method timeout(int timeout) {
  builder.setTimeoutMillis(timeout);
  return this;
}

代码示例来源:origin: resty-gwt/resty-gwt

public Method timeout(int timeout) {
  builder.setTimeoutMillis(timeout);
  return this;
}

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

protected RequestBuilder createRequest(Method method, int timeout, String...params) {
 RequestBuilder reqBuilder = new RequestBuilder(RequestBuilder.GET, composeURL(params));
 reqBuilder.setTimeoutMillis(timeout);
 return reqBuilder;
}

代码示例来源:origin: org.restlet/org.restlet.gwt

/**
 * Constructor.
 * 
 * @param helper
 *            The parent HTTP client helper.
 * @param method
 *            The method name.
 * @param requestUri
 *            The request URI.
 * @param hasEntity
 *            Indicates if the call will have an entity to send to the
 *            server.
 */
public GwtHttpClientCall(GwtHttpClientHelper helper, String method,
    String requestUri, boolean hasEntity) {
  super(helper, method, requestUri);
  if (requestUri.startsWith("http")) {
    this.requestBuilder = new RequestBuilder(method, requestUri) {
    };
    this.requestBuilder.setTimeoutMillis(getHelper().getTimeout());
    this.responseHeadersAdded = false;
  } else {
    throw new IllegalArgumentException(
        "Only HTTP or HTTPS resource URIs are allowed here");
  }
}

代码示例来源:origin: org.realityforge.replicant/replicant-client

@Nonnull
private RequestBuilder newRequestBuilder( @Nonnull final RequestBuilder.Method method,
                     @Nonnull final String url )
{
 final RequestBuilder rb = new RequestBuilder( method, url );
 //Timeout 2 seconds after maximum poll
 rb.setTimeoutMillis( ( SharedConstants.MAX_POLL_TIME_IN_SECONDS + 2 ) * 1000 );
 rb.setHeader( "Pragma", "no-cache" );
 final String authenticationToken = getAuthenticationToken();
 if ( null != authenticationToken )
 {
  rb.setHeader( "Authorization", "Bearer " + authenticationToken );
 }
 return rb;
}

代码示例来源:origin: org.fusesource.restygwt/restygwt

private void doSetTimeout() {
  // Use default timeout only if it was not already set through the @Options(timeout =) annotation.
  // See https://github.com/resty-gwt/resty-gwt/issues/206
  if (builder.getTimeoutMillis() == 0 && Defaults.getRequestTimeout() > -1) {
    builder.setTimeoutMillis(Defaults.getRequestTimeout());
  }
}

代码示例来源:origin: resty-gwt/resty-gwt

private void doSetTimeout() {
  // Use default timeout only if it was not already set through the @Options(timeout =) annotation.
  // See https://github.com/resty-gwt/resty-gwt/issues/206
  if (builder.getTimeoutMillis() == 0 && Defaults.getRequestTimeout() > -1) {
    builder.setTimeoutMillis(Defaults.getRequestTimeout());
  }
}

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

@Override
  public <A extends RestAction<?>> RequestBuilder build(A action, String securityToken) throws ActionException {
    Method httpMethod = HTTP_METHOD_TO_REQUEST_BUILDER.get(action.getHttpMethod());
    String url = uriFactory.buildUrl(action);

    RequestBuilder requestBuilder = httpRequestBuilderFactory.create(httpMethod, url);
    requestBuilder.setTimeoutMillis(requestTimeoutMs);

    headerFactory.buildHeaders(requestBuilder, action, securityToken);
    bodyFactory.buildBody(requestBuilder, action);

    return requestBuilder;
  }
}

代码示例来源:origin: com.github.nmorel.gwtjackson/gwt-jackson-rest-api

builder.setTimeoutMillis( timeoutMillis );

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

builder.setTimeoutMillis(httpRequest.getTimeOut());

相关文章