Example usage for com.amazonaws.http HttpMethodName DELETE

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

Introduction

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

Prototype

HttpMethodName DELETE

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

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://from   www.ja v  a  2s.  c  o m
        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();
}