if (response.getStatusCode() != Response.SC_OK) {
callback.onFailure(setFailureStatus(requestedAttachments), "Got back status code " + response.getStatusCode());
} else if (!response.getHeader("Content-Type").startsWith("application/json")) {
callback.onFailure(setFailureStatus(requestedAttachments), "Search service did not return json");
} else {
AttachmentsResponseJsoImpl attachmentsProto;
try {
attachmentsProto = JsonMessage.parse(response.getText());
} catch (JsonException e) {
callback.onFailure(setFailureStatus(requestedAttachments), e.getMessage());
return;