怎么让这个内容被浏览器解析?各位老大请帮个忙
public void downLoad(String filePath, HttpServletResponse response,
) throws Exception
{
File f = new File(filePath);
if (!f.exists())
{
response.sendError(404, "File not found!");
return;
}
BufferedInputStream br = new BufferedInputStream(new FileInputStream(f));
byte[] buf = new byte[1024];
int len = 0;
response.reset();
response.setContentType("application/x-msdownload");
response.addHeader("Content-Disposition", "attachment; filename="
+ new String(f.getName().getBytes("GBK"), "ISO8859-1"));
OutputStream out = response.getOutputStream();
while ((len = br.read(buf)) > 0)
{
out.write(buf, 0, len);
}
br.close();
out.flush();
out.close();
}
弑天下
HUWWW