com.squareup.okhttp.Request.method()方法的使用及代码示例

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

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

Request.method介绍

暂无

代码示例

代码示例来源:origin: facebook/stetho

@Override
public String method() {
 return mRequest.method();
}

代码示例来源:origin: zalando/logbook

@Override
public String getMethod() {
  return request.method();
}

代码示例来源:origin: cn-ljb/rxjava_for_android

Protocol protocol = connection != null ? connection.getProtocol() : Protocol.HTTP_1_1;
StringBuilder requestStartMessage = new StringBuilder();
requestStartMessage.append("--> " + request.method() + ' ' + request.url() + ' ' + protocol(protocol));
if (!logHeaders && hasRequestBody) {
  requestStartMessage.append(" (" + requestBody.contentLength() + BYTE_BODY);
    logger.log(END + request.method());
  } else if (bodyEncoded(request.headers())) {
    logger.log(END + request.method() + " (encoded body omitted)");
  } else {
    Buffer buffer = new Buffer();
    logger.log(buffer.readString(charset));
    logger.log(END + request.method()
        + " (" + requestBody.contentLength() + BYTE_BODY);

代码示例来源:origin: zalando/logbook

static boolean canSkipBody(Response response) {
  if("HEAD".equals(response.request().method())) {
    return true;
  }
  return response.code() == HTTP_NO_CONTENT || response.code() == HTTP_NOT_MODIFIED;
}

代码示例来源:origin: org.echocat.marquardt/client

private void writeRequestTo(final Request request, final ByteArrayOutputStream bytesToSign) throws IOException {
  final byte[] requestBytes = (request.method() + " " + request.uri().getPath()).getBytes();
  bytesToSign.write(Ints.toByteArray(requestBytes.length));
  bytesToSign.write(requestBytes);
  for (final SignatureHeaders headerToInclude : SignatureHeaders.values()) {
    final String headerValue = request.header(headerToInclude.getHeaderName());
    if (headerValue != null) {
      final byte[] headerBytes = (headerToInclude.getHeaderName() + ":" + headerValue).getBytes();
      bytesToSign.write(Ints.toByteArray(headerBytes.length));
      bytesToSign.write(headerBytes);
    }
  }
}

代码示例来源:origin: com.stanfy.helium/helium

public static void assertCorrectEntity(final TypedEntity entity, final Response response) {
 if (entity.getValidationError() != null) {
  Request request = response.request();
  throw failure(
    request.method() + " " + request.urlString() + "\n"
      + "--------- Validation problems ---------\n"
      + entity.getValidationError(),
    request, response
  );
 }
}

代码示例来源:origin: PaNaVTEC/Clean-Contacts

private Request composeRequest(Chain chain) {
 HttpUrl url = composeUrl(chain);
 Request original = chain.request();
 return original.newBuilder()
   .url(url)
   .header("User-Agent", userAgent)
   .method(original.method(), original.body())
   .build();
}

代码示例来源:origin: NightscoutFoundation/xDrip

@Override
public Response intercept(Chain chain) throws IOException {
  Request originalRequest = chain.request();
  if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
    return chain.proceed(originalRequest);
  }
  Request compressedRequest = originalRequest.newBuilder()
      .header("Content-Encoding", "gzip")
      .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body())))
      .build();
  return chain.proceed(compressedRequest);
}

代码示例来源:origin: kubernetes-client/java

@Override public Response intercept(Chain chain) throws IOException {
  Request originalRequest = chain.request();
  if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
    return chain.proceed(originalRequest);
  }
  Request compressedRequest = originalRequest.newBuilder()
                        .header("Content-Encoding", "gzip")
                        .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body())))
                        .build();
  return chain.proceed(compressedRequest);
}

代码示例来源:origin: de.adorsys.multibanking/xs2a-adapter

@Override public Response intercept(Chain chain) throws IOException {
  Request originalRequest = chain.request();
  if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
    return chain.proceed(originalRequest);
  }
  Request compressedRequest = originalRequest.newBuilder()
                        .header("Content-Encoding", "gzip")
                        .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body())))
                        .build();
  return chain.proceed(compressedRequest);
}

