{ "id": "133172", "key": "TIMOB-17328", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "15972", "description": "Release 3.4.0", "name": "Release 3.4.0", "archived": false, "released": true, "releaseDate": "2014-09-28" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-08-18T21:18:39.000+0000", "created": "2014-07-15T04:18:24.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "module_network", "qe-automation", "qe-testadded" ], "versions": [], "issuelinks": [ { "id": "39084", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "inwardIssue": { "id": "133173", "key": "TIMOB-17329", "fields": { "summary": "Android: Refactor Camera API to not use a temporary file", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } }, { "id": "56989", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "172602", "key": "TIMOB-26550", "fields": { "summary": "Windows: Add support for file property to HTTPClient", "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" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "39083", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "132448", "key": "TIMOB-17252", "fields": { "summary": "OpenSky security concerns", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "6", "description": "gh.issue.epic.desc", "name": "Epic", "subtask": false } } } } ], "assignee": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-11-13T13:02:30.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "In Titanium, we use temporary files when we are dealing with data that can not be kept in memory to avoid OOM errors. One case is in networking calls when the response length is above a threshold. The default is 500K.\r\n\r\nThe blob representing the response (`responseData` in Ti.Network.HTTPClient) will clearly indicate if the blob represents a file (Titanium.Blob.file will return a valid Titanium.Filesystem.File object). Users are free to delete the file once they have processed the data.\r\n\r\nWe should allow the users to pass in a file themselves.", "attachment": [], "flagged": false, "summary": "Android: Add support for file property to HTTPClient", "creator": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 154, "state": "closed", "name": "2014 Sprint 15 SDK", "startDate": "2014-07-21T21:56:31.515Z", "endDate": "2014-08-02T00:00:00.000Z", "completeDate": "2014-08-04T21:03:51.067Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "315492", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/5927\r\n{code}\r\nfunction createButton(title, filename, url) {\r\n\tvar b = Ti.UI.createButton({\r\n\t\ttitle : title\r\n\t});\r\n\r\n\tb.addEventListener(\"click\", function() {\r\n\t\tvar xhr = Titanium.Network.createHTTPClient();\r\n\t\tif (filename != null) {\r\n\t\t\txhr.file = filename;\r\n\t\t}\r\n\t\txhr.onload = function() {\r\n\t\t\tvar responseFilePath = this.responseData.nativePath;\r\n\t\t\talert(\"responseData.nativePath = \" + responseFilePath);\r\n\t\t\tif (responseFilePath != null) {\r\n\t\t\t\timageView.image = responseFilePath;\r\n\t\t\t} else {\r\n\t\t\t\timageView.image = this.responseData;\r\n\t\t\t}\r\n\t\t};\r\n\t\txhr.open('GET', url);\r\n\t\txhr.send();\r\n\t});\r\n\t\r\n\treturn b;\r\n}\r\n\r\n\r\nvar win = Titanium.UI.createWindow({\r\n\ttitle: \"The 'file' property for HTTPClient\",\r\n\tlayout: \"vertical\"\r\n});\r\n\r\nvar imageView = Titanium.UI.createImageView({\r\n\ttop : 5,\r\n\theight : 200,\r\n\twidth : 300\r\n});\r\n\r\nwin.add(createButton(\"Not setting 'file' (download a small image)\", null, \"http://developer.appcelerator.com/blog/wp-content/themes/newapp/images/appcelerator_avatar.png?s=48\"));\r\nwin.add(createButton(\"Not setting 'file' (download a large image)\", null, \"http://2.bp.blogspot.com/-z-cZ7JirojQ/Tc8OMAAqbLI/AAAAAAAAAfc/slhGE764cyY/s1600/Cars+2.jpg\"));\r\nwin.add(createButton(\"'file' is in tempDirectory\", Ti.Filesystem.tempDirectory + \"/sky.jpg\", \"http://www.forestwander.com/wp-content/original/2009_01/Sky-View.JPG\"));\r\nwin.add(createButton(\"'file' is in applicationDataDirectory\", Ti.Filesystem.applicationDataDirectory + \"/flower.jpg\", \"http://flowerdeliverygo.com/wp-content/uploads/2014/05/flower-delivery.jpg\"));\r\nwin.add(createButton(\"'file' is in externalStorageDirectory\", Ti.Filesystem.externalStorageDirectory + \"/fruit.jpg\", \"http://southernbite.com/wp-content/uploads/2012/05/SouthernBiteFruitSalad-2.jpg\"));\r\n\r\nwin.add(imageView);\r\n\r\nwin.open();\r\n{code}\r\n\r\nFor FR: \r\n1. Run the above test case.\r\n2. Click each button. Should see an alert with \"responseData.nativePath=...\" and an image in the imageview. *Note:* when clicking the first button (\"file\" is not set and the responseData is less than 500k), the responseData is kept in memory so the alert shows \"responseData.nativePath = null\".\r\n3. Should see the response files in tempDirectory and externalStorageDirectory. *Note:* if the output file is in applicationDataDirectory, we are unable to see it using any File Manager app.", "updateAuthor": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-07-23T17:26:41.000+0000", "updated": "2014-07-23T17:26:41.000+0000" }, { "id": "315854", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "body": "3_3_X PR: https://github.com/appcelerator/titanium_mobile/pull/5936", "updateAuthor": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-07-25T18:36:21.000+0000", "updated": "2014-07-25T18:36:21.000+0000" }, { "id": "319163", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified by using the test case by [~pwang] & it is working as expected.\r\n\r\nClosing.\r\n\r\nEnvironment:\r\nAppc Studio : 3.4.0.201408051600\r\nTi SDK : 3.4.0.v20140815142514\r\nMac OSX : 10.8.5\r\nAlloy : 1.4.1\r\nCLI - 3.3.0\r\nCode Processor: 1.1.1\r\nNexus 5 - android 4.4.4", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-18T21:16:05.000+0000", "updated": "2014-08-18T21:16:05.000+0000" }, { "id": "330063", "author": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "You should make this work also with Titanium.Filesystem.File, like it does in iOS.", "updateAuthor": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2014-10-30T11:09:46.000+0000", "updated": "2014-10-30T11:09:46.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }