1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
.
.
.
String fileType = "application/vnd.octetstream";
String attachment = "attachment; filename=" + resultFileName;
response.setContentType(fileType);
response.setHeader("Content-disposition", attachment);
OutputStream out = response.getOutputStream();
InputStream in = new FileInputStream(resultFileName);
int nextChar;
while ((nextChar = in.read()) != -1)
out.write(Character.toUpperCase((char) nextChar));
out.write('\n');
out.flush();
out.close();
out = null;
return null;
} |
Partager