org.jclouds.http.HttpRequest.getMethod()方法的使用及代码示例

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

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

HttpRequest.getMethod介绍

[英]We cannot return an enum, as per specification custom methods are allowed. Enums are not extensible.
[中]我们无法返回枚举,因为根据规范,允许使用自定义方法。枚举不可扩展。

代码示例

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

@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
  HttpRequest request = (HttpRequest) e.getMessage();

  if (request.getMethod().equals(HttpMethod.POST)) {
    // receive uploaded file
    return;
  }

  if (request.getMethod() != GET) {
    sendError(ctx, METHOD_NOT_ALLOWED);
    return;
  }

  ...

代码示例来源:origin: jclouds/legacy-jclouds

@Override
  public HttpRequest filter(HttpRequest request) throws HttpException {
   if (NON_PAYLOAD_METHODS.contains(request.getMethod()))
     return request.toBuilder().replaceHeader(CONTENT_TYPE, APPLICATION_JSON).build();
   return request;
  }
}

代码示例来源:origin: org.apache.jclouds.provider/dynect

@Override
  public HttpRequest filter(HttpRequest request) throws HttpException {
   if (NON_PAYLOAD_METHODS.contains(request.getMethod()))
     return request.toBuilder().replaceHeader(CONTENT_TYPE, APPLICATION_JSON).build();
   return request;
  }
}

代码示例来源:origin: jclouds/legacy-jclouds

@Override
protected HttpRequestComparisonType compareHttpRequestAsType(HttpRequest input) {
 return Objects.equal("HEAD", input.getMethod()) ? HttpRequestComparisonType.DEFAULT
    : HttpRequestComparisonType.JSON;
}

代码示例来源:origin: jclouds/legacy-jclouds

private HttpRequest signForTemporaryAccess(HttpRequest request, long timeInSeconds) {
 HttpRequest.Builder<?> builder = request.toBuilder().filters(ImmutableSet.<HttpRequestFilter> of());
 String key = temporaryUrlKeySupplier.get();
 if (key == null) {
   throw new UnsupportedOperationException();
 }
 long expiresInSeconds = unixEpochTimestampProvider.get() + timeInSeconds;
 builder.addQueryParam("temp_url_sig",
    createSignature(key, createStringToSign(request.getMethod().toUpperCase(), request, expiresInSeconds)));
 builder.addQueryParam("temp_url_expires", "" + expiresInSeconds);
 return builder.build();
}

代码示例来源:origin: jclouds/legacy-jclouds

/**
* build a shell script that invokes the contents of the http request in bash.
* 
* @return a shell script that will invoke the http request
*/
public static Statement execHttpResponse(HttpRequest request) {
 return pipeHttpResponseToBash(request.getMethod(), request.getEndpoint(), request.getHeaders());
}

代码示例来源:origin: jclouds/legacy-jclouds

/**
* build a shell script that invokes the contents of the http request in bash.
* 
* @return a shell script that will invoke the http request
*/
public static Statement extractTargzIntoDirectory(HttpRequest targz, String directory) {
 return Statements
      .extractTargzIntoDirectory(targz.getMethod(), targz.getEndpoint(), targz.getHeaders(), directory);
}

代码示例来源:origin: org.apache.jclouds/jclouds-compute

/**
* build a shell script that invokes the contents of the http request in bash.
*
* @return a shell script that will invoke the http request
*/
public static Statement execHttpResponse(HttpRequest request) {
 return pipeHttpResponseToBash(request.getMethod(), request.getEndpoint(), request.getHeaders());
}

代码示例来源:origin: jclouds/legacy-jclouds

/**
* build a shell script that invokes the contents of the http request in bash.
* 
* @return a shell script that will invoke the http request
*/
public static Statement extractZipIntoDirectory(HttpRequest zip, String directory) {
 return Statements.extractZipIntoDirectory(zip.getMethod(), zip.getEndpoint(), zip.getHeaders(), directory);
}

代码示例来源:origin: io.cloudsoft.jclouds/jclouds-compute

