flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [1/2] git commit: [flex-asjs] [refs/heads/develop] - add JSON property
Date Fri, 01 May 2015 06:52:27 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 8cf28a4cf -> e9215c254


add JSON property


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/80876eb2
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/80876eb2
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/80876eb2

Branch: refs/heads/develop
Commit: 80876eb27649b025d5700a69a3083298c03e8d19
Parents: 8cf28a4
Author: Alex Harui <aharui@apache.org>
Authored: Thu Apr 30 23:51:20 2015 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Thu Apr 30 23:52:18 2015 -0700

----------------------------------------------------------------------
 .../as/src/org/apache/flex/net/HTTPService.as   | 65 ++++++++++++++++++++
 .../js/src/org/apache/flex/net/HTTPService.js   | 37 +++++++++++
 2 files changed, 102 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/80876eb2/frameworks/projects/Network/as/src/org/apache/flex/net/HTTPService.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Network/as/src/org/apache/flex/net/HTTPService.as b/frameworks/projects/Network/as/src/org/apache/flex/net/HTTPService.as
index 06836ae..b0d4f2f 100644
--- a/frameworks/projects/Network/as/src/org/apache/flex/net/HTTPService.as
+++ b/frameworks/projects/Network/as/src/org/apache/flex/net/HTTPService.as
@@ -136,6 +136,52 @@ package org.apache.flex.net
 		public static const HTTP_METHOD_DELETE:String = URLRequestMethod.DELETE;
 		
         /**
+         *  Dispatched when the request is complete.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public static const EVENT_COMPLETE:String = "complete";
+        
+        /**
+         *  Dispatched if an error occurs in the server communication.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public static const EVENT_IO_ERROR:String = "ioError";
+        
+        /**
+         *  Dispatched when an httpStatus code is received from the server.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public static const EVENT_HTTP_STATUS:String = "httpStatus";
+        
+        /**
+         *  Dispatched if Adobe AIR is able to detect and return the status 
+         *  code for the request.  Unlike the httpStatus event, the httpResponseStatus 
+         *  event is delivered before any response data. Also, the httpResponseStatus 
+         *  event includes values for the responseHeaders and responseURL properties 
+         *  (which are undefined for an httpStatus event. Note that the 
+         *  httpResponseStatus event (if any) will be sent before 
+         *  (and in addition to) any complete or error event.
+         * 
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public static const EVENT_HTTP_RESPONSE_STATUS:String = "httpResponseStatus";
+        
+        /**
          *  Constructor.
          *  
          *  @langversion 3.0
@@ -606,5 +652,24 @@ package org.apache.flex.net
         {
             return urlLoader.data;
         }
+        
+        
+        private var _json:Object;
+        
+        /**
+         *  A JSON object parsed from the data.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public function get json():Object
+        {
+            if (!_json)
+                _json = JSON.parse(data);
+            return _json;
+        }
+
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/80876eb2/frameworks/projects/Network/js/src/org/apache/flex/net/HTTPService.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Network/js/src/org/apache/flex/net/HTTPService.js b/frameworks/projects/Network/js/src/org/apache/flex/net/HTTPService.js
index ff1f743..e9be92d 100644
--- a/frameworks/projects/Network/js/src/org/apache/flex/net/HTTPService.js
+++ b/frameworks/projects/Network/js/src/org/apache/flex/net/HTTPService.js
@@ -147,6 +147,34 @@ org_apache_flex_net_HTTPService.HTTP_METHOD_PUT = 'PUT';
 org_apache_flex_net_HTTPService.HTTP_METHOD_DELETE = 'DELETE';
 
 
+/**
+ * @expose
+ * @type {string}
+ */
+org_apache_flex_net_HTTPService.EVENT_COMPLETE = 'complete';
+
+
+/**
+ * @expose
+ * @type {string}
+ */
+org_apache_flex_net_HTTPService.EVENT_IO_ERROR = 'ioError';
+
+
+/**
+ * @expose
+ * @type {string}
+ */
+org_apache_flex_net_HTTPService.EVENT_HTTP_STATUS = 'httpStatus';
+
+
+/**
+ * @expose
+ * @type {string}
+ */
+org_apache_flex_net_HTTPService.EVENT_HTTP_RESPONSE_STATUS = 'httpResponseStatus';
+
+
 Object.defineProperties(org_apache_flex_net_HTTPService.prototype, {
     /** @expose */
     strand: {
@@ -168,6 +196,15 @@ Object.defineProperties(org_apache_flex_net_HTTPService.prototype, {
         }
     },
     /** @expose */
+    json: {
+        /** @this {org_apache_flex_net_HTTPService} */
+        get: function() {
+            if (!this._json)
+              _json = JSON.parse(this.data);
+            return _json;
+        }
+    },
+    /** @expose */
     contentData: {
         /** @this {org_apache_flex_net_HTTPService} */
         get: function() {


Mime
View raw message