{"id":13743690,"url":"https://github.com/leopoldodonnell/airhttp","last_synced_at":"2025-05-09T01:31:34.982Z","repository":{"id":7752344,"uuid":"9119839","full_name":"leopoldodonnell/airhttp","owner":"leopoldodonnell","description":"An easy to integrate HTTP Server for Adobe Air applications.","archived":false,"fork":false,"pushed_at":"2013-04-03T14:22:36.000Z","size":128,"stargazers_count":26,"open_issues_count":0,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-15T14:35:47.138Z","etag":null,"topics":["adobe-air"],"latest_commit_sha":null,"homepage":null,"language":"ActionScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leopoldodonnell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-30T18:11:31.000Z","updated_at":"2022-05-09T14:28:32.000Z","dependencies_parsed_at":"2022-09-18T11:10:24.542Z","dependency_job_id":null,"html_url":"https://github.com/leopoldodonnell/airhttp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leopoldodonnell%2Fairhttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leopoldodonnell%2Fairhttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leopoldodonnell%2Fairhttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leopoldodonnell%2Fairhttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leopoldodonnell","download_url":"https://codeload.github.com/leopoldodonnell/airhttp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253174329,"owners_count":21865849,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adobe-air"],"created_at":"2024-08-03T05:00:55.054Z","updated_at":"2025-05-09T01:31:29.969Z","avatar_url":"https://github.com/leopoldodonnell.png","language":"ActionScript","readme":"Air Http Daemon\n========\n\n**Air Http** is a flex library that enables developers to add an HTTP Deamon inside an AIR application. This simple AIR webserver\nmakes it easy to extend access to functions and status within an application. This is especially useful if you've got to communicate\nfrom a webpage (over localhost) without the use of FLASH communication. At the time this was written, for example, Chrome's sandbox\nwould prevent communication with other FLASH components that were in other processes.\n\nThe server, com.airhttp.HttpServer, is simple to incorporate and provides the ability to server files found under a specified\ndirectory within your *applicationStorageDirectory*, or extend with *ActionControllers* that implement actions in code you\nsupply.\n\nVersion\n-------\n\nThis is version 0.1.0\n\n* Only supports GET requests\n* Still needs to be fully tested\n* Its working with Flash Build 4.7 and SDK 4.6.0\n\nAdding the HTTP Server to Your Application\n-----\n\nAdding the **Air Http** server to your application is fairly simple (it must be an AIR application). All classes are found under\n*com.airhttp*. To instantiate an start your server, add the following code to one of your application classes that will manage the\nserver.\n\n```actionscript3\n    // import the package\n    import com.airhttp.*;\n    \n    // declare your server\n    private var weberv:HttpServer;\n    \n    // instantiate the server on port 4567\n    webserv = (new HttpServer());\n    var isListening:Boolean = webserv.listen(4567);\n```\n\nExtending your Application to HTTP with ActionControllers\n---------------------------------------------------------\n\n*com.airhttp.ActionController* is the base class for controllers. Extending this class to do something, or\nrespond with some data is very simple.\n\n* Subclass com.airhttp.ActionController\n* Provide a unique route string to lookup the controller\n* Provide actions, named as methods, that provide some function and return a String or ByteArray response.\n* Register this controller with your com.airhttp.HttpServer instance.\n\n**Example - ** Display Application Status\n\nIn AppServiceController.as ...\n\n```actionscript3\n    class AppServiceController extends com.airhttp.ActionController\n    {\n      private var _theApp:Object;\n      \n      public function AppServiceController(theApp:Object)\n      {\n        super('/app');\n        _theApp = theApp;\n      }\n      \n      /**\n      * Respond with list of application stats, or a single\n      * stat if it's name is passed in the URL with the 'name'\n      * parameter.\n      * \n      * ie. http://localhost:4567/app/status?name='uptime'\n      */\n      public function status(params:URLVariables):String\n      {\n          var items:String = \"\u003cul\u003e\";\n          var stats:Object = _theApp.statusValues;\n          \n          // Return one of the stats?\n          if (params.hasOwnProperty('name')) {\n            items += \"\u003cli\u003e\" + params.name + \" : \" + stats[params.name] + \"\u003c/li\u003e\u003c/ul\u003e\";\n\n            // Respond with success!\n            return responseSuccess(\"\u003ch1\u003eStatus\u003c/h1\u003e\" + items);\n          }\n\n          // Return all of the stats\n          for (var itemName:String in stats) {\n              items += \"\u003cli\u003e\" + itemName + \" : \" + stats[itemName] + \"\u003c/li\u003e\";\n          }\n          items += \"\u003c/ul\u003e\";\n          \n          // Respond with success!\n          return responseSuccess(\"\u003ch1\u003eStatus\u003c/h1\u003e\" + items);\n      }\n    }\n```\n    \nThen in your webserver managing class ...\n\n    // myApp is a pointer to a class that has \"statusValues\"\n    webserv.registerCalback(new AppServiceController(myApp));\n    \nThen from a web browser\n\n    http://localhost:4567/app/status\n    \nBuilding\n--------\n\nTo build airhttp you need the flex sdk and ant. 1st edit FLEX_HOME in build/build.properties and then type the following commands from\nthe top level directory.\n\n    \u003e cd build\n    \u003e ant\n\nLicense\n-------\n\nThis project rocks and uses MIT-LICENSE. Copyright 2013 Leopold O'Donnell","funding_links":[],"categories":["Networking"],"sub_categories":["HTTP"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleopoldodonnell%2Fairhttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleopoldodonnell%2Fairhttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleopoldodonnell%2Fairhttp/lists"}