{ "id": "94230", "key": "AC-2961", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2012-08-01T11:48:59.000+0000", "created": "2012-07-02T05:48:35.000+0000", "labels": [ "android", "httpclient" ], "versions": [], "issuelinks": [], "assignee": { "name": "btran", "key": "btran", "displayName": "Betty Tran", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:47:57.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "If I do abort on the HttpClient to cancel the currently on going download. Abort is working but if I go back and aging hit the download it throws bad request error message in adb logcat as below. In iPhone it is working fine but in android it is causing this problem.\r\n\r\nAbort code:\r\n\r\nalertDialog = Titanium.UI.createAlertDialog({\r\n\t\t\ttitle : 'Attachment Download',\r\n\t\t\tmessage : 'Please wait your attachment is downloading',\r\n\t\t\tbuttonNames : ['Ok', 'Cancel'],\r\n\t\t\tcancel : 1\r\n\t\t});\r\n\r\n\t\talertDialog.show();\r\n\t\tTi.App.abort = false;\r\n\r\n\t\talertDialog.addEventListener('click', function(e) {\r\n\t\t\tTi.API.info(\"Abort File DOANLOAD=====================\");\r\n\t\t\tif(e.index == 1) {\r\n\t\t\t\tTi.App.abort = true;\r\n\t\t\t}\r\n\t\t\talertDialog.hide();\r\n\t\t});\r\n\t\t//Get the response from the server\r\n\r\n\t\txhr.ondatastream = function() {\r\n\t\t\tif(Ti.App.abort == true) {\r\n\t\t\t\txhr.abort();\r\n\t\t\t}\r\n\t\t}\r\n\r\nHere abort is working but If go back and again try to download it shows me the below error:-\r\n\r\n07-02 18:12:38.496: ERROR/TiHttpClient(9697): (TiHttpClient-13) [4017,425618] HTTP Error (org.apache.http.client.HttpResponseException): Bad Request\r\n07-02 18:12:38.496: ERROR/TiHttpClient(9697): org.apache.http.client.HttpResponseException: Bad Request\r\n07-02 18:12:38.496: ERROR/TiHttpClient(9697): at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.handleResponse(TiHTTPClient.java:231)\r\n07-02 18:12:38.496: ERROR/TiHttpClient(9697): at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.handleResponse(TiHTTPClient.java:190)\r\n07-02 18:12:38.496: ERROR/TiHttpClient(9697): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:657)\r\n07-02 18:12:38.496: ERROR/TiHttpClient(9697): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:637)\r\n07-02 18:12:38.496: ERROR/TiHttpClient(9697): at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1123)\r\n07-02 18:12:38.496: ERROR/TiHttpClient(9697): at java.lang.Thread.run(Thread.java:1019)\r\n07-02 18:12:38.500: INFO/TiHttpClient(9697): (TiHttpClient-13) [5,425623] Sending error Bad Request\r\n\r\n\r\nSo please suggest me If I am wrongly using the abort function or any thing I should do.\r\n\r\n\r\n", "attachment": [], "flagged": false, "summary": "If I do abort on the HttpClient. Abort is working but if I go back and agin hit the download it thorows bad request eror message in adb logcat", "creator": { "name": "surajit_rcc8", "key": "surajit_rcc8", "displayName": "Surajit Biswas", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "surajit_rcc8", "key": "surajit_rcc8", "displayName": "Surajit Biswas", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Android 2.2, Titanium modile sdk 2.1.0", "comment": { "comments": [ { "id": "201884", "author": { "name": "vjoshi", "key": "vjoshi", "displayName": "Varun Joshi", "active": true, "timeZone": "America/New_York" }, "body": "Hi,\r\n\r\nIt would be great if you can provide a complete test case. I tried the sample code below and it seems to be working fine. Clicking on post data and then clicking on cancel in the alert dialog to abort httpclient and then clicking on post data again worked properly. Is this what you are trying to accomplish?\r\n\r\nA test case would be good to have.\r\n\r\n{noformat}\r\n\r\nTitanium.UI.setBackgroundColor('#000');\r\n\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor : 'white'\r\n});\r\nwin.open();\r\n\r\nvar b2 = Titanium.UI.createButton({\r\n title : 'Post data',\r\n height : 40,\r\n width : 200,\r\n top : 120\r\n});\r\n\r\nwin.add(b2);\r\n\r\nb2.addEventListener('click', function() {\r\n var http = Ti.Network.createHTTPClient();\r\n http.onerror = function(e) {\r\n Ti.API.error(e.error);\r\n };\r\n http.open('POST', 'http://www.appcelerator.com');\r\n http.send();\r\n Ti.API.info('after send call');\r\n\r\n http.onload = function() {\r\n\r\n var alertDialog = Titanium.UI.createAlertDialog({\r\n title : 'Attachment Download',\r\n message : 'Please wait your attachment is downloading',\r\n buttonNames : ['Ok', 'Cancel'],\r\n cancel : 1\r\n });\r\n alertDialog.show();\r\n Ti.App.abort = false;\r\n alertDialog.addEventListener('click', function(e) {\r\n Ti.API.info(\"Abort File DOWNLOAD=====================\");\r\n if (e.index == 1) {\r\n Ti.App.abort = true;\r\n }\r\n alertDialog.hide();\r\n });\r\n };\r\n http.ondatastream = function(e) {\r\n Ti.API.info('ONDATASTREAM1 - PROGRESS: ' + e.progress);\r\n if (Ti.App.abort == true) {\r\n http.abort();\r\n }\r\n };\r\n});\r\n\r\n{noformat}\r\n\r\nThanks,\r\nVarun", "updateAuthor": { "name": "vjoshi", "key": "vjoshi", "displayName": "Varun Joshi", "active": true, "timeZone": "America/New_York" }, "created": "2012-07-06T13:37:39.000+0000", "updated": "2012-07-06T13:37:39.000+0000" }, { "id": "286385", "author": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing since we have not heard back from Surajit.", "updateAuthor": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-01-01T01:41:25.000+0000", "updated": "2014-01-01T01:41:25.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }