public Request<ListApplicationsRequest> marshall( ListApplicationsRequest listApplicationsRequest) { if (listApplicationsRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<ListApplicationsRequest> request = new DefaultRequest<ListApplicationsRequest>(listApplicationsRequest, "AmazonInspector"); request.addHeader("X-Amz-Target", "InspectorService.ListApplications"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (listApplicationsRequest.getFilter() != null) { jsonWriter.key("filter"); ApplicationsFilterJsonMarshaller.getInstance() .marshall(listApplicationsRequest.getFilter(), jsonWriter); } if (listApplicationsRequest.getNextToken() != null) { jsonWriter.key("nextToken").value(listApplicationsRequest.getNextToken()); } if (listApplicationsRequest.getMaxResults() != null) { jsonWriter.key("maxResults").value(listApplicationsRequest.getMaxResults()); } jsonWriter.endObject(); String snippet = stringWriter.toString(); byte[] content = snippet.getBytes(UTF8); request.setContent(new StringInputStream(snippet)); request.addHeader("Content-Length", Integer.toString(content.length)); request.addHeader("Content-Type", "application/x-amz-json-1.1"); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }