Example usage for com.amazonaws DefaultRequest addHeader

List of usage examples for com.amazonaws DefaultRequest addHeader

Introduction

In this page you can find the example usage for com.amazonaws DefaultRequest addHeader.

Prototype

public void addHeader(String name, String value) 

Source Link

Usage

From source file:com.ghedeon.AwsInterceptor.java

License:Apache License

private void setBody(@Nonnull DefaultRequest awsRequest, @Nullable RequestBody body) throws IOException {
    if (body == null) {
        return;//  w ww  .  j  a va 2 s .  co m
    }

    Buffer buffer = new Buffer();
    body.writeTo(buffer);
    awsRequest.setContent(new ByteArrayInputStream(buffer.readByteArray()));
    awsRequest.addHeader("Content-Length", String.valueOf(body.contentLength()));
    buffer.close();
}