io.airlift.http.client.Request.getMethod()方法的使用及代码示例

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

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

Request.getMethod介绍

暂无

代码示例

代码示例来源:origin: prestodb/presto

private static <T> T handleProxyException(Request request, ProxyException e)
{
  log.warn(e, "Proxy request failed: %s %s", request.getMethod(), request.getUri());
  throw badRequest(BAD_GATEWAY, e.getMessage());
}

代码示例来源:origin: prestodb/presto

if (request.getMethod().equals("DELETE")) {
  assertEquals(parts.size(), 1);
  return new TestingResponse(HttpStatus.OK, ImmutableListMultimap.of(), new byte[0]);

代码示例来源:origin: prestodb/presto

@Override
public Response handle(Request request)
  if (request.getMethod().equalsIgnoreCase("DELETE")) {
    return new TestingResponse(HttpStatus.NO_CONTENT, ImmutableListMultimap.of(), new byte[0]);

代码示例来源:origin: prestosql/presto

private static <T> T handleProxyException(Request request, ProxyException e)
{
  log.warn(e, "Proxy request failed: %s %s", request.getMethod(), request.getUri());
  throw badRequest(BAD_GATEWAY, e.getMessage());
}

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

stats.recordResponseReceived(request.getMethod(),
        0,
        0,
stats.recordResponseReceived(request.getMethod(),
    0,
    0,
stats.recordResponseReceived(request.getMethod(),
    response.getStatusCode(),
    response.getBytesRead(),

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

Invocation invocation;
if (request.getBodyGenerator() == null) {
  invocation = invocationBuilder.build(request.getMethod());
  byte[] bytes = byteArrayOutputStream.toByteArray();
  Entity<byte[]> entity = Entity.entity(bytes, (String) getOnlyElement(requestHeaders.get("Content-Type")));
  invocation = invocationBuilder.build(request.getMethod(), entity);
    log.warn(exception.getCause(), "%-8s %s -> Exception", request.getMethod(), request.getUri());
    log.warn(throwable, "%-8s %s -> Fail", request.getMethod(), request.getUri());
  log.warn("%-8s %s -> OK", request.getMethod(), request.getUri());

代码示例来源:origin: com.teradata.airlift/http-client

@Test
public void testRequestBuilder()
{
  Request request = createRequest();
  assertEquals(request.getMethod(), "GET");
  assertEquals(request.getBodyGenerator(), NULL_BODY_GENERATOR);
  assertEquals(request.getUri(), URI.create("http://example.com"));
  assertEquals(request.getHeaders(), ImmutableListMultimap.of(
      "newheader", "withvalue", "anotherheader", "anothervalue"));
}

代码示例来源:origin: io.airlift/http-client

@Test
public void testRequestBuilder()
{
  Request request = createRequest();
  assertEquals(request.getMethod(), "GET");
  assertEquals(request.getBodyGenerator(), NULL_BODY_GENERATOR);
  assertEquals(request.getUri(), URI.create("http://example.com"));
  assertEquals(request.getHeaders(), ImmutableListMultimap.of(
      "newheader", "withvalue", "anotherheader", "anothervalue"));
  assertFalse(request.isFollowRedirects());
}

代码示例来源:origin: io.airlift/http-client-experimental

@Test
public void testRequestBuilder()
{
  Request request = createRequest();
  assertEquals(request.getMethod(), "GET");
  assertEquals(request.getBodyGenerator(), NULL_BODY_GENERATOR);
  assertEquals(request.getUri(), URI.create("http://example.com"));
  assertEquals(request.getHeaders(), ImmutableListMultimap.of(
      "newheader", "withvalue", "anotherheader", "anothervalue"));
}

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

@Test
public void testRequestBuilder()
{
  Request request = createRequest();
  assertEquals(request.getMethod(), "GET");
  assertEquals(request.getBodyGenerator(), NULL_BODY_GENERATOR);
  assertEquals(request.getUri(), URI.create("http://example.com"));
  assertEquals(request.getHeaders(), ImmutableListMultimap.of(
      "newheader", "withvalue", "anotherheader", "anothervalue"));
  assertFalse(request.isFollowRedirects());
}

代码示例来源:origin: io.airlift/jaxrs-testing

Invocation invocation;
if (request.getBodyGenerator() == null) {
  invocation = invocationBuilder.build(request.getMethod());
  byte[] bytes = byteArrayOutputStream.toByteArray();
  Entity<byte[]> entity = Entity.entity(bytes, (String) getOnlyElement(requestHeaders.get("Content-Type")));
  invocation = invocationBuilder.build(request.getMethod(), entity);
    log.warn(exception.getCause(), "%-8s %s -> Exception", request.getMethod(), request.getUri());
    log.warn(throwable, "%-8s %s -> Fail", request.getMethod(), request.getUri());
  log.warn("%-8s %s -> OK", request.getMethod(), request.getUri());

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

static void recordRequestComplete(RequestStats requestStats, Request request, long requestStart, JettyResponse response, long responseStart)
  {
    if (response == null) {
      return;
    }

    Duration responseProcessingTime = Duration.nanosSince(responseStart);
    Duration requestProcessingTime = new Duration(responseStart - requestStart, NANOSECONDS);

    requestStats.recordResponseReceived(request.getMethod(),
        response.getStatusCode(),
        response.getBytesRead(),
        response.getBytesRead(),
        requestProcessingTime,
        responseProcessingTime);
  }
}

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

public static Builder fromRequest(Request request)
{
  return new Builder()
      .setUri(request.getUri())
      .setMethod(request.getMethod())
      .addHeaders(request.getHeaders())
      .setBodyGenerator(request.getBodyGenerator())
      .setFollowRedirects(request.isFollowRedirects())
      .setPreserveAuthorizationOnRedirect(request.isPreserveAuthorizationOnRedirect());
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

if (request.getMethod().equals("DELETE")) {
  assertEquals(parts.size(), 1);
  return new TestingResponse(HttpStatus.OK, ImmutableListMultimap.of(), new byte[0]);

代码示例来源:origin: prestosql/presto

if (request.getMethod().equals("DELETE")) {
  assertEquals(parts.size(), 1);
  return new TestingResponse(HttpStatus.OK, ImmutableListMultimap.of(), new byte[0]);

代码示例来源:origin: io.prestosql/presto-main

if (request.getMethod().equals("DELETE")) {
  assertEquals(parts.size(), 1);
  return new TestingResponse(HttpStatus.OK, ImmutableListMultimap.of(), new byte[0]);

代码示例来源:origin: prestosql/presto

@Override
public Response handle(Request request)
  if (request.getMethod().equalsIgnoreCase("DELETE")) {
    return new TestingResponse(HttpStatus.NO_CONTENT, ImmutableListMultimap.of(), new byte[0]);

代码示例来源:origin: io.prestosql/presto-main

@Override
public Response handle(Request request)
  if (request.getMethod().equalsIgnoreCase("DELETE")) {
    return new TestingResponse(HttpStatus.NO_CONTENT, ImmutableListMultimap.of(), new byte[0]);

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

throws Exception
if (request.getMethod().equalsIgnoreCase("DELETE")) {
  return new TestingResponse(HttpStatus.NO_CONTENT, ImmutableListMultimap.<String, String>of(), new byte[0]);

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

jettyRequest.method(finalRequest.getMethod());

相关文章