Example usage for com.amazonaws.http HttpMethodName HEAD

List of usage examples for com.amazonaws.http HttpMethodName HEAD

Introduction

In this page you can find the example usage for com.amazonaws.http HttpMethodName HEAD.

Prototype

HttpMethodName HEAD

To view the source code for com.amazonaws.http HttpMethodName HEAD.

Click Source Link

Usage

From source file:org.apache.nifi.processors.aws.wag.AbstractAWSGatewayApiProcessor.java

License:Apache License

protected GenericApiGatewayRequest configureRequest(final ProcessContext context, final ProcessSession session,
        final String resourcePath, final FlowFile requestFlowFile, final HttpMethodName methodName) {

    GenericApiGatewayRequestBuilder builder = new GenericApiGatewayRequestBuilder()
            .withResourcePath(resourcePath);
    final Map<String, List<String>> parameters = getParameters(context);
    builder = builder.withParameters(parameters);

    InputStream requestBody = null;
    switch (methodName) {
    case GET:// w  w w.j  a  va  2 s.com
        builder = builder.withHttpMethod(HttpMethodName.GET);
        break;
    case POST:
        requestBody = getRequestBodyToSend(session, context, requestFlowFile);
        builder = builder.withHttpMethod(HttpMethodName.POST).withBody(requestBody);
        break;
    case PUT:
        requestBody = getRequestBodyToSend(session, context, requestFlowFile);
        builder = builder.withHttpMethod(HttpMethodName.PUT).withBody(requestBody);
        break;
    case PATCH:
        requestBody = getRequestBodyToSend(session, context, requestFlowFile);
        builder = builder.withHttpMethod(HttpMethodName.PATCH).withBody(requestBody);
        break;
    case HEAD:
        builder = builder.withHttpMethod(HttpMethodName.HEAD);
        break;
    case DELETE:
        builder = builder.withHttpMethod(HttpMethodName.DELETE);
        break;
    case OPTIONS:
        requestBody = getRequestBodyToSend(session, context, requestFlowFile);
        builder = builder.withHttpMethod(HttpMethodName.OPTIONS).withBody(requestBody);
        break;
    }

    builder = setHeaderProperties(context, builder, methodName, requestFlowFile);
    return builder.build();
}