问题描述:

I am trying to download an excel file from my application. Below is my code snippet:`

response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");

response.setHeader("Content-Disposition", "attachment; filename=\""

+file + "\"");

if(inputStream==null){

logger.debug("The stream is null!!");

}

int stream;

while ((stream = inputStream.read()) != -1) {

out.write(stream);

}

inputStream.close();

out.close();

response.flushBuffer();

This works fine for windows (tomcat server), but when I run it on linux (weblogic server) the download excel file shows: "Data might be corrupted" warning. Though it opens up and shows the right content, I don't understand why this warning comes on linux. Is there a way I can remove this warning?

相关阅读:
Top