public Request<GetRecordsRequest> marshall(GetRecordsRequest getRecordsRequest) { if (getRecordsRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(GetRecordsRequest)"); } Request<GetRecordsRequest> request = new DefaultRequest<GetRecordsRequest>(getRecordsRequest, "AmazonKinesis"); String target = "Kinesis_20131202.GetRecords"; request.addHeader("X-Amz-Target", target); request.setHttpMethod(HttpMethodName.POST); String uriResourcePath = "/"; request.setResourcePath(uriResourcePath); try { StringWriter stringWriter = new StringWriter(); AwsJsonWriter jsonWriter = JsonUtils.getJsonWriter(stringWriter); jsonWriter.beginObject(); if (getRecordsRequest.getShardIterator() != null) { String shardIterator = getRecordsRequest.getShardIterator(); jsonWriter.name("ShardIterator"); jsonWriter.value(shardIterator); } if (getRecordsRequest.getLimit() != null) { Integer limit = getRecordsRequest.getLimit(); jsonWriter.name("Limit"); jsonWriter.value(limit); } jsonWriter.endObject(); jsonWriter.close(); String snippet = stringWriter.toString(); byte[] content = snippet.getBytes(UTF8); request.setContent(new StringInputStream(snippet)); request.addHeader("Content-Length", Integer.toString(content.length)); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", "application/x-amz-json-1.1"); } return request; }