从Android的Chrome Java网站下载文件
我正在下载一个。从我的Glassfish服务器上下载安卓Chrome上的APK,但我得到的只是一个“zerokb”文件
在Windows(PC)的Chrome和安卓(Android)的Firefox上,它都能正常工作
我使用的代码如下:
private void downloadAPK(HttpServletRequest request, HttpServletResponse response, PrintWriter out){
String file = "/usr/local/glassfish4/glassfish/domains/domain1/applications/foo/foo.apk";
FileInputStream inputStream = null;
try{
File downloadFile = new File(file);
inputStream = new FileInputStream(downloadFile);
response.setHeader("Content-Disposition","attachment;filename="+file.getName());
int c = 0;
while ((c = inputStream.read()) != -1)
out.write(c);
} catch (Exception e) {
// code
}
// closing code
}
在Android的Chrome上运行时,我缺少了一些东西
共 (0) 个答案