JSP下载问题
如果我把改为 http://localhost/..../a.mp3
String all_path = "http://localhost/..../a.mp3 ";
response.setContentType("application/octet-stream; charset=utf-8");
response.setHeader("Content-Disposition", "attachment; filename=\"" +toUtf8String(filename)+ "\"");
java.io.OutputStream os = response.getOutputStream();
java.io.FileInputStream fis = new java.io.FileInputStream(all_path);
byte[] b = new byte[50];
int i = 0;
int k=0;
System.out.println(fis.read(b));
while ( (i = fis.read(b,0,50)) > 0 )
{
System.out.println(k+++": "+i);
os.write(b,0,i);
}
fis.close();
os.flush();
out.clear();
os.close();

