byte[] fileToSend = baos.toByteArray();
res.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
res.setContentLength(fileToSend.length);
res.getOutputStream().flush();
res.setCharacterEncoding("UTF-8");
res.setHeader("CacheControl", "no-cache");
res.setHeader("Pragma", "no-cache");
res.setHeader("Expires", "-1");
res.setHeader("Content-disposition", "attachment; filename=hotel.xls");
res.getOutputStream().write(fileToSend);
}
it works fine dev mode and am able to download and see content with file name as hotel.xls.
But when deployed to app engeine server, it downloads file named downloadServlet.xlsx instead of hotel.xls. because of the file type difference (xlsx instead of xls), i am not able to open the file correctly and see the content.
Can somebody suggest why this file type difference happens after deployment ?
Deepak Singh