我想使用android默认浏览器从servlet下载文件,下载代码如下:
byte[] bytes = objectToBytes(targetObject);
String filename = URLEncoder.encode(infoCard.getCardName() + ".xxx", "UTF-8");
response.reset();
response.setContentType("application/octet-stream");
response.setHeader("Content-Transfer-Encoding", "Binary");
response.setHeader("Content-Disposition", "attachment;filename=\"" + filename + "\"");
response.setContentLength(bytes.length);
ServletOutputStream out = response.getOutputStream();
out.write(bytes);
out.close();
此代码适用于PC或Android上的Opera,但默认浏览器无法成功下载。我该怎么做才能支持默认浏览器?
This problem is caused by the HTTPS.