com.amazonaws.http.HttpMethodName类的使用及代码示例

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

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

HttpMethodName介绍

[英]Enums for HTTP method.
[中]HTTP方法的枚举。

代码示例

代码示例来源:origin: aws/aws-sdk-java

HttpMethodName httpMethod = HttpMethodName.valueOf(req.getMethod().toString());

代码示例来源:origin: aws/aws-sdk-java

private S3Signer createSigV2Signer(final Request<?> request,
                    final String bucketName,
                    final String key) {
  String resourcePath = "/" +
      ((bucketName != null) ? bucketName + "/" : "") +
      ((key != null) ? key : "");
  return new S3Signer(request.getHttpMethod().toString(), resourcePath);
}

代码示例来源:origin: aws/aws-sdk-java

public static boolean usePayloadForQueryParameters(SignableRequest<?> request) {
  boolean requestIsPOST = HttpMethodName.POST.equals(request.getHttpMethod());
  boolean requestHasNoPayload = (request.getContent() == null);
  return requestIsPOST && requestHasNoPayload;
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * @param value Raw string representing value of enum
 * @return HttpMethodName enum or null if value is not present.
 * @throws IllegalArgumentException If value does not represent a known enum value.
 */
public static HttpMethodName fromValue(String value) {
  if (StringUtils.isNullOrEmpty(value)) {
    return null;
  }
  final String upperCaseValue = StringUtils.upperCase(value);
  for (HttpMethodName httpMethodName : values()) {
    if (httpMethodName.name().equals(upperCaseValue)) {
      return httpMethodName;
    }
  }
  throw new IllegalArgumentException("Unsupported HTTP method name " + value);
}

代码示例来源:origin: apache/nifi

protected GenericApiGatewayRequest configureRequest(final ProcessContext context,
                          final ProcessSession session,
                          final String resourcePath,
                          final FlowFile requestFlowFile) {
  String method = trimToEmpty(
      context.getProperty(PROP_METHOD).evaluateAttributeExpressions(requestFlowFile)
          .getValue()).toUpperCase();
  HttpMethodName methodName = HttpMethodName.fromValue(method);
  return configureRequest(context, session, resourcePath,requestFlowFile, methodName);
}

代码示例来源:origin: aws/aws-sdk-java

private static HttpMethod toNettyHttpMethod(HttpMethodName method) {
    return HttpMethod.valueOf(method.name());
  }
}

代码示例来源:origin: apache/nifi