/**
* build a shell script that invokes the contents of the http request in bash.
* 
* @return a shell script that will invoke the http request
*/
public static Statement execHttpResponse(HttpRequest request) {
 return pipeHttpResponseToBash(request.getMethod(), request.getEndpoint(), request.getHeaders());
}

代码示例来源:origin: org.apache.jclouds/jclouds-compute

/**
* build a shell script that invokes the contents of the http request in bash.
*
* @return a shell script that will invoke the http request
*/
public static Statement extractTargzIntoDirectory(HttpRequest targz, String directory) {
 return Statements
      .extractTargzIntoDirectory(targz.getMethod(), targz.getEndpoint(), targz.getHeaders(), directory);
}

代码示例来源:origin: io.cloudsoft.jclouds/jclouds-compute

/**
* build a shell script that invokes the contents of the http request in bash.
* 
* @return a shell script that will invoke the http request
*/
public static Statement extractTargzIntoDirectory(HttpRequest targz, String directory) {
 return Statements
      .extractTargzIntoDirectory(targz.getMethod(), targz.getEndpoint(), targz.getHeaders(), directory);
}

代码示例来源:origin: jclouds/legacy-jclouds

public static <T> HttpRequest cleanRequest(HttpRequest returnVal) {
 checkNotNull(returnVal, "http request");
 for (HttpRequestFilter filter : returnVal.getFilters())
   returnVal = filter.filter(returnVal);
 return HttpRequest.builder().method(returnVal.getMethod()).endpoint(returnVal.getEndpoint())
      .headers(returnVal.getHeaders()).payload(returnVal.getPayload()).build();
}

代码示例来源:origin: com.amysta.jclouds/jclouds-blobstore

public static <T> HttpRequest cleanRequest(HttpRequest returnVal) {
 checkNotNull(returnVal, "http request");
 for (HttpRequestFilter filter : returnVal.getFilters())
   returnVal = filter.filter(returnVal);
 return HttpRequest.builder().method(returnVal.getMethod()).endpoint(returnVal.getEndpoint())
      .headers(returnVal.getHeaders()).payload(returnVal.getPayload()).build();
}

代码示例来源:origin: org.apache.jclouds/jclouds-blobstore

public static <T> HttpRequest cleanRequest(HttpRequest returnVal) {
 checkNotNull(returnVal, "http request");
 for (HttpRequestFilter filter : returnVal.getFilters())
   returnVal = filter.filter(returnVal);
 return HttpRequest.builder().method(returnVal.getMethod()).endpoint(returnVal.getEndpoint())
      .headers(returnVal.getHeaders()).payload(returnVal.getPayload()).build();
}

代码示例来源:origin: io.cloudsoft.jclouds/jclouds-core

public T fromHttpRequest(HttpRequest in) {
   return super.fromHttpMessage(in)
         .method(in.getMethod())
         .endpoint(in.getEndpoint())
         .filters(in.getFilters());
 }
}

代码示例来源:origin: jclouds/legacy-jclouds

public T fromHttpRequest(HttpRequest in) {
   return super.fromHttpMessage(in)
         .method(in.getMethod())
         .endpoint(in.getEndpoint())
         .filters(in.getFilters());
 }
}

代码示例来源:origin: org.jclouds/jclouds-core

public T fromHttpRequest(HttpRequest in) {
   return super.fromHttpMessage(in)
         .method(in.getMethod())
         .endpoint(in.getEndpoint())
         .filters(in.getFilters());
 }
}

代码示例来源:origin: Nextdoor/bender

public T fromHttpRequest(HttpRequest in) {
   return super.fromHttpMessage(in)
         .method(in.getMethod())
         .endpoint(in.getEndpoint())
         .filters(in.getFilters());
 }
}

代码示例来源:origin: com.amysta.jclouds/jclouds-core

public T fromHttpRequest(HttpRequest in) {
   return super.fromHttpMessage(in)
         .method(in.getMethod())
         .endpoint(in.getEndpoint())
         .filters(in.getFilters());
 }
}

相关文章