String classeInstanciada = request.getParameter("classeInstanciada");
Long id = new Long(request.getParameter("idObjeto"));
try {
IActionRequest action = (IActionRequest) Class.forName(classeInstanciada).newInstance();
DownloadArquivoBean bean = action.consultarArquivoDownload(id);
response.setContentType("inline/download");
String arquivo = "attachment;filename=" + bean.getNomeArquivo();
response.setHeader("Content-Disposition", arquivo);
ServletOutputStream servletOutputStream = response.getOutputStream();
servletOutputStream.write(bean.getConteudoArquivo());
servletOutputStream.flush();
servletOutputStream.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();