io.reactivex.netty.protocol.http.client.HttpClient.submit()方法的使用及代码示例

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

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

HttpClient.submit介绍

暂无

代码示例

代码示例来源:origin: io.reactivex/rxnetty

protected Observable<HttpClientResponse<O>> redirect(HttpClientRequest<I> redirectRequest,
                           HttpClient.HttpClientConfig config) {
  return client.submit(redirectRequest, config);
}

代码示例来源:origin: com.netflix.rxnetty/rx-netty

protected Observable<HttpClientResponse<O>> redirect(HttpClientRequest<I> redirectRequest,
                           HttpClient.HttpClientConfig config) {
  return client.submit(redirectRequest, config);
}

代码示例来源:origin: com.netflix.rxnetty/rx-netty

public Observable<HttpClientResponse<O>> submit(ServerInfo serverInfo, HttpClientRequest<I> request,
                        HttpClientConfig config) {
  HttpClient<I, O> client = getClient(serverInfo);
  return client.submit(request, config);
}

代码示例来源:origin: com.netflix.rxnetty/rx-netty

public Observable<HttpClientResponse<O>> submit(ServerInfo serverInfo, HttpClientRequest<I> request) {
  HttpClient<I, O> client = getClient(serverInfo);
  return client.submit(request);
}

代码示例来源:origin: io.reactivex/rxnetty

public Observable<HttpClientResponse<O>> submit(ServerInfo serverInfo, HttpClientRequest<I> request,
                        HttpClientConfig config) {
  HttpClient<I, O> client = getClient(serverInfo);
  return client.submit(request, config);
}

代码示例来源:origin: io.reactivex/rxnetty

public Observable<HttpClientResponse<O>> submit(ServerInfo serverInfo, HttpClientRequest<I> request) {
  HttpClient<I, O> client = getClient(serverInfo);
  return client.submit(request);
}

代码示例来源:origin: com.netflix.ribbon/ribbon

@Override
protected Observable<T> construct() {
  Observable<HttpClientResponse<ByteBuf>> httpResponseObservable = httpClient.submit(httpRequest);
  if (validator != null) {
    httpResponseObservable = httpResponseObservable.map(new Func1<HttpClientResponse<ByteBuf>, HttpClientResponse<ByteBuf>>() {

代码示例来源:origin: com.netflix.ribbon/ribbon-transport

@Override
  public Observable<HttpClientResponse<O>> call(Server server) {
    HttpClient<I,O> rxClient = getOrCreateRxClient(server);
    setHostHeader(request, server.getHost());
    
    Observable<HttpClientResponse<O>> o;
    if (rxClientConfig != null) {
      o = rxClient.submit(request, rxClientConfig);
    } 
    else {
      o = rxClient.submit(request);
    }
    
    return o.concatMap(new Func1<HttpClientResponse<O>, Observable<HttpClientResponse<O>>>() {
      @Override
      public Observable<HttpClientResponse<O>> call(HttpClientResponse<O> t1) {
        if (t1.getStatus().code()/100 == 4 || t1.getStatus().code()/100 == 5)
          return responseToErrorPolicy.call(t1, backoffStrategy.call(count.getAndIncrement()));
        else
          return Observable.just(t1);
      }
    });
  }
};

代码示例来源:origin: com.netflix.turbine/turbine-core

.submit(HttpClientRequest.createGet(uri.toASCIIString()))
.flatMap(response -> {
  if (response.getStatus().code() != 200) {

代码示例来源:origin: com.microsoft.azure/azure-documentdb-rx

/**
 * Given the request it creates an observable which upon subscription issues HTTP call and emits one DocumentServiceResponse.
 * 
 * @param request 
 * @param method
 * @return Observable<DocumentServiceResponse> 
 */
public Observable<DocumentServiceResponse> performRequest(RxDocumentServiceRequest request, HttpMethod method) {
  URI uri = getUri(request);
  HttpClientRequest<ByteBuf> httpRequest = HttpClientRequest.create(method, uri.toString());
  this.fillHttpRequestBaseWithHeaders(request.getHeaders(), httpRequest);
  try {
    if (request.getContentObservable() != null) {
      // TODO validate this
      // convert byte[] to ByteBuf
      // why not use Observable<byte[]> directly?
      Observable<ByteBuf> byteBufObservable = request.getContentObservable()
          .map(bytes ->  Unpooled.wrappedBuffer(bytes));
      httpRequest.withContentSource(byteBufObservable);
    } else if (request.getContent() != null){
      httpRequest.withContent(request.getContent());
    }
  } catch (Exception e) {
    return Observable.error(e);
  }
  Observable<HttpClientResponse<ByteBuf>> clientResponseObservable = this.httpClient.submit(httpRequest);
  return toDocumentServiceResponse(clientResponseObservable, request);
}

代码示例来源:origin: com.netflix.iep/iep-rxhttp

/**
 * Execute an HTTP request.
 *
 * @param context
 *     Context associated with the request.
 * @return
 *     Observable with the response of the request.
 */
Observable<HttpClientResponse<ByteBuf>> execute(final RequestContext context) {
 final HttpLogEntry entry = context.entry();
 final HttpClient<ByteBuf, ByteBuf> client = getClient(context);
 entry.mark("start");
 entry.withRemoteAddr(context.server().host());
 entry.withRemotePort(context.server().port());
 return client.submit(context.request())
   .doOnNext(new Action1<HttpClientResponse<ByteBuf>>() {
    @Override public void call(HttpClientResponse<ByteBuf> res) {
     update(entry, res);
     HttpLogEntry.logClientRequest(entry);
    }
   })
   .doOnError(new Action1<Throwable>() {
    @Override public void call(Throwable throwable) {
     update(entry, throwable);
     HttpLogEntry.logClientRequest(entry);
    }
   })
   .doOnTerminate(Actions.empty());
}

相关文章