代码示例来源:origin: com.neotys.ascode/swagger-java-client

@Override public Response intercept(Chain chain) throws IOException {
  Request originalRequest = chain.request();
  if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
    return chain.proceed(originalRequest);
  }
  Request compressedRequest = originalRequest.newBuilder()
                        .header("Content-Encoding", "gzip")
                        .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body())))
                        .build();
  return chain.proceed(compressedRequest);
}

代码示例来源:origin: de.adorsys.multibanking/finapi-adapter

@Override public Response intercept(Chain chain) throws IOException {
  Request originalRequest = chain.request();
  if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
    return chain.proceed(originalRequest);
  }
  Request compressedRequest = originalRequest.newBuilder()
                        .header("Content-Encoding", "gzip")
                        .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body())))
                        .build();
  return chain.proceed(compressedRequest);
}

代码示例来源:origin: com.walmartlabs.concord/concord-client

@Override public Response intercept(Chain chain) throws IOException {
  Request originalRequest = chain.request();
  if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
    return chain.proceed(originalRequest);
  }
  Request compressedRequest = originalRequest.newBuilder()
                        .header("Content-Encoding", "gzip")
                        .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body())))
                        .build();
  return chain.proceed(compressedRequest);
}

代码示例来源:origin: org.renci.io.swagger/swagger-java-comet-client

@Override public Response intercept(Chain chain) throws IOException {
  Request originalRequest = chain.request();
  if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
    return chain.proceed(originalRequest);
  }
  Request compressedRequest = originalRequest.newBuilder()
                        .header("Content-Encoding", "gzip")
                        .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body())))
                        .build();
  return chain.proceed(compressedRequest);
}

代码示例来源:origin: io.kubernetes/client-java-api

@Override public Response intercept(Chain chain) throws IOException {
  Request originalRequest = chain.request();
  if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
    return chain.proceed(originalRequest);
  }
  Request compressedRequest = originalRequest.newBuilder()
                        .header("Content-Encoding", "gzip")
                        .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body())))
                        .build();
  return chain.proceed(compressedRequest);
}

代码示例来源:origin: com.graphhopper/directions-api-client

@Override public Response intercept(Chain chain) throws IOException {
  Request originalRequest = chain.request();
  if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
    return chain.proceed(originalRequest);
  }
  Request compressedRequest = originalRequest.newBuilder()
                        .header("Content-Encoding", "gzip")
                        .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body())))
                        .build();
  return chain.proceed(compressedRequest);
}

代码示例来源:origin: jamorham/xDrip-plus

@Override
public Response intercept(Chain chain) throws IOException {
  Request originalRequest = chain.request();
  if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
    return chain.proceed(originalRequest);
  }
  Request compressedRequest = originalRequest.newBuilder()
      .header("Content-Encoding", "gzip")
      .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body())))
      .build();
  return chain.proceed(compressedRequest);
}

代码示例来源:origin: AzureAD/azure-activedirectory-library-for-android

@Override public Response intercept(Chain chain) throws IOException {
  Request originalRequest = chain.request();
  if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
    return chain.proceed(originalRequest);
  }
  Request compressedRequest = originalRequest.newBuilder()
                        .header("Content-Encoding", "gzip")
                        .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body())))
                        .build();
  return chain.proceed(compressedRequest);
}

代码示例来源:origin: AzureAD/azure-activedirectory-library-for-android

@Override public Response intercept(Chain chain) throws IOException {
  Request originalRequest = chain.request();
  if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
    return chain.proceed(originalRequest);
  }
  Request compressedRequest = originalRequest.newBuilder()
                        .header("Content-Encoding", "gzip")
                        .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body())))
                        .build();
  return chain.proceed(compressedRequest);
}

代码示例来源:origin: shinesolutions/swagger-aem

@Override public Response intercept(Chain chain) throws IOException {
  Request originalRequest = chain.request();
  if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
    return chain.proceed(originalRequest);
  }
  Request compressedRequest = originalRequest.newBuilder()
                        .header("Content-Encoding", "gzip")
                        .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body())))
                        .build();
  return chain.proceed(compressedRequest);
}

相关文章