我正在尝试使用DownloadManager从我的服务器解析带有JSESSIONID的cookie来获取一个zip文件.我正在使用HTTPCLIENT lib获取此JSESSIONID所有进程登录并设置变量JSESSIONID以供稍后在我的DownloadManager请求中使用.
我的下载请求:
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(htmlUrlDownload));
request.addRequestHeader("Cookie", "JSESSIONID=" + JSESSIONID);
request.addRequestHeader(Constants.USER_AGENT, Constants.TARGET_REQUEST_HEADER);
request.setDescription("Baixando " + metaDado.getType());
request.setTitle("Download");
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
String nameFile = offlineUuid + ".zip";
fileName = nameFile;
filePath = Environment.getExternalStorageDirectory() + File.separator + Environment.DIRECTORY_DOWNLOADS
+ File.separator + fileName;
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, nameFile);
final DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
final long downloadId = manager.enqueue(request);
问题是下载永远不会开始,COLUMN_REASON会将代码返回到ERROR_UNHANDLED_HTTP_CODE
但是,如果我尝试使用Dropbox链接下载相同的文件而无需身份验证或使用httpclient,它的工作完美,我做错了什么?
如何获得更好的消息错误?