Attachment attachment = bug.getAttachments().get(this.attachmentIndex);
// Uses a StreamingResolution to send the file contents back to the user.
// Note the use of the chained .setFilename() method, which causes the
// browser to [prompt to] save the "file" instead of displaying it in browser
return new StreamingResolution
(attachment.getContentType(), new ByteArrayInputStream(attachment.getData()))
.setFilename(attachment.getName());
}