通过设置http的头信息实现服务器不保存文件直接下载

String fileName = new String((moduleName + ".xls").getBytes("GBK"), "ISO-8859-1"); response.setContentType("application/vnd.ms-excel; charset=GBK"); response.addHeader("Content-Disposition", "attachment; filename=" + fileName); OutputStream output = response.getOutputStream(); output.flush(); output.close(); 

你可能感兴趣的:(String,服务器,output)