return mapping.findForward("view");
}
public ActionForward downloadDocument(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request,
final HttpServletResponse response) throws IOException {
final IndividualCandidacyDocumentFile document = getDomainObject(request, "documentOID");
if (document != null && isAuthorized(document)) {
response.setContentType(document.getContentType());
response.addHeader("Content-Disposition", "attachment; filename=\"" + document.getFilename() + "\"");
response.setContentLength(document.getSize().intValue());
final DataOutputStream dos = new DataOutputStream(response.getOutputStream());
dos.write(document.getContent());
dos.close();
} else {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.getWriter().write(HttpStatus.getStatusText(HttpStatus.SC_BAD_REQUEST));
response.getWriter().close();