&& validationContext.isExpressionLanguagePresent(method))) {
try {
  HttpMethodName methodName = HttpMethodName.fromValue(method);
} catch (IllegalArgumentException e) {
  results.add(new ValidationResult.Builder().subject(PROP_METHOD.getName()).input(method)

代码示例来源:origin: com.amazonaws/aws-java-sdk-core

/**
 * @param value Raw string representing value of enum
 * @return HttpMethodName enum or null if value is not present.
 * @throws IllegalArgumentException If value does not represent a known enum value.
 */
public static HttpMethodName fromValue(String value) {
  if (StringUtils.isNullOrEmpty(value)) {
    return null;
  }
  final String upperCaseValue = StringUtils.upperCase(value);
  for (HttpMethodName httpMethodName : values()) {
    if (httpMethodName.name().equals(upperCaseValue)) {
      return httpMethodName;
    }
  }
  throw new IllegalArgumentException("Unsupported HTTP method name " + value);
}

代码示例来源:origin: awslabs/amazon-kinesis-video-streams-producer-sdk-java

protected boolean shouldAddContentUnsignedPayloadInHeader(final String httpMethodName) {
    return HttpMethodName.POST.name().equals(httpMethodName);
  }
}

代码示例来源:origin: aws/aws-sdk-java

/**
 * Step 1 of the AWS Signature version 4 calculation. Refer to
 * http://docs.aws
 * .amazon.com/general/latest/gr/sigv4-create-canonical-request.html to
 * generate the canonical request.
 */
protected String createCanonicalRequest(SignableRequest<?> request,
    String contentSha256) {
  /* This would url-encode the resource path for the first time. */
  final String path = SdkHttpUtils.appendUri(
      request.getEndpoint().getPath(), request.getResourcePath());
  final StringBuilder canonicalRequestBuilder = new StringBuilder(request
      .getHttpMethod().toString());
  canonicalRequestBuilder.append(LINE_SEPARATOR)
      // This would optionally double url-encode the resource path
      .append(getCanonicalizedResourcePath(path, doubleUrlEncode))
      .append(LINE_SEPARATOR)
      .append(getCanonicalizedQueryString(request))
      .append(LINE_SEPARATOR)
      .append(getCanonicalizedHeaderString(request))
      .append(LINE_SEPARATOR)
      .append(getSignedHeadersString(request)).append(LINE_SEPARATOR)
      .append(contentSha256);
  final String canonicalRequest = canonicalRequestBuilder.toString();
  if (log.isDebugEnabled())
    log.debug("AWS4 Canonical Request: '\"" + canonicalRequest + "\"");
  return canonicalRequest;
}

代码示例来源:origin: aws-amplify/aws-sdk-android

/**
 * Sets HTTP method to the {@link Request} object. If the given method is
 * none of GET, POST, PUT, DELETE, and HEAD, then it will be tunneled via
 * X-HTTP-Method-Override. Note that not all servers support this header.
 *
 * @param request request to be set
 * @param httpMethod given http method
 * @param hasContent indicate whether the request has content body
 */
void setHttpMethod(Request<?> request, String httpMethod, boolean hasContent) {
  try {
    request.setHttpMethod(HttpMethodName.valueOf(httpMethod));
  } catch (final IllegalArgumentException iae) {
    // if an HTTP method is unsupported, then 'tunnel' it through
    // another method by setting the intended method in the
    // X-HTTP-Method-Override header.
    request.addHeader("X-HTTP-Method-Override", httpMethod);
    // depending on whether the request has content or not, choose an
    // appropriate method.
    request.setHttpMethod(hasContent ? HttpMethodName.POST : HttpMethodName.GET);
  }
}

代码示例来源:origin: aws-amplify/aws-sdk-android

/**
 * @param request the request.
 * @return true if request is post and request has no payload.
 */
public static boolean usePayloadForQueryParameters(Request<?> request) {
  final boolean requestIsPOST = HttpMethodName.POST.equals(request.getHttpMethod());
  final boolean requestHasNoPayload = (request.getContent() == null);
  return requestIsPOST && requestHasNoPayload;
}

代码示例来源:origin: internetitem/logback-elasticsearch-appender

@Override
public HttpMethodName getHttpMethod() {
  return HttpMethodName.fromValue(urlConnection.getRequestMethod());
}

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

/**
 * @param value Raw string representing value of enum
 * @return HttpMethodName enum or null if value is not present.
 * @throws IllegalArgumentException If value does not represent a known enum value.
 */
public static HttpMethodName fromValue(String value) {
  if (StringUtils.isNullOrEmpty(value)) {
    return null;
  }
  final String upperCaseValue = StringUtils.upperCase(value);
  for (HttpMethodName httpMethodName : values()) {
    if (httpMethodName.name().equals(upperCaseValue)) {
      return httpMethodName;
    }
  }
  throw new IllegalArgumentException("Unsupported HTTP method name " + value);
}

代码示例来源:origin: com.amazonaws/aws-java-sdk-kinesisvideo

private static HttpMethod toNettyHttpMethod(HttpMethodName method) {
    return HttpMethod.valueOf(method.name());
  }
}

代码示例来源:origin: aws/aws-sdk-java

stringToSign = request.getHttpMethod().toString() + "\n"
    + getCanonicalizedResourcePath(path) + "\n"
    + getCanonicalizedQueryString(request.getParameters()) + "\n"

代码示例来源:origin: aws-amplify/aws-sdk-android

final HttpMethodName httpMethod = HttpMethodName.valueOf(generatePresignedUrlRequest.getMethod()
    .toString());

代码示例来源:origin: com.amazonaws/aws-java-sdk-core

public static boolean usePayloadForQueryParameters(SignableRequest<?> request) {
  boolean requestIsPOST = HttpMethodName.POST.equals(request.getHttpMethod());
  boolean requestHasNoPayload = (request.getContent() == null);
  return requestIsPOST && requestHasNoPayload;
}

代码示例来源:origin: org.apache.nifi/nifi-aws-abstract-processors

protected GenericApiGatewayRequest configureRequest(final ProcessContext context,
                          final ProcessSession session,
                          final String resourcePath,
                          final FlowFile requestFlowFile) {
  String method = trimToEmpty(
      context.getProperty(PROP_METHOD).evaluateAttributeExpressions(requestFlowFile)
          .getValue()).toUpperCase();
  HttpMethodName methodName = HttpMethodName.fromValue(method);
  return configureRequest(context, session, resourcePath,requestFlowFile, methodName);
}

代码示例来源:origin: awslabs/amazon-kinesis-video-streams-producer-sdk-java

@Override
protected String calculateContentHash(final SignableRequest<?> request) {
  if (shouldAddContentUnsignedPayloadInHeader(request.getHttpMethod().name())) {
    return CONTENT_UNSIGNED_PAYLOAD;
  }
  return  super.calculateContentHash(request);
}

相关